docs(folders): correct four comments that claimed more than the code does - #6063
Conversation
…does A comment pass over this branch found four factual errors, all mine: - the admin route test justified its column-pinned assertion with reasoning copied from lifecycle.test.ts — that condition has no second isNull node, so the stated vacuity could not occur there - 'every clause mirrors one column of the partial unique index' was wrong: deletedAt is the index PREDICATE, and name has no clause at all - 'optimistic client reparents can write a cycle' is unsupported — wouldCreateFolderCycle has one caller and no write path bypasses it; the real origin is two concurrent reparents each passing the check - 'restoreFolder runs restoreChildren BEFORE un-archiving' holds only for the injected hook path; the in-transaction fallback runs after restoreFolderRows The rest trims comments that restated the code or duplicated a TSDoc block on the module under test, and pins three presence-only isNull assertions to the deletedAt column so they cannot be satisfied by an unrelated nullable filter — the same fragility that made an earlier assertion here vacuous.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cursor review |
PR SummaryLow Risk Overview Comments are corrected where they overstated guarantees: admin folder list rationale is shortened; Tests now pin Reviewed by Cursor Bugbot for commit dd27264. Configure here. |
Greptile SummaryComment-accuracy and test-hardening follow-up with no product behavior change.
Confidence Score: 5/5Safe to merge; only comments and stronger test assertions change, with no runtime product logic edits. Diff is limited to documentation wording and test expectation pinning; no behavioral paths, contracts, or security boundaries are altered.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/v1/admin/workspaces/[id]/folders/route.test.ts | Rewords the soft-delete assertion rationale and keeps the column-pinned deletedAt check. |
| apps/sim/app/api/v1/admin/workspaces/[id]/folders/route.ts | Shortens the soft-delete filter comment without changing the query. |
| apps/sim/lib/folders/lifecycle.test.ts | Moves/clarifies sortOrder filter comments; retains column-pinned soft-delete assertion. |
| apps/sim/lib/folders/lifecycle.ts | Tightens the soft-delete minima comment only. |
| apps/sim/lib/folders/naming.test.ts | Fixes partial-index comment accuracy and notes dual isNull nodes in sibling scoping. |
| apps/sim/lib/folders/queries.test.ts | Pins soft-delete assertions to deletedAt, corrects cycle/restore comments, drops restating toFolderApi block. |
Reviews (1): Last reviewed commit: "docs(folders): correct four comments tha..." | Re-trigger Greptile
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit dd27264. Configure here.
Follow-up to #6062, which merged before these landed. A comment-accuracy pass over that branch found four factual errors — all mine, all introduced in #6062 — plus some comments that restated the code.
This matters beyond tidiness: in the folder migration work, comments asserting more than the code delivered were the single most recurring defect. A comment that documents a guarantee the code does not provide is worse than no comment, because the next reader trusts it.
The four inaccuracies
1. Reasoning copied to a place it doesn't apply.
route.test.tsjustified its column-pinned assertion with "resourceType/workspaceIdare eq nodes, so a bare 'some isNull exists' check could pass on an unrelated clause." That reasoning is true inlifecycle.test.ts— where a root folder'sisNull(parentId)genuinely makes a presence-only check vacuous — but this route's condition has no secondisNullnode, so the stated failure cannot occur. Replaced with the reason that is actually true here (future-proofing against a nullable filter being added).2. "Every clause mirrors one column of the partial unique index" — wrong on two counts:
deletedAtis the index predicate, not an indexed column, andnameis an indexed column with no clause (it's filtered in JS).3. "Optimistic client reparents can write one" (about a pre-existing folder cycle) — unsupported.
wouldCreateFolderCyclehas exactly one caller and no write path bypasses it, so a client reparent cannot land a cycle. The realistic origin is two concurrent reparents each passing the check independently.4. "
restoreFolderruns itsrestoreChildrenhook BEFORE un-archiving the folder rows" — true only for the injected hook path. The in-transaction fallbackrestoreFolderChildrenruns afterrestoreFolderRows, so the claim covered one of two paths.Also
Trims comments that restated the code or duplicated a TSDoc block on the module under test (the admin route's rationale lives in the route;
toFolderApi's lives inqueries.ts), and drops two lines of narration about this work's own history.Pins three presence-only
isNullassertions to thedeletedAtcolumn. They were not vacuous today — each of those conditions happens to contain only oneisNull— but that is incidental, and it is exactly the fragility that already made one assertion in this suite vacuous. Mutation-checked: droppingisNull(folder.deletedAt)fromfindActiveFoldernow fails the test, which it would not have before.Testing
Typecheck,
lint:check(23/23),check:api-validation, and 107 tests pass. No behavioural change to product code — the only non-comment edits are test assertions being tightened.Type of Change
Checklist