Repository source: docs/plans/schema_change_visibility/schema_change_visibility_one_shot.md
Schema change visibility
Cycle v3/schema_change_visibility · One-shot · Plans
Debug mode: disabled
Effort study: railspike-effort / v3/schema_change_visibility; host ledger schema_change_visibility.md. Standing P2 enrollment. Extended estimates: disabled. Prior exposure: the rater wrote the root-cause findings this cycle acts on.
Cycle estimate: 0.25 (intake and execution entry, 2026-12-04 UTC)
Storage changes: none. This cycle changes instructions, the schema spec and one test. It changes no read-model table, column or index.
Status: implemented and pushed for review; stacked on #555; next permitted action: maintainer merge.
Original request
"we should make it highly visible that we're updating schema", plus the four suggested instruction changes (Ilya, 2026-12-04):
In
implementation_standards.md, replace "where possible" with a requirement: any new column, table or index must name the existing fields checked and say why they can't serve, and a column for a single attribute or a single tag isn't allowed when generic tag data covers it.In the Step 3 template, add a required Storage changes line (or "none") that the approver sees.
In Step 4, count any schema difference from the approved plan as a plan change that needs renewed approval.
In CONTRIBUTING, add one sentence saying the read-model procedure is how to make a justified change, not permission to make one.
He chose "v3 now, upstream later": every rule goes into v3's own guidance (AGENTS.md, CONTRIBUTING.md) plus a test. The generic Step 3 and Step 4 changes are proposed to rlspk/railspike later, as separate work. The vendored docs/railspike/ tree is not edited.
Why (root cause)
agent_opt_out added two posts columns for one attribute, and nobody stopped it:
The plan named a column once, in Stage 1's expected changes. "Approved step 3" covered it without the approver being asked.
Stage 1 then built two columns and an index. The Step 4 summary didn't list that as a plan change.
post_tags_jsonandviewer_tagsalready held the tag. No check of existing data was required, only encouraged ("where possible").CONTRIBUTING's read-model section reads as a procedure for making a change, and nothing tests it: #547 also skipped the required
read_model_schema_v1.mdentry.
Reverted in revert_agent_opt_out (PR #555).
Authorization
A bounded one-shot: the four rule changes, done the v3-side way, plus making schema changes highly visible. Push and open a PR. This does not authorize editing docs/railspike/, an upstream Railspike PR, a merge or a deploy.
Outcome and work type
Documentation plus one test. After this, a read-model schema change can't happen quietly:
Plans: every Step 1 option, every Step 3 plan and every one-shot record carries a
Storage changes:line near the top:none, or a warning callout that names each table, column or index and the existing fields checked. The approval request message repeats it.Implementation: any storage difference from the approved plan stops work and needs renewed approval. It isn't just recorded.
Commits and PRs: a schema change puts
⚠ Schema N:at the start of the PR title and a warning callout first in the PR body and commit message.Test: a new test fails when the schema's fingerprint changes without a matching
## Version Nentry, with that fingerprint, inread_model_schema_v1.md. That catches both a change made without bumping the version and a bump made without the spec. #547 would have failed it.Rule: a new column, table or index must name the existing fields checked and why they can't serve. A column for one attribute or one tag is not allowed when tag data (
post_tags_json,viewer_tags) can answer it.
Reuse decisions
AGENTS.mdalready sends agents to CONTRIBUTING's read-model section. The new AGENTS.md section is short and points to the detail in CONTRIBUTING, without duplicating it.The test follows
SqlInsertColumnsTest(a repository-wide guard with a plain failure message). It uses the existingReadModelSchema::fingerprint()andReadModelMetadata::SCHEMA_VERSION, and is added to the smoke set as one fast test.Fingerprints are recorded in the spec's existing version sections (a
Fingerprint:line), not in a new file.
Risks
Impact: the guard fails for cosmetic changes to schema statements (whitespace). Mitigation: that is acceptable, because the fingerprint already treats them as a change that needs a rebuild. The failure message says what to do.
Impact: this branch is stacked on #555, because the guard needs the version-59 entry. Mitigation: say so in the PR. Merging this PR first would also merge the revert.
Verification
The new test passes. Before committing, a deliberate edit to a schema statement and a version bump without a spec entry each make it fail.
Smoke set plus
ReadModelSchemaTestand the new test. The full suite is not run.git diff --check; links in edited docs resolve.
Concepts touched
None. These are workflow and contributing rules, not product concepts.
History
2026-12-04: planned (planning commit
04dab7c4d).2026-12-04: implemented.
CONTRIBUTING.md"Read-model schema changes" gains three subsections: the procedure is not permission; Justify new storage (name the fields checked, no single-attribute or single-tag column whenpost_tags_json/viewer_tagscan answer); Make it visible (Storage changes:line in Step 1 options, Step 3 plans and one-shot records; a storage difference from the plan stops work for renewed approval;⚠ Schema N:PR title and an opening callout in the PR body and commit message). The required steps now say the version always moves forward and the spec section carries aFingerprint:line.AGENTS.mdgains a short "Read-model schema changes are loud" section pointing to CONTRIBUTING. It applies the checkpoints to every Railspike step here until Railspike carries them.New
tests/ReadModelSchemaVersionTest.php, in the smoke set. The spec's Version 59 section now records its fingerprint.Discovery: the shared
assertSame()helper drops its message argument, so the guard throws its own error to keep the instructions in the failure output.
Verification results
./v3 test --smoke ReadModelSchemaTest(smoke set now includes the new test): 504 passed, 0 failed.Deliberate breakages in the real repo, each reverted afterward: adding a column to
ReadModelSchemawithout a bump fails with "READ-MODEL SCHEMA CHANGE not recorded. The schema changed since Version 59 was recorded…", and a version bump to 60 without a spec section fails with "SCHEMA_VERSION is 60 but the newest spec section is Version 59."git diff --checkclean. The anchorCONTRIBUTING.md#read-model-schema-changesis unchanged.Not run: the full suite.
Left for later (not authorized here)
Upstream Railspike PR to rlspk/railspike: a
Storage changesfield in the Step 1 option and Step 3 templates, and storage differences as a renewed-approval trigger in Step 4. Once released and synced, the AGENTS.md bridge sentence can go.
Retrospective
Retrospective scope assessment 0.25, single exposed Claude rater. Maintainer judgment pending.