Repository navigation
Flag effects that write reactive state through a same-file helper - #4412
Conversation
|
APPROVE at ff10e2d Independent review at that exact head, in my own worktree. The 4 new flags are correct and the cap of 15 matches the rule as written. I found should-fix items below, but none is a blocker for this PR. Verified by reading the effect body and the helper (all 4 flags are true and accurately worded)
Header and AGENTS.md text: both match the code. The same-file-helper wording is true for the 4 flags. The "imported module or callback prop is not detected" caveat is stated honestly. Only scripts/AGENTS.md changed (3 files: AGENTS.md, the checker, its test). No effect was removed or rewritten, and no packages/ files changed. What I ran
Findings
Conclusion: the PR does what it says and the numbers are right under its rule. I treated the imperfect count as non-blocking because the limitation is stated in the header and AGENTS.md. Items 1 and 2 are worth a small follow-up, either by flagging those effects or by tightening the wording. 🤖 Generated with Claude Code |
…the effect allowlist Four allowlisted effects assign $state through a helper they call (closeAdd, resetTransient/load, resetToDefaults, loadViewerForNodeType) but were not marked writesState. Mark them and raise MAX_STATE_WRITING_EFFECTS from 11 to 15 to the true count. The checker header and AGENTS.md now say the flag covers direct and same-file-helper writes and that imported modules and callback props rely on review. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
ff10e2d to
6d4b2ed
Compare
What
Four allowlisted effects assign reactive state through a same-file helper but were not flagged
writesState, so MAX_STATE_WRITING_EFFECTS (11) understated the debt. They are now flagged and the cap is 15. No effect is removed or rewritten (removal stays tracked in c6cb44c4).Newly flagged (each read in source):
closeAdd: assigns addGroupKey, addQuery, addResults, addSearching, addAllLinked, addStaged, addEdgeDraft (all$state).resetTransientandload: resetTransient assigns edgeDrafts, selectedKey, expandedRows, add* fields, mutationError; load synchronously assigns phase, view, errorMessage before its first await.resetToDefaults: assigns modalState, phase, progress, result, errorMessage.loadViewerForNodeType(insideuntrack), which setsviewerLoading($state) before its first await and viewerComponents/viewerLoadErrors when it settles. The olddrivestext said "both write the pane's viewer maps when they settle"; corrected.The checker header and AGENTS.md now say the flag covers direct assignment and assignment through a same-file helper, and that state written through imported modules or callback props is not detected and relies on review.
Not flagged (judgement, for the reviewer)
listencallback sets$statesessionEnded, but only later in an async event, not when the effect runs.relationships.load) and app-shell.svelte (conflictsStore.load,seedUpdatesStore.load) call imported modules; not detectable by this rule and not verified here (their state classes were not read).dismissruns in a timeout.Verification
bun scripts/check-effect-allowlist.ts: passbun test scripts/: 1729 pass, 0 failbun run quality:scripts:check: pass> MAX + 1fails the existing cap test and the new helper-cap test.🤖 Generated with Claude Code