Compress always-on contracts and restore pagination fields
The always-on set is paid by every session, so it gets the tightest form: git-sync-check shrinks to its procedural core, testing-policy moves the table-test example to README.md and folds the agent instructions into the rules, go-code-style inlines the error-wrapping example. Per-session read cost drops from 403 to 336 lines. Also restore the pagination response fields in table-management: the previous dedup replaced them with a reference to go-api, which the table router line does not load. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Contract: Go Code Style and Project Conventions
|
||||
|
||||
Version: 1.2
|
||||
Version: 1.3
|
||||
|
||||
## Source Text and Comments
|
||||
|
||||
@@ -17,18 +17,8 @@ Summary: use `slog`, log to stdout/stderr (binary console), never to browser con
|
||||
|
||||
## Error Handling
|
||||
|
||||
Always wrap errors with context. Use `fmt.Errorf("...: %w", err)`.
|
||||
|
||||
```go
|
||||
// CORRECT
|
||||
if err := db.Save(&record).Error; err != nil {
|
||||
return fmt.Errorf("save component %s: %w", record.ID, err)
|
||||
}
|
||||
|
||||
// WRONG: loses context
|
||||
return err
|
||||
```
|
||||
|
||||
- Always wrap errors with context: `fmt.Errorf("save component %s: %w", record.ID, err)`.
|
||||
A bare `return err` loses context.
|
||||
- Never silently discard errors with `_` in production paths.
|
||||
- Return errors up the call stack; log at the handler/task boundary, not deep in service code.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user