Fix migration 6.0.0: Comment out sent_email_tracking
This commit is contained in:
parent
b103c07248
commit
5568ef5802
3 changed files with 74 additions and 18 deletions
|
|
@ -2,15 +2,15 @@
|
||||||
{
|
{
|
||||||
"label": "Debug BotServer",
|
"label": "Debug BotServer",
|
||||||
"build": {
|
"build": {
|
||||||
"command": "rm -rf .env ./botserver-stack && cargo",
|
"command": "cargo",
|
||||||
"args": ["build"]
|
"args": ["build"],
|
||||||
},
|
},
|
||||||
"program": "$ZED_WORKTREE_ROOT/target/debug/botserver",
|
"program": "$ZED_WORKTREE_ROOT/target/debug/botserver",
|
||||||
"env": {
|
"env": {
|
||||||
"RUST_LOG": "trace"
|
"RUST_LOG": "trace",
|
||||||
},
|
},
|
||||||
"sourceLanguages": ["rust"],
|
"sourceLanguages": ["rust"],
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"adapter": "CodeLLDB"
|
"adapter": "CodeLLDB",
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
70
PROMPT.md
70
PROMPT.md
|
|
@ -32,17 +32,48 @@
|
||||||
|
|
||||||
## 🔐 SECURITY REQUIREMENTS
|
## 🔐 SECURITY REQUIREMENTS
|
||||||
|
|
||||||
### Error Handling
|
### Error Handling - CRITICAL DEBT
|
||||||
|
|
||||||
|
**Current Status**: 955 instances of `unwrap()`/`expect()` found in codebase
|
||||||
|
**Target**: 0 instances in production code (tests excluded)
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// ❌ WRONG
|
// ❌ WRONG - Found 955 times in codebase
|
||||||
let value = something.unwrap();
|
let value = something.unwrap();
|
||||||
let value = something.expect("msg");
|
let value = something.expect("msg");
|
||||||
|
|
||||||
// ✅ CORRECT
|
// ✅ CORRECT - Required replacements
|
||||||
let value = something?;
|
let value = something?;
|
||||||
let value = something.ok_or_else(|| Error::NotFound)?;
|
let value = something.ok_or_else(|| Error::NotFound)?;
|
||||||
let value = something.unwrap_or_default();
|
let value = something.unwrap_or_default();
|
||||||
|
let value = something.unwrap_or_else(|e| {
|
||||||
|
log::error!("Operation failed: {e}");
|
||||||
|
default_value
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Issues - CRITICAL DEBT
|
||||||
|
|
||||||
|
**Current Status**: 12,973 excessive `clone()`/`to_string()` calls
|
||||||
|
**Target**: Minimize allocations, use references where possible
|
||||||
|
|
||||||
|
```rust
|
||||||
|
// ❌ WRONG - Excessive allocations
|
||||||
|
let name = user.name.clone();
|
||||||
|
let msg = format!("Hello {}", name.to_string());
|
||||||
|
|
||||||
|
// ✅ CORRECT - Minimize allocations
|
||||||
|
let name = &user.name;
|
||||||
|
let msg = format!("Hello {name}");
|
||||||
|
|
||||||
|
// ✅ CORRECT - Use Cow for conditional ownership
|
||||||
|
use std::borrow::Cow;
|
||||||
|
fn process_name(name: Cow<str>) -> String {
|
||||||
|
match name {
|
||||||
|
Cow::Borrowed(s) => s.to_uppercase(),
|
||||||
|
Cow::Owned(s) => s.to_uppercase(),
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Rhai Syntax Registration
|
### Rhai Syntax Registration
|
||||||
|
|
@ -182,10 +213,25 @@ src/
|
||||||
│ └── keywords/ # BASIC keyword implementations
|
│ └── keywords/ # BASIC keyword implementations
|
||||||
├── security/ # Security modules
|
├── security/ # Security modules
|
||||||
├── shared/ # Shared types, models
|
├── shared/ # Shared types, models
|
||||||
├── tasks/ # AutoTask system
|
├── tasks/ # AutoTask system (2651 lines - NEEDS REFACTORING)
|
||||||
└── auto_task/ # App generator
|
├── auto_task/ # App generator (2981 lines - NEEDS REFACTORING)
|
||||||
|
├── drive/ # File operations (1522 lines - NEEDS REFACTORING)
|
||||||
|
├── learn/ # Learning system (2306 lines - NEEDS REFACTORING)
|
||||||
|
└── attendance/ # LLM assistance (2053 lines - NEEDS REFACTORING)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Files Requiring Immediate Refactoring
|
||||||
|
|
||||||
|
| File | Current Lines | Target |
|
||||||
|
|------|---------------|--------|
|
||||||
|
| `auto_task/app_generator.rs` | 2981 | Split into 7 files |
|
||||||
|
| `tasks/mod.rs` | 2651 | Split into 6 files |
|
||||||
|
| `learn/mod.rs` | 2306 | Split into 5 files |
|
||||||
|
| `attendance/llm_assist.rs` | 2053 | Split into 5 files |
|
||||||
|
| `drive/mod.rs` | 1522 | Split into 4 files |
|
||||||
|
|
||||||
|
**See `TODO-refactor1.md` for detailed refactoring plans**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🗄️ DATABASE STANDARDS
|
## 🗄️ DATABASE STANDARDS
|
||||||
|
|
@ -251,9 +297,19 @@ When configuring CI/CD pipelines (e.g., Forgejo Actions):
|
||||||
- **ZERO COMMENTS** - no comments, no doc comments
|
- **ZERO COMMENTS** - no comments, no doc comments
|
||||||
- **NO ALLOW IN CODE** - configure exceptions in Cargo.toml only
|
- **NO ALLOW IN CODE** - configure exceptions in Cargo.toml only
|
||||||
- **NO DEAD CODE** - delete unused code
|
- **NO DEAD CODE** - delete unused code
|
||||||
- **NO UNWRAP/EXPECT** - use ? or combinators
|
- **NO UNWRAP/EXPECT** - use ? or combinators (955 instances to fix)
|
||||||
|
- **MINIMIZE CLONES** - avoid excessive allocations (12,973 instances to optimize)
|
||||||
- **PARAMETERIZED SQL** - never format! for queries
|
- **PARAMETERIZED SQL** - never format! for queries
|
||||||
- **VALIDATE COMMANDS** - never pass raw user input
|
- **VALIDATE COMMANDS** - never pass raw user input
|
||||||
- **INLINE FORMAT ARGS** - `format!("{name}")` not `format!("{}", name)`
|
- **INLINE FORMAT ARGS** - `format!("{name}")` not `format!("{}", name)`
|
||||||
- **USE SELF** - in impl blocks, use Self not type name
|
- **USE SELF** - in impl blocks, use Self not type name
|
||||||
- **Version 6.2.0** - do not change without approval
|
- **FILE SIZE LIMIT** - max 450 lines per file, refactor at 350 lines
|
||||||
|
- **Version 6.2.0** - do not change without approval
|
||||||
|
|
||||||
|
## 🚨 IMMEDIATE ACTION REQUIRED
|
||||||
|
|
||||||
|
1. **Replace 955 unwrap()/expect() calls** with proper error handling
|
||||||
|
2. **Optimize 12,973 clone()/to_string() calls** for performance
|
||||||
|
3. **Refactor 5 large files** following TODO-refactor1.md
|
||||||
|
4. **Add missing error handling** in critical paths
|
||||||
|
5. **Implement proper logging** instead of panicking
|
||||||
|
|
@ -2029,12 +2029,12 @@ CREATE INDEX IF NOT EXISTS idx_source_templates_category ON source_templates(cat
|
||||||
-- Email tracking moved to migrations/mail
|
-- Email tracking moved to migrations/mail
|
||||||
|
|
||||||
-- Add comment for documentation
|
-- Add comment for documentation
|
||||||
COMMENT ON TABLE sent_email_tracking IS 'Tracks sent emails for read receipt functionality via tracking pixel';
|
-- COMMENT ON TABLE sent_email_tracking IS 'Tracks sent emails for read receipt functionality via tracking pixel';
|
||||||
COMMENT ON COLUMN sent_email_tracking.tracking_id IS 'Unique ID embedded in tracking pixel URL';
|
-- COMMENT ON COLUMN sent_email_tracking.tracking_id IS 'Unique ID embedded in tracking pixel URL';
|
||||||
COMMENT ON COLUMN sent_email_tracking.is_read IS 'Whether the email has been opened (pixel loaded)';
|
-- COMMENT ON COLUMN sent_email_tracking.is_read IS 'Whether the email has been opened (pixel loaded)';
|
||||||
COMMENT ON COLUMN sent_email_tracking.read_count IS 'Number of times the email was opened';
|
-- COMMENT ON COLUMN sent_email_tracking.read_count IS 'Number of times the email was opened';
|
||||||
COMMENT ON COLUMN sent_email_tracking.first_read_ip IS 'IP address of first email open';
|
-- COMMENT ON COLUMN sent_email_tracking.first_read_ip IS 'IP address of first email open';
|
||||||
COMMENT ON COLUMN sent_email_tracking.last_read_ip IS 'IP address of most recent email open';
|
-- COMMENT ON COLUMN sent_email_tracking.last_read_ip IS 'IP address of most recent email open';
|
||||||
-- ============================================
|
-- ============================================
|
||||||
-- TABLE KEYWORD SUPPORT (from 6.1.0_table_keyword)
|
-- TABLE KEYWORD SUPPORT (from 6.1.0_table_keyword)
|
||||||
-- ============================================
|
-- ============================================
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue