sdtk-code-kit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -201
- package/assets/manifest/toolkit-bundle.manifest.json +147 -147
- package/assets/manifest/toolkit-bundle.sha256.txt +28 -28
- package/assets/toolkit/toolkit/AGENTS.md +219 -219
- package/assets/toolkit/toolkit/install.ps1 +156 -156
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +78 -78
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +150 -150
- package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +62 -62
- package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +82 -82
- package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
- package/assets/toolkit/toolkit/sdtk-spec.config.profiles.example.json +12 -12
- package/assets/toolkit/toolkit/skills/code-brainstorm/SKILL.md +55 -55
- package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +296 -296
- package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
- package/assets/toolkit/toolkit/skills/code-discover/SKILL.md +54 -54
- package/assets/toolkit/toolkit/skills/code-execute/SKILL.md +74 -74
- package/assets/toolkit/toolkit/skills/code-finish/SKILL.md +205 -205
- package/assets/toolkit/toolkit/skills/code-parallel/SKILL.md +64 -64
- package/assets/toolkit/toolkit/skills/code-parallel/references/code-quality-reviewer-prompt.md +26 -26
- package/assets/toolkit/toolkit/skills/code-parallel/references/implementer-prompt.md +113 -113
- package/assets/toolkit/toolkit/skills/code-parallel/references/spec-reviewer-prompt.md +61 -61
- package/assets/toolkit/toolkit/skills/code-plan/SKILL.md +85 -85
- package/assets/toolkit/toolkit/skills/code-review/SKILL.md +79 -79
- package/assets/toolkit/toolkit/skills/code-review/references/checklist.md +125 -125
- package/assets/toolkit/toolkit/skills/code-review/references/code-reviewer.md +146 -146
- package/assets/toolkit/toolkit/skills/code-ship/SKILL.md +52 -52
- package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +378 -378
- package/assets/toolkit/toolkit/skills/code-tdd/references/testing-anti-patterns.md +299 -299
- package/assets/toolkit/toolkit/skills/code-verify/SKILL.md +144 -144
- package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +228 -228
- package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -140
- package/bin/sdtk-code.js +14 -14
- package/package.json +44 -44
- package/src/commands/build.js +53 -53
- package/src/commands/doctor.js +51 -51
- package/src/commands/generate.js +11 -11
- package/src/commands/guardrails.js +215 -123
- package/src/commands/help.js +244 -244
- package/src/commands/init.js +98 -98
- package/src/commands/plan.js +53 -53
- package/src/commands/readiness.js +77 -77
- package/src/commands/resume.js +61 -61
- package/src/commands/runtime.js +224 -224
- package/src/commands/ship.js +59 -59
- package/src/commands/sleep.js +132 -0
- package/src/commands/start.js +89 -89
- package/src/commands/status.js +77 -77
- package/src/commands/update.js +11 -11
- package/src/commands/verify.js +71 -71
- package/src/index.js +108 -104
- package/src/lib/args.js +107 -107
- package/src/lib/errors.js +41 -41
- package/src/lib/powershell.js +65 -65
- package/src/lib/project-target-guard.js +53 -53
- package/src/lib/scope.js +72 -72
- package/src/lib/ship-readiness.js +281 -281
- package/src/lib/sleep-plan.js +175 -0
- package/src/lib/sleep-report.js +229 -0
- package/src/lib/toolkit-payload.js +72 -72
- package/src/lib/trust-events.js +166 -166
- package/src/lib/trust-file-scope.js +154 -154
- package/src/lib/trust-policy.js +212 -212
- package/src/lib/trust-redact.js +35 -35
- package/src/lib/trust-trace.js +179 -179
- package/src/lib/update.js +344 -344
- package/src/lib/workflow-artifact.js +503 -503
- package/src/lib/workflow-build.js +127 -127
- package/src/lib/workflow-doctor.js +83 -83
- package/src/lib/workflow-handoff.js +1029 -1029
- package/src/lib/workflow-intake.js +101 -101
- package/src/lib/workflow-plan.js +193 -193
- package/src/lib/workflow-review-packet.js +650 -650
- package/src/lib/workflow-ship.js +213 -213
- package/src/lib/workflow-state.js +438 -438
- package/src/lib/workflow-verify.js +393 -393
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review
|
|
3
|
-
description: Code review -- requesting and receiving. Use when completing a feature, before merging, or when receiving review feedback.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Code Review
|
|
7
|
-
|
|
8
|
-
## Critical Constraints
|
|
9
|
-
- I do not treat style feedback as a substitute for requirement or spec compliance.
|
|
10
|
-
- I do not ship code while critical review issues remain unresolved.
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
Run review in two stages:
|
|
14
|
-
1. Spec compliance review
|
|
15
|
-
2. Code quality review
|
|
16
|
-
|
|
17
|
-
Use this skill both when requesting review and when responding to review feedback.
|
|
18
|
-
|
|
19
|
-
## Process
|
|
20
|
-
### Stage 1: Requesting Review
|
|
21
|
-
1. Identify the exact scope being reviewed.
|
|
22
|
-
2. Gather the requirement or plan reference, the files changed, and the verification evidence already collected.
|
|
23
|
-
3. Start with spec compliance:
|
|
24
|
-
- confirm the code matches the requested behavior
|
|
25
|
-
- confirm there is no silent scope creep
|
|
26
|
-
- confirm required tests or verification exist
|
|
27
|
-
4. Only after Stage 1 passes, run code quality review.
|
|
28
|
-
5. For code quality review, use the checklist at `./references/checklist.md` and the reviewer prompt at `./references/code-reviewer.md` when delegated review is appropriate.
|
|
29
|
-
|
|
30
|
-
### Stage 2: Receiving Review
|
|
31
|
-
1. Read the review comments carefully.
|
|
32
|
-
2. Classify each item:
|
|
33
|
-
- critical: blocks merge or release
|
|
34
|
-
- important: should fix before handoff
|
|
35
|
-
- minor: worth fixing if low risk
|
|
36
|
-
3. Verify the review comment against the code before changing anything.
|
|
37
|
-
4. Fix valid issues with the smallest coherent diff.
|
|
38
|
-
5. Re-run verification after fixes.
|
|
39
|
-
6. If a review comment is incorrect, push back with technical evidence.
|
|
40
|
-
|
|
41
|
-
### Stage 3: Pre-Landing Checklist
|
|
42
|
-
Always run a final pass on:
|
|
43
|
-
- SQL and data safety
|
|
44
|
-
- race conditions and concurrency
|
|
45
|
-
- LLM trust boundary or unsafe generated input handling
|
|
46
|
-
- conditional side effects
|
|
47
|
-
- magic numbers or string coupling
|
|
48
|
-
- dead code and stale comments
|
|
49
|
-
- prompt or instruction drift
|
|
50
|
-
- test gaps
|
|
51
|
-
- crypto and entropy issues
|
|
52
|
-
- time-window assumptions
|
|
53
|
-
- type coercion at boundaries
|
|
54
|
-
- view or frontend performance traps
|
|
55
|
-
|
|
56
|
-
Use `./references/checklist.md` as the canonical checklist.
|
|
57
|
-
|
|
58
|
-
## Review Output Format
|
|
59
|
-
- Strengths
|
|
60
|
-
- Critical issues
|
|
61
|
-
- Important issues
|
|
62
|
-
- Minor issues
|
|
63
|
-
- Assessment: ready / ready with fixes / not ready
|
|
64
|
-
|
|
65
|
-
Each issue should include:
|
|
66
|
-
- file reference
|
|
67
|
-
- what is wrong
|
|
68
|
-
- why it matters
|
|
69
|
-
- how to fix it
|
|
70
|
-
|
|
71
|
-
## Red Flags
|
|
72
|
-
- Requesting code-quality review before verifying the code matches the spec.
|
|
73
|
-
- Accepting review comments without checking the actual code.
|
|
74
|
-
- Ignoring a critical issue because tests happen to pass.
|
|
75
|
-
- Turning review into an unbounded refactor request.
|
|
76
|
-
|
|
77
|
-
## Integration
|
|
78
|
-
- Use after `code-execute` or `code-parallel` finishes an implementation slice.
|
|
79
|
-
- `code-ship` depends on this review gate being complete.
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Code review -- requesting and receiving. Use when completing a feature, before merging, or when receiving review feedback.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review
|
|
7
|
+
|
|
8
|
+
## Critical Constraints
|
|
9
|
+
- I do not treat style feedback as a substitute for requirement or spec compliance.
|
|
10
|
+
- I do not ship code while critical review issues remain unresolved.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
Run review in two stages:
|
|
14
|
+
1. Spec compliance review
|
|
15
|
+
2. Code quality review
|
|
16
|
+
|
|
17
|
+
Use this skill both when requesting review and when responding to review feedback.
|
|
18
|
+
|
|
19
|
+
## Process
|
|
20
|
+
### Stage 1: Requesting Review
|
|
21
|
+
1. Identify the exact scope being reviewed.
|
|
22
|
+
2. Gather the requirement or plan reference, the files changed, and the verification evidence already collected.
|
|
23
|
+
3. Start with spec compliance:
|
|
24
|
+
- confirm the code matches the requested behavior
|
|
25
|
+
- confirm there is no silent scope creep
|
|
26
|
+
- confirm required tests or verification exist
|
|
27
|
+
4. Only after Stage 1 passes, run code quality review.
|
|
28
|
+
5. For code quality review, use the checklist at `./references/checklist.md` and the reviewer prompt at `./references/code-reviewer.md` when delegated review is appropriate.
|
|
29
|
+
|
|
30
|
+
### Stage 2: Receiving Review
|
|
31
|
+
1. Read the review comments carefully.
|
|
32
|
+
2. Classify each item:
|
|
33
|
+
- critical: blocks merge or release
|
|
34
|
+
- important: should fix before handoff
|
|
35
|
+
- minor: worth fixing if low risk
|
|
36
|
+
3. Verify the review comment against the code before changing anything.
|
|
37
|
+
4. Fix valid issues with the smallest coherent diff.
|
|
38
|
+
5. Re-run verification after fixes.
|
|
39
|
+
6. If a review comment is incorrect, push back with technical evidence.
|
|
40
|
+
|
|
41
|
+
### Stage 3: Pre-Landing Checklist
|
|
42
|
+
Always run a final pass on:
|
|
43
|
+
- SQL and data safety
|
|
44
|
+
- race conditions and concurrency
|
|
45
|
+
- LLM trust boundary or unsafe generated input handling
|
|
46
|
+
- conditional side effects
|
|
47
|
+
- magic numbers or string coupling
|
|
48
|
+
- dead code and stale comments
|
|
49
|
+
- prompt or instruction drift
|
|
50
|
+
- test gaps
|
|
51
|
+
- crypto and entropy issues
|
|
52
|
+
- time-window assumptions
|
|
53
|
+
- type coercion at boundaries
|
|
54
|
+
- view or frontend performance traps
|
|
55
|
+
|
|
56
|
+
Use `./references/checklist.md` as the canonical checklist.
|
|
57
|
+
|
|
58
|
+
## Review Output Format
|
|
59
|
+
- Strengths
|
|
60
|
+
- Critical issues
|
|
61
|
+
- Important issues
|
|
62
|
+
- Minor issues
|
|
63
|
+
- Assessment: ready / ready with fixes / not ready
|
|
64
|
+
|
|
65
|
+
Each issue should include:
|
|
66
|
+
- file reference
|
|
67
|
+
- what is wrong
|
|
68
|
+
- why it matters
|
|
69
|
+
- how to fix it
|
|
70
|
+
|
|
71
|
+
## Red Flags
|
|
72
|
+
- Requesting code-quality review before verifying the code matches the spec.
|
|
73
|
+
- Accepting review comments without checking the actual code.
|
|
74
|
+
- Ignoring a critical issue because tests happen to pass.
|
|
75
|
+
- Turning review into an unbounded refactor request.
|
|
76
|
+
|
|
77
|
+
## Integration
|
|
78
|
+
- Use after `code-execute` or `code-parallel` finishes an implementation slice.
|
|
79
|
+
- `code-ship` depends on this review gate being complete.
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
# Pre-Landing Review Checklist
|
|
2
|
-
|
|
3
|
-
## Instructions
|
|
4
|
-
|
|
5
|
-
Review the `git diff origin/main` output for the issues listed below. Be specific -- cite `file:line` and suggest fixes. Skip anything that's fine. Only flag real problems.
|
|
6
|
-
|
|
7
|
-
**Two-pass review:**
|
|
8
|
-
- **Pass 1 (CRITICAL):** Run SQL & Data Safety and LLM Output Trust Boundary first. These can block `/ship`.
|
|
9
|
-
- **Pass 2 (INFORMATIONAL):** Run all remaining categories. These are included in the PR body but do not block.
|
|
10
|
-
|
|
11
|
-
**Output format:**
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
Pre-Landing Review: N issues (X critical, Y informational)
|
|
15
|
-
|
|
16
|
-
**CRITICAL** (blocking /ship):
|
|
17
|
-
- [file:line] Problem description
|
|
18
|
-
Fix: suggested fix
|
|
19
|
-
|
|
20
|
-
**Issues** (non-blocking):
|
|
21
|
-
- [file:line] Problem description
|
|
22
|
-
Fix: suggested fix
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
If no issues found: `Pre-Landing Review: No issues found.`
|
|
26
|
-
|
|
27
|
-
Be terse. For each issue: one line describing the problem, one line with the fix. No preamble, no summaries, no "looks good overall."
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Review Categories
|
|
32
|
-
|
|
33
|
-
### Pass 1 -- CRITICAL
|
|
34
|
-
|
|
35
|
-
#### SQL & Data Safety
|
|
36
|
-
- String interpolation in SQL (even if values are `.to_i`/`.to_f` -- use `sanitize_sql_array` or Arel)
|
|
37
|
-
- TOCTOU races: check-then-set patterns that should be atomic `WHERE` + `update_all`
|
|
38
|
-
- `update_column`/`update_columns` bypassing validations on fields that have or should have constraints
|
|
39
|
-
- N+1 queries: `.includes()` missing for associations used in loops/views (especially avatar, attachments)
|
|
40
|
-
|
|
41
|
-
#### Race Conditions & Concurrency
|
|
42
|
-
- Read-check-write without uniqueness constraint or `rescue RecordNotUnique; retry` (e.g., `where(hash:).first` then `save!` without handling concurrent insert)
|
|
43
|
-
- `find_or_create_by` on columns without unique DB index -- concurrent calls can create duplicates
|
|
44
|
-
- Status transitions that don't use atomic `WHERE old_status = ? UPDATE SET new_status` -- concurrent updates can skip or double-apply transitions
|
|
45
|
-
- `html_safe` on user-controlled data (XSS) -- check any `.html_safe`, `raw()`, or string interpolation into `html_safe` output
|
|
46
|
-
|
|
47
|
-
#### LLM Output Trust Boundary
|
|
48
|
-
- LLM-generated values (emails, URLs, names) written to DB or passed to mailers without format validation. Add lightweight guards (`EMAIL_REGEXP`, `URI.parse`, `.strip`) before persisting.
|
|
49
|
-
- Structured tool output (arrays, hashes) accepted without type/shape checks before database writes.
|
|
50
|
-
|
|
51
|
-
### Pass 2 -- INFORMATIONAL
|
|
52
|
-
|
|
53
|
-
#### Conditional Side Effects
|
|
54
|
-
- Code paths that branch on a condition but forget to apply a side effect on one branch. Example: item promoted to verified but URL only attached when a secondary condition is true -- the other branch promotes without the URL, creating an inconsistent record.
|
|
55
|
-
- Log messages that claim an action happened but the action was conditionally skipped. The log should reflect what actually occurred.
|
|
56
|
-
|
|
57
|
-
#### Magic Numbers & String Coupling
|
|
58
|
-
- Bare numeric literals used in multiple files -- should be named constants documented together
|
|
59
|
-
- Error message strings used as query filters elsewhere (grep for the string -- is anything matching on it?)
|
|
60
|
-
|
|
61
|
-
#### Dead Code & Consistency
|
|
62
|
-
- Variables assigned but never read
|
|
63
|
-
- Version mismatch between PR title and VERSION/CHANGELOG files
|
|
64
|
-
- CHANGELOG entries that describe changes inaccurately (e.g., "changed from X to Y" when X never existed)
|
|
65
|
-
- Comments/docstrings that describe old behavior after the code changed
|
|
66
|
-
|
|
67
|
-
#### LLM Prompt Issues
|
|
68
|
-
- 0-indexed lists in prompts (LLMs reliably return 1-indexed)
|
|
69
|
-
- Prompt text listing available tools/capabilities that don't match what's actually wired up in the `tool_classes`/`tools` array
|
|
70
|
-
- Word/token limits stated in multiple places that could drift
|
|
71
|
-
|
|
72
|
-
#### Test Gaps
|
|
73
|
-
- Negative-path tests that assert type/status but not the side effects (URL attached? field populated? callback fired?)
|
|
74
|
-
- Assertions on string content without checking format (e.g., asserting title present but not URL format)
|
|
75
|
-
- `.expects(:something).never` missing when a code path should explicitly NOT call an external service
|
|
76
|
-
- Security enforcement features (blocking, rate limiting, auth) without integration tests verifying the enforcement path works end-to-end
|
|
77
|
-
|
|
78
|
-
#### Crypto & Entropy
|
|
79
|
-
- Truncation of data instead of hashing (last N chars instead of SHA-256) -- less entropy, easier collisions
|
|
80
|
-
- `rand()` / `Random.rand` for security-sensitive values -- use `SecureRandom` instead
|
|
81
|
-
- Non-constant-time comparisons (`==`) on secrets or tokens -- vulnerable to timing attacks
|
|
82
|
-
|
|
83
|
-
#### Time Window Safety
|
|
84
|
-
- Date-key lookups that assume "today" covers 24h -- report at 8am PT only sees midnight->8am under today's key
|
|
85
|
-
- Mismatched time windows between related features -- one uses hourly buckets, another uses daily keys for the same data
|
|
86
|
-
|
|
87
|
-
#### Type Coercion at Boundaries
|
|
88
|
-
- Values crossing Ruby->JSON->JS boundaries where type could change (numeric vs string) -- hash/digest inputs must normalize types
|
|
89
|
-
- Hash/digest inputs that don't call `.to_s` or equivalent before serialization -- `{ cores: 8 }` vs `{ cores: "8" }` produce different hashes
|
|
90
|
-
|
|
91
|
-
#### View/Frontend
|
|
92
|
-
- Inline `<style>` blocks in partials (re-parsed every render)
|
|
93
|
-
- O(n*m) lookups in views (`Array#find` in a loop instead of `index_by` hash)
|
|
94
|
-
- Ruby-side `.select{}` filtering on DB results that could be a `WHERE` clause (unless intentionally avoiding leading-wildcard `LIKE`)
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Gate Classification
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
CRITICAL (blocks /ship): INFORMATIONAL (in PR body):
|
|
102
|
-
SQL & Data Safety Conditional Side Effects
|
|
103
|
-
Race Conditions & Concurrency Magic Numbers & String Coupling
|
|
104
|
-
LLM Output Trust Boundary Dead Code & Consistency
|
|
105
|
-
LLM Prompt Issues
|
|
106
|
-
Test Gaps
|
|
107
|
-
Crypto & Entropy
|
|
108
|
-
Time Window Safety
|
|
109
|
-
Type Coercion at Boundaries
|
|
110
|
-
View/Frontend
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Suppressions -- DO NOT flag these
|
|
116
|
-
|
|
117
|
-
- "X is redundant with Y" when the redundancy is harmless and aids readability (e.g., `present?` redundant with `length > 20`)
|
|
118
|
-
- "Add a comment explaining why this threshold/constant was chosen" -- thresholds change during tuning, comments rot
|
|
119
|
-
- "This assertion could be tighter" when the assertion already covers the behavior
|
|
120
|
-
- Suggesting consistency-only changes (wrapping a value in a conditional to match how another constant is guarded)
|
|
121
|
-
- "Regex doesn't handle edge case X" when the input is constrained and X never occurs in practice
|
|
122
|
-
- "Test exercises multiple guards simultaneously" -- that's fine, tests don't need to isolate every guard
|
|
123
|
-
- Eval threshold changes (max_actionable, min scores) -- these are tuned empirically and change constantly
|
|
124
|
-
- Harmless no-ops (e.g., `.reject` on an element that's never in the array)
|
|
125
|
-
- ANYTHING already addressed in the diff you're reviewing -- read the FULL diff before commenting
|
|
1
|
+
# Pre-Landing Review Checklist
|
|
2
|
+
|
|
3
|
+
## Instructions
|
|
4
|
+
|
|
5
|
+
Review the `git diff origin/main` output for the issues listed below. Be specific -- cite `file:line` and suggest fixes. Skip anything that's fine. Only flag real problems.
|
|
6
|
+
|
|
7
|
+
**Two-pass review:**
|
|
8
|
+
- **Pass 1 (CRITICAL):** Run SQL & Data Safety and LLM Output Trust Boundary first. These can block `/ship`.
|
|
9
|
+
- **Pass 2 (INFORMATIONAL):** Run all remaining categories. These are included in the PR body but do not block.
|
|
10
|
+
|
|
11
|
+
**Output format:**
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Pre-Landing Review: N issues (X critical, Y informational)
|
|
15
|
+
|
|
16
|
+
**CRITICAL** (blocking /ship):
|
|
17
|
+
- [file:line] Problem description
|
|
18
|
+
Fix: suggested fix
|
|
19
|
+
|
|
20
|
+
**Issues** (non-blocking):
|
|
21
|
+
- [file:line] Problem description
|
|
22
|
+
Fix: suggested fix
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If no issues found: `Pre-Landing Review: No issues found.`
|
|
26
|
+
|
|
27
|
+
Be terse. For each issue: one line describing the problem, one line with the fix. No preamble, no summaries, no "looks good overall."
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Review Categories
|
|
32
|
+
|
|
33
|
+
### Pass 1 -- CRITICAL
|
|
34
|
+
|
|
35
|
+
#### SQL & Data Safety
|
|
36
|
+
- String interpolation in SQL (even if values are `.to_i`/`.to_f` -- use `sanitize_sql_array` or Arel)
|
|
37
|
+
- TOCTOU races: check-then-set patterns that should be atomic `WHERE` + `update_all`
|
|
38
|
+
- `update_column`/`update_columns` bypassing validations on fields that have or should have constraints
|
|
39
|
+
- N+1 queries: `.includes()` missing for associations used in loops/views (especially avatar, attachments)
|
|
40
|
+
|
|
41
|
+
#### Race Conditions & Concurrency
|
|
42
|
+
- Read-check-write without uniqueness constraint or `rescue RecordNotUnique; retry` (e.g., `where(hash:).first` then `save!` without handling concurrent insert)
|
|
43
|
+
- `find_or_create_by` on columns without unique DB index -- concurrent calls can create duplicates
|
|
44
|
+
- Status transitions that don't use atomic `WHERE old_status = ? UPDATE SET new_status` -- concurrent updates can skip or double-apply transitions
|
|
45
|
+
- `html_safe` on user-controlled data (XSS) -- check any `.html_safe`, `raw()`, or string interpolation into `html_safe` output
|
|
46
|
+
|
|
47
|
+
#### LLM Output Trust Boundary
|
|
48
|
+
- LLM-generated values (emails, URLs, names) written to DB or passed to mailers without format validation. Add lightweight guards (`EMAIL_REGEXP`, `URI.parse`, `.strip`) before persisting.
|
|
49
|
+
- Structured tool output (arrays, hashes) accepted without type/shape checks before database writes.
|
|
50
|
+
|
|
51
|
+
### Pass 2 -- INFORMATIONAL
|
|
52
|
+
|
|
53
|
+
#### Conditional Side Effects
|
|
54
|
+
- Code paths that branch on a condition but forget to apply a side effect on one branch. Example: item promoted to verified but URL only attached when a secondary condition is true -- the other branch promotes without the URL, creating an inconsistent record.
|
|
55
|
+
- Log messages that claim an action happened but the action was conditionally skipped. The log should reflect what actually occurred.
|
|
56
|
+
|
|
57
|
+
#### Magic Numbers & String Coupling
|
|
58
|
+
- Bare numeric literals used in multiple files -- should be named constants documented together
|
|
59
|
+
- Error message strings used as query filters elsewhere (grep for the string -- is anything matching on it?)
|
|
60
|
+
|
|
61
|
+
#### Dead Code & Consistency
|
|
62
|
+
- Variables assigned but never read
|
|
63
|
+
- Version mismatch between PR title and VERSION/CHANGELOG files
|
|
64
|
+
- CHANGELOG entries that describe changes inaccurately (e.g., "changed from X to Y" when X never existed)
|
|
65
|
+
- Comments/docstrings that describe old behavior after the code changed
|
|
66
|
+
|
|
67
|
+
#### LLM Prompt Issues
|
|
68
|
+
- 0-indexed lists in prompts (LLMs reliably return 1-indexed)
|
|
69
|
+
- Prompt text listing available tools/capabilities that don't match what's actually wired up in the `tool_classes`/`tools` array
|
|
70
|
+
- Word/token limits stated in multiple places that could drift
|
|
71
|
+
|
|
72
|
+
#### Test Gaps
|
|
73
|
+
- Negative-path tests that assert type/status but not the side effects (URL attached? field populated? callback fired?)
|
|
74
|
+
- Assertions on string content without checking format (e.g., asserting title present but not URL format)
|
|
75
|
+
- `.expects(:something).never` missing when a code path should explicitly NOT call an external service
|
|
76
|
+
- Security enforcement features (blocking, rate limiting, auth) without integration tests verifying the enforcement path works end-to-end
|
|
77
|
+
|
|
78
|
+
#### Crypto & Entropy
|
|
79
|
+
- Truncation of data instead of hashing (last N chars instead of SHA-256) -- less entropy, easier collisions
|
|
80
|
+
- `rand()` / `Random.rand` for security-sensitive values -- use `SecureRandom` instead
|
|
81
|
+
- Non-constant-time comparisons (`==`) on secrets or tokens -- vulnerable to timing attacks
|
|
82
|
+
|
|
83
|
+
#### Time Window Safety
|
|
84
|
+
- Date-key lookups that assume "today" covers 24h -- report at 8am PT only sees midnight->8am under today's key
|
|
85
|
+
- Mismatched time windows between related features -- one uses hourly buckets, another uses daily keys for the same data
|
|
86
|
+
|
|
87
|
+
#### Type Coercion at Boundaries
|
|
88
|
+
- Values crossing Ruby->JSON->JS boundaries where type could change (numeric vs string) -- hash/digest inputs must normalize types
|
|
89
|
+
- Hash/digest inputs that don't call `.to_s` or equivalent before serialization -- `{ cores: 8 }` vs `{ cores: "8" }` produce different hashes
|
|
90
|
+
|
|
91
|
+
#### View/Frontend
|
|
92
|
+
- Inline `<style>` blocks in partials (re-parsed every render)
|
|
93
|
+
- O(n*m) lookups in views (`Array#find` in a loop instead of `index_by` hash)
|
|
94
|
+
- Ruby-side `.select{}` filtering on DB results that could be a `WHERE` clause (unless intentionally avoiding leading-wildcard `LIKE`)
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Gate Classification
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
CRITICAL (blocks /ship): INFORMATIONAL (in PR body):
|
|
102
|
+
SQL & Data Safety Conditional Side Effects
|
|
103
|
+
Race Conditions & Concurrency Magic Numbers & String Coupling
|
|
104
|
+
LLM Output Trust Boundary Dead Code & Consistency
|
|
105
|
+
LLM Prompt Issues
|
|
106
|
+
Test Gaps
|
|
107
|
+
Crypto & Entropy
|
|
108
|
+
Time Window Safety
|
|
109
|
+
Type Coercion at Boundaries
|
|
110
|
+
View/Frontend
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Suppressions -- DO NOT flag these
|
|
116
|
+
|
|
117
|
+
- "X is redundant with Y" when the redundancy is harmless and aids readability (e.g., `present?` redundant with `length > 20`)
|
|
118
|
+
- "Add a comment explaining why this threshold/constant was chosen" -- thresholds change during tuning, comments rot
|
|
119
|
+
- "This assertion could be tighter" when the assertion already covers the behavior
|
|
120
|
+
- Suggesting consistency-only changes (wrapping a value in a conditional to match how another constant is guarded)
|
|
121
|
+
- "Regex doesn't handle edge case X" when the input is constrained and X never occurs in practice
|
|
122
|
+
- "Test exercises multiple guards simultaneously" -- that's fine, tests don't need to isolate every guard
|
|
123
|
+
- Eval threshold changes (max_actionable, min scores) -- these are tuned empirically and change constantly
|
|
124
|
+
- Harmless no-ops (e.g., `.reject` on an element that's never in the array)
|
|
125
|
+
- ANYTHING already addressed in the diff you're reviewing -- read the FULL diff before commenting
|