Repository navigation
refactor(comments): name what exists on the registration path - #812
Conversation
#801 deleted `POST /api/events/{id}/register` and the `Registrations` collection. Eleven files still described both as live. Comment-only — the `git diff` moves no line of executable code. Family A, the deleted endpoint. Each now names the surviving caller, so a reader can open it: - `excludeFinishedEvents.ts` — the trusted-req exemption is `gateRegistration`'s forwarded read on `POST /api/user-submissions`. Still load-bearing: `gateRegistration.ts:43-47` says so from the other side. - `Events.ts`, `scheduleStatus.ts` — the gate, not the endpoint. `event_ended` and its 409 still come from `lib/registrations/gating.ts:50`. - `writeGuardPlugin.ts` — the guarded forwarded write is `prepareUserSubmission`'s `users` upsert, which `policies.ts:32` also names. - `deliverRegistration.ts` — the "re-points in Phase 3" sentence goes; Phase 3 landed, and `deliverers.ts:34` routes every registration row here. The past-tense `registerForEvent` history above it stays. `documentManagers.ts` carried two errors in one `⚠` memo block, not one. The file was gone, and the claim needed re-deriving: `verifyEventAction.ts:36` is the only `overrideAccess: false` **write** left in `src/` — the other five call sites are reads, `gateRegistration.ts:53` included — so the staleness window is narrower than the comment said. Both hazards kept in full. Family B, the deleted collection. `questions.ts`, `communityFeedback.ts` and `systemMetaField.ts` named `Registrations`; `Events.ts:616,710` and `legacyFields.ts:4` did too and were not in the ticket's table. `legacyFields.ts` was wrong twice over — five collections carry these fields (Clients, Events, Managers, Regions, Users), never the four it listed. Two comments cited `Registrations.questions` as the reference example of validate-on-write-via-`jsonSchema`. That example has no live instance: `registrationQuestionsJsonSchema` lost its only consumer in #801. Both now point at `communityFeedbackJsonSchema`, which is one, and the dead export carries a note saying it is unwired. Deleting it moves executable code, which this ticket ruled out — #811 decides it. `specFilter.ts:431` states the rule with no example, as the ticket asked. Neither candidate works: `/api/events/{id}/verify` is absent from `CUSTOM_ENDPOINT_PATHS`, and `/api/clients/report` is marked `x-internal`, so each contradicts one half of the sentence. Closes #809 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MNU1pAZY6ukEbmd2koj1zC
|
🚅 Deployed to the SahajCloud-pr-812 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Scope matches the ticket. I re-derived all eleven claims from the code rather than trust the fingerprint, and they hold — the two judgement calls included.
Two comments do not survive their own re-point, this PR's whole product.
The body's accounting is off twice. "Three sites the ticket's table did not list" misses Events.ts:113. The manual check names "six hits"; that grep prints 21 lines over 11 call sites, 10 of them reads. The claim is right, so the check will look failed when it passed.
Findings
- should-fix —
fields/systemMetaField.ts:23: the new pointer cites the schema this field carries. - should-fix —
lib/registrations/questions.ts:45: narrates the change, whichdocs/rules/code-comments.mdbans.
Checked: 7dc840c vs main 07e3e40. Read: questions.ts, communityFeedback.ts, systemMetaField.ts, documentManagers.ts. Consumers: Events.ts:743, formBuilder/index.ts:114-222. Greps: the ticket's three, plus legacyMigrationFields, registrationQuestionsJsonSchema (unused, as claimed).
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`Events.ts:743` passes `communityFeedbackJsonSchema` in as this helper's one namespace, and the docblock above already uses that namespace as its example. The pointer named no second instance, and `communityFeedback.ts:15` points back here — so the two files cited only each other. The surviving direction, specific to general, is the useful one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011JrquZ3M6mxws5KZXJkBbq
"kept only because #809 was comment-only" reads only to someone who saw that diff, which `docs/rules/code-comments.md` bans. "Unwired since #801" and "#811 decides whether this goes" carry the substance to a fresh reader. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011JrquZ3M6mxws5KZXJkBbq
`systemMetaField`'s pointer here went in `9304e41`, so "and points here" now names a citation that does not exist. The generalization claim is the half that was load-bearing, and it stands on its own. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011JrquZ3M6mxws5KZXJkBbq
|
Both should-fix findings adopted, both threads resolved. Head is
One consequence the review did not raise: Both body-accounting errors corrected. Four unlisted sites, not three — Lean gate ✓ on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
POST /api/events/{id}/registerand theRegistrationscollection as live. feat(api)!: unified intake, phase 3 — cutover, and delete the three old collections #801 deleted both. Each comment now names the surviving caller.comment-fingerprint.mjsreports 11 of 11 files codeHash-identical, no comment displaced.main) and refactor(registrations): delete the unwired registrationQuestionsJsonSchema #811 (the dead export this ticket could not delete).Changes
plugins/access/documentManagers.ts— the⚠memo block carried two errors. The named file is gone, and the claim needed re-deriving:verifyEventAction.ts:36is the onlyoverrideAccess: falsewrite left insrc/; the other ten call sites are reads,gateRegistration.ts:53included. So the staleness window is narrower than the comment said. Both hazards kept in full — this JSDoc is a named carve-out indocs/rules/code-comments.md.Events/hooks/excludeFinishedEvents.ts— the trusted-req exemption now namesgateRegistration's forwarded read onPOST /api/user-submissions. Still load-bearing;gateRegistration.ts:43-47says so from the other side.Events/Events.ts,lib/schedule/scheduleStatus.ts— the gate, not the endpoint.event_ended/ 409 still comes fromlib/registrations/gating.ts:50.plugins/writeGuard/writeGuardPlugin.ts— the guarded forwarded write isprepareUserSubmission'susersupsert, whichpolicies.ts:32independently documents.jobs/DeliverSubmissions/deliverRegistration.ts— the "re-points in Phase 3" sentence goes.deliverers.ts:34routes every registration row here. The past-tenseregisterForEventhistory at:20stays.lib/registrations/questions.ts,lib/eventVerification/communityFeedback.ts,fields/systemMetaField.ts—Registrations→UserSubmissions. Neither staleRegistrations.questionscitation was re-pointed; both went. The only livejsonSchemainstance iscommunityFeedbackJsonSchema, andEvents.ts:743passes it intosystemMetaFieldas that helper's one namespace — the namespace its own docblock already uses as its example. So a pointer fromsystemMetaFieldnames nothing new, and one fromcommunityFeedbackwould point at itself. What survives is the single informative direction:communityFeedback.ts:15namessystemMetaFieldas the generalization. See review round 1 below.plugins/openapi/specFilter.ts— states the rule with no example, as the ticket asked.Four sites the ticket's table did not list, all inside AC1's "no comment in
src/presents theRegistrationscollection as something that currently exists":Events.ts:112—defaultPopulate's note named "a Registration" as a thing that hydrates an Event through a relationship. A registration row is auser-submissionsrow now.Events.ts:616—confidenceScore's writer isUserSubmissions/hooks/eventFeedback.ts:134.Events.ts:710—registrationsFullis maintained byUserSubmissions/hooks/syncFullness.ts, on afterChange and afterDelete.fields/legacyFields.ts:4— wrong twice over. Five collections spreadlegacyMigrationFields()(Clients, Events, Managers, Regions, Users), never the four it listed.Review round 1 — adversarial review of
7dc840cBoth should-fix findings adopted, one commit each, both threads resolved.
9304e41—systemMetaField.ts:23's new pointer cited the very schema this field carries, so it named no second instance. Cut.c085bf8—questions.ts:45read "kept only because refactor(comments): ten files carry comments the #801 cutover invalidated #809 was comment-only", which narrates the change and reads only to someone who saw this diff. Now⚠ **Unwired since #801.**; "refactor(registrations): delete the unwired registrationQuestionsJsonSchema #811 decides whether this goes" already carried the rest.c333375— a consequence the review did not raise. WithsystemMetaField's pointer gone,communityFeedback.ts:15's "systemMetaFieldgeneralizes this, and points here" named a citation that no longer existed. The generalization claim was the load-bearing half and stands alone.The review's two body-accounting errors are corrected above. The unlisted-sites count was four, not three —
Events.ts:112was missing. And the manual check below said "six hits" where that grep prints 21 lines.Preview
Nothing renders. The diff moves no executable line, so no Railway page differs from
main— the review is the diff itself.Test results
tsc(src + tests), 2123 unit tests in 153 files. Re-run onc333375.main.comment-lint.mjs --base origin/main: ✓ — 11 files, no banned comment added.comment-fingerprint.mjs --base origin/main: ✓ — 11/11 codeHash identical, 0 problems, protected counts held or grew (K1 2→3, K3 7→8, K4 6→9). Unchanged by all three review-round commits.Manual verification
plugins/access/documentManagers.ts:238-243. The narrowed claim is the one judgement call here worth a second pair of eyes — confirm againstgrep -rn "overrideAccess: *false" src/thatverifyEventAction.ts:36is the only write. That grep prints 21 lines across 10 files. Eleven are call sites; the other ten lines are prose naming the option. Of the eleven,verifyEventAction.ts:36is the write (it passesoverrideAccess: falseintoapplyVerification) and the remaining ten are reads.Notes for reviewer
The open question is answered, and the answer was forced. The ticket asked whether to delete
registrationQuestionsJsonSchemaor keep it. Deleting it moves executable code, which the comment-only guarantee in the acceptance criteria rules out — so this PR keeps it, drops the two stale citations rather than re-pointing them, and leaves a⚠note on the export saying it is unwired. #811 carries the deletion. If you would rather it went in one PR, say so and I will fold #811 in — the comment-only guarantee is the only thing stopping it.One judgement call left, easy to revert:
legacyFields.ts's whole list was corrected, not just theRegistrationsword. Leaving "four ... (Events, Users, Regions)" — a count of four naming three — read worse than fixing it./simplifywas skipped: the fingerprint proves zero executable lines changed, so its four lenses have no subject, and its edits would risk the exact comment wording the ticket specifies./security-reviewran (thesrc/plugins/access/trigger matched) and reported no findings, on the same basis.Detail
Why
specFilter.tshas no example. The ticket ruled out both candidates and I confirmed each:/api/events/{id}/verifyis real (verifyEventAction.ts:15) but absent fromCUSTOM_ENDPOINT_PATHS, so it is not in the spec at all — naming it would restate the same error in a new place./api/clients/report(customEndpoints.ts:381) is the only hand-authored custom POST subpath in the spec, andcustomEndpoints.ts:373-380marks itx-internalbecauseclientsis inALWAYS_HIDDEN_COLLECTIONS. Documented but not visible — it contradicts the half of the sentence the example existed to illustrate.ALLOW_POST_FORis['user-submissions'](specFilter.ts:67), a base path, so it is not the example either. The replacement states what the branch actually does:isBaseCollectionPathis/^\/api\/[^/]+$/, false for any subpath, so the branch can never mark one.Out of scope, untouched, as the ticket requires:
Events/endpoints/responseTypes.ts(#801 already rewrote its header and:57— the earlier "stale" claim does not hold againstmain), the atlas view-route segments incustomEndpoints.ts:441,465, and the past-tense history infields/logField.ts:13,134,writeGuard/policies.ts:37anddeliverRegistration.ts:20.What the verification greps return now.
grep -rn "events/register\|events/{id}/register" src/→ nothing.grep -rni "register endpoint\|registration endpoint\|registerForEvent" src/→ two hits, both past tense (deliverRegistration.ts:20,responseTypes.ts:57).grep -rn "Registrations\." src/ --include=*.ts | grep -v payload-types→ one hit,questions.ts:45, past tense inside the unwired-export note.The Ajv note was kept, in past tense. The old JSDoc carried "the old comments warning it breaks under Cloudflare Workers predate the migration off Workers" — a real why guarding against someone re-adding that warning. Dropping it with the rest of the stale paragraph would have lost it, so it survives as an imperative that reads correctly whether or not the schema is ever re-wired.
#810 is not fixed here.
docs/rules/access.md:95-103onmaincarries raw<<<<<<< HEAD/=======/>>>>>>> origin/mainmarkers, landed by0e83f6a6(#801). It is a rule file that loads into every session touchingsrc/plugins/access/, so both contradictory halves are in context at once. Out of this ticket's scope (comment-only,src/), and filed rather than folded in. Worth a cheap grep guard in whatever fixes it — nothing in the repo looks for conflict markers, so the next one lands the same way.Closes #809
🤖 Written by the sydevs autonomous loop — see what this is
🤖 Generated with Claude Code
https://claude.ai/code/session_011JrquZ3M6mxws5KZXJkBbq