Repository navigation
fix(reporting-storage): let 0.1.x run on an expanded ledger until it is contracted - #1867
Conversation
…is contracted #1857 refused any ledger whose reporting_configurations has offering_id. The rolling-safe upgrade on next (#1856) adds that column in an expand step but keeps the four-column generation key that 0.1.x writes, until the operator contracts. So 0.1.0b5 would refuse to restart mid-rollout, though it otherwise runs on the expand state unchanged. Refuse only when the configuration primary key includes offering_id, i.e. once the ledger is contracted. That is the same test the packaged SQL's key check makes. Refs #1856 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, scoped fix with no blocking findings.
This PR narrows the contract-2 refusal in require_owned_schema_or_empty from "offering_id column exists" to "offering_id is in the primary key" (migration.py:14-17), aligning the Python guard with the packaged SQL key check. The reviewer verified: _WIDEN places offering_id in the pkey so the four prior refusal tests still refuse, and the new _EXPAND keeps the four-column PK plus the 6-column reporting_obligations_period_key index, so put_configuration and commit_obligation still resolve on the expand state — exactly what the new test asserts. Non-breaking, scoped to the adcp-reporting-storage package, and the change ships with a matching conformance test.
Gate check: gated_paths is false, high_risk is false, no no-auto-approve team match, and no critical/high/medium findings. None of decision-table rows 1–8 fire, so this falls through to row 9 (approve). Note review_decision is REVIEW_REQUIRED, but with gated_paths=false that does not gate approval.
This is a follow-up to #1857, and it needs to land before 0.1.0b5 is published (#1834).
#1857 made 0.1.x refuse a ledger whose
reporting_configurationshas anoffering_idcolumn. The rolling-safe upgrade being built onnextfor #1856 adds that column in an expand step. It keeps the four-column generation key, under its original name, until the operator runs the contract step. 0.1.x writes exactly those keys, and the #1856 work verified that 0.1.0b5 otherwise runs on the expand state unchanged, worker turns included. With the column check, though, a 0.1.0b5 pod would refuse to restart in the middle of a rollout.Change:
require_owned_schema_or_emptynow refuses only when the configuration primary key includesoffering_id, i.e. once the ledger is contracted (or was widened by 0.2.0b1/b2). That's the same test the packaged SQL's key check already makes. The 42P10 write mapping is unchanged: on the expand state, 0.1.x writes succeed, so it never fires there.Test:
test_an_expanded_ledger_that_is_not_yet_contracted_still_runs_this_releaseapplies the ledger-core part ofnext's expand state (the column, a 5-column unique key, theCHECK (offering_id = '')constraints and the 7-column obligation index). It then restartscreate_schema(), runsput_configuration, and runscommit_obligation. The test fails under #1857's column check withReportingSchemaAheadErrorand passes here. The four existing refusal tests still pass, so a contracted ledger is still refused.make lintpasses.Refs #1856
🤖 Generated with Claude Code