Repository navigation
List the commitment fields participants can see, not the ones they can't - #468
Conversation
Participant responses (sign up, view, edit, move) used to be the whole commitments row minus the two hashes, removed by name. A column added to commitments later would have gone out to participants unless someone remembered that list. They are now built from PUBLIC_COMMITMENT_FIELDS, which holds exactly the fields they carry today, so nothing in any response changes. A test fails when commitments gains a column that is neither on that list nor named as server-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U5EDJw5FqncJdPoUfBRKjF
Tophat: passedRan c238596 locally with
Not UX: every response, page and email reads the same as on Screenshots are in https://claude.ai/code/session_01AzC16pfLqisuhEvQmPXft5. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
withoutServerOnlyHashes used to drop two fields by name. It's replaced by PUBLIC_COMMITMENT_FIELDS, a list of the fields participants may see, and toPublicCommitment, which copies only those. Every participant response now goes through it: the sign-up retry, a new sign-up, getOwnCommitment, getOwnCommitmentsForSignup and updateOwnCommitment. The move path returns what commitParticipantToSlot gives back, so it's covered too. No callers of the old helper remain. Outside the schema and the token module, the hashes are read only where they're checked (commitments.ts:272, :513, :555). The list is every column except the two hashes, as the owner's note on #447 asked, so responses don't change. The tophat compared all six responses on base and head and found them identical, key order included. Each call site passes a full row (select(), c: commitments or .returning()), and toPublicCommitment takes a Commitment, so a partial row can't type-check and quietly send undefined fields. Both "Done when" items are met. Responses come from an explicit list. The exact-keys test fails if anything off the list goes out, and the getTableColumns test fails when a column is added until someone puts it on one list or the other. The statement count doesn't change, because rows are still read once and copied.
Blocking (0): none
Optional (0): none
Earlier threads: none on this PR
Checks: CI is green on c238596 (lint-type-test, e2e, CodeQL). That covers lint, types, knip, unit, DB, build, budgets and the query budget. The tophat passed on this exact SHA. Locally I read the diff, #447 and the owner's note, and checked every call site and remaining hash reference with grep. I also checked open issues for this area: only #447. Copilot couldn't review (quota reached). The PR is behind main but has no conflict.
Not UX and not high-risk (src/lib/public-commitment.ts and src/services/commitments.ts only), so it goes straight to merge.
https://claude.ai/code/session_015xd1jtBQeKpE6mYy58K2Bu
Generated by Claude Code
Fixes #447.
The problem
Participant responses (sign up, view, edit, move) were the whole
commitmentsrow witheditTokenHashandidempotencyKeyHashremoved by name (withoutServerOnlyHashes). If a new server-only column were added tocommitments, it would go out to participants unless someone remembered to add it to that list.The fix
src/lib/public-commitment.ts:withoutServerOnlyHashesis replaced byPUBLIC_COMMITMENT_FIELDS, the fields participants may see, andtoPublicCommitment, which copies only those fields. ThePublicCommitmenttype is aPickover the same list.src/services/commitments.ts: the six call sites and thePublicCommitmentRowalias now usetoPublicCommitmentandPublicCommitment. The hashes are still read only where they're checked (the edit-token checks and the sign-up retry lookup).No CHANGELOG entry, because nobody would notice the change.
Tests
src/lib/public-commitment.test.ts: the output has exactly the listed keys and neither hash. A field nobody listed (standing in for a new column) is dropped, and the row passed in isn't changed. One more test compares the list plus the named server-only fields againstgetTableColumns(commitments). It fails when a column is added until someone decides which list the column goes on.pnpm lint,pnpm typecheck,pnpm knip,pnpm test(1205),pnpm test:db(463), andsrc/app/query-budget.db.test.tswith the site env vars (3).https://claude.ai/code/session_01U5EDJw5FqncJdPoUfBRKjF
Generated by Claude Code