Skip to content

refactor(comments): name what exists on the registration path - #812

Merged
sydevs-bot merged 4 commits into
mainfrom
claude/refactor-809-stale-registration-comments
Sep 18, 2026
Merged

sydevs-bot merged 4 commits into
mainfrom
claude/refactor-809-stale-registration-comments

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

  • plugins/access/documentManagers.ts — the ⚠ memo block carried two errors. The named file is gone, and the claim needed re-deriving: verifyEventAction.ts:36 is the only overrideAccess: false write left in src/; the other ten call sites are reads, gateRegistration.ts:53 included. So the staleness window is narrower than the comment said. Both hazards kept in full — this JSDoc is a named carve-out in docs/rules/code-comments.md.
  • Events/hooks/excludeFinishedEvents.ts — the trusted-req exemption now names gateRegistration's forwarded read on POST /api/user-submissions. Still load-bearing; gateRegistration.ts:43-47 says so from the other side.
  • Events/Events.ts, lib/schedule/scheduleStatus.ts — the gate, not the endpoint. event_ended / 409 still comes from lib/registrations/gating.ts:50.
  • plugins/writeGuard/writeGuardPlugin.ts — the guarded forwarded write is prepareUserSubmission's users upsert, which policies.ts:32 independently documents.
  • jobs/DeliverSubmissions/deliverRegistration.ts — the "re-points in Phase 3" sentence goes. deliverers.ts:34 routes every registration row here. The past-tense registerForEvent history at :20 stays.
  • lib/registrations/questions.ts, lib/eventVerification/communityFeedback.ts, fields/systemMetaField.ts — Registrations → UserSubmissions. Neither stale Registrations.questions citation was re-pointed; both went. The only live jsonSchema instance is communityFeedbackJsonSchema, and Events.ts:743 passes it into systemMetaField as that helper's one namespace — the namespace its own docblock already uses as its example. So a pointer from systemMetaField names nothing new, and one from communityFeedback would point at itself. What survives is the single informative direction: communityFeedback.ts:15 names systemMetaField as 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 the Registrations collection 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 a user-submissions row now.
  • Events.ts:616 — confidenceScore's writer is UserSubmissions/hooks/eventFeedback.ts:134.
  • Events.ts:710 — registrationsFull is maintained by UserSubmissions/hooks/syncFullness.ts, on afterChange and afterDelete.
  • fields/legacyFields.ts:4 — wrong twice over. Five collections spread legacyMigrationFields() (Clients, Events, Managers, Regions, Users), never the four it listed.

Review round 1 — adversarial review of 7dc840c

Both should-fix findings adopted, one commit each, both threads resolved.

The review's two body-accounting errors are corrected above. The unlisted-sites count was four, not three — Events.ts:112 was 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

  • Lean gate: ✓ — lint, tsc (src + tests), 2123 unit tests in 153 files. Re-run on c333375.
  • Targeted specs: none. No behaviour changed, so no integration spec can distinguish this branch from 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

  1. Read plugins/access/documentManagers.ts:238-243. The narrowed claim is the one judgement call here worth a second pair of eyes — confirm against grep -rn "overrideAccess: *false" src/ that verifyEventAction.ts:36 is 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:36 is the write (it passes overrideAccess: false into applyVerification) 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 registrationQuestionsJsonSchema or 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 the Registrations word. Leaving "four ... (Events, Users, Regions)" — a count of four naming three — read worse than fixing it.

/simplify was 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-review ran (the src/plugins/access/ trigger matched) and reported no findings, on the same basis.

Detail

Why specFilter.ts has no example. The ticket ruled out both candidates and I confirmed each:

  • /api/events/{id}/verify is real (verifyEventAction.ts:15) but absent from CUSTOM_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, and customEndpoints.ts:373-380 marks it x-internal because clients is in ALWAYS_HIDDEN_COLLECTIONS. Documented but not visible — it contradicts the half of the sentence the example existed to illustrate.

ALLOW_POST_FOR is ['user-submissions'] (specFilter.ts:67), a base path, so it is not the example either. The replacement states what the branch actually does: isBaseCollectionPath is /^\/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 against main), the atlas view-route segments in customEndpoints.ts:441,465, and the past-tense history in fields/logField.ts:13,134, writeGuard/policies.ts:37 and deliverRegistration.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-103 on main carries raw <<<<<<< HEAD / ======= / >>>>>>> origin/main markers, landed by 0e83f6a6 (#801). It is a rule file that loads into every session touching src/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

#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
@railway-app

railway-app Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-812 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 17, 2026 at 5:12 pm UTC
1 service not affected by this PR
  • mailpit

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-812 September 17, 2026 16:42 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 17, 2026
@sydevs-bot

sydevs-bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 17:02Z address-review · attempt 1 · session · done
  • 17:02Z address-review · attempt 1 · session
  • 16:55Z adversarial-review · attempt 1 · session · done
  • 16:55Z adversarial-review · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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, which docs/rules/code-comments.md bans.

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

Comment thread src/fields/systemMetaField.ts Resolved
Comment thread src/lib/registrations/questions.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 17, 2026
`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
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-812 September 17, 2026 17:07 Destroyed
`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
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-812 September 17, 2026 17:09 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both should-fix findings adopted, both threads resolved. Head is c333375.

One consequence the review did not raise: c333375 drops communityFeedback.ts:15's "and points here", which named the citation 9304e41 had just removed.

Both body-accounting errors corrected. Four unlisted sites, not three — Events.ts:112 was missing. The manual check's grep prints 21 lines over 11 call sites, 10 of them reads, not "six hits".

Lean gate ✓ on c333375. Fingerprint still 11/11 codeHash-identical, 0 problems.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 17, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 17, 2026 17:22
@sydevs-bot
sydevs-bot requested a review from Ardnived September 17, 2026 17:22
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit 5c835b4 Sep 18, 2026
17 checks passed
@sydevs-bot
sydevs-bot deleted the claude/refactor-809-stale-registration-comments branch September 18, 2026 00:40
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 18, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-812 — c3333752 Deployed Sep 17, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

refactor(comments): ten files carry comments the #801 cutover invalidated

3 participants