Repository navigation
test(storage): stop DDL-patching tests sharing a poisoned tier prototype - #4028
Merged
Merged
Conversation
Ref polylogue-s5iyt
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sinity
added a commit
that referenced
this pull request
Aug 19, 2026
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HWcPJJJvuF25CqVwTFgSQC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two
test_durable_change_train.pytests have been failing on master in whole-module runs since long before tonight, characterized inpolylogue-s5iytas an order-dependent flake. The cause is a process-wide tier-prototype cache inbootstrap.initialize_archive_tierwhose key does not include the DDL, so a test that monkeypatchesARCHIVE_DDL_BY_TIERmints a prototype from its synthetic schema and every later test at that version silently receives it. Dropping the poisoned key around the two modules that patch bootstrap's DDL fixes it. Test-only.Problem
Reproduction, deterministic, 3 node ids, ~1 second:
Drop the first test and the other two pass. Both victims fail with
DurableChangeTrainError: actual post-apply bytes do not have admitted fresh-DDL parity.Mechanism.
initialize_archive_tiercaches one materialized prototype database per(tier, version)and page-copies it into every later empty connection — that reuse keeps ~0.8s of DDL parsing off thousands of tests. The cache key deliberately excludes the DDL, because in productionARCHIVE_DDL_BY_TIERis a constant: one DDL per tier and version, always.A test that monkeypatches the DDL breaks that premise.
test_maintenance_route_persists_and_proves_a_future_trainpatches SOURCE to a syntheticbase_items + future_itemsschema at version 2 and, being first, records that as the prototype for(source, 2). The bootstrap victims patch SOURCE tobase_items + durable_itemsat the same version, then build a fresh database — and get the first test's schema by page copy.monkeypatchrestores the dict; it cannot restore a prototype minted from it. Their admitted fresh-DDL parity proof (built from a synthetic in-memory target) then disagrees with the recovered image, which is exactly what the parity check exists to refuse.Instrumenting the comparison showed only one field diverging (
fresh_vs_admitted=False, computedb98a8df2…vs admitted5b173b1b…) through an identical call path in both orders — same code, different bytes, which is the signature of cached state rather than a branch difference.Solution
A
clear_tier_prototypesfixture intests/conftest.py, requested viapytestmark = pytest.mark.usefixtures(...)by the two modules that patch bootstrap's ownARCHIVE_DDL_BY_TIER—test_durable_change_train.pyandtest_archive_maintenance_cli.py. It drops the SOURCE prototype on both sides of each test, so such a module neither inherits nor exports a poisoned prototype.Two scoping decisions, both forced by measurement rather than taste:
test_audit_adoption_receipt_recovers_interrupted_publication_during_bootstrapfail on its own, because a page-copy restore and a freshexecutescriptdo not produce byte-identical databases and that test compares an audit image against a canonical recoverable one. Every assignment in the DDL-patching modules targetsArchiveTier.SOURCE, so dropping only the poisoned key is both sufficient and non-disruptive.test_workload_artifacts.pydeliberately excluded, though it also appears in asetattr.*ARCHIVE_DDL_BY_TIERgrep. Its single patch targetstests.infra.workload_artifacts.ARCHIVE_DDL_BY_TIER— a test-infra reference, not bootstrap's — so it never mints a prototype from a synthetic DDL and cannot poison the cache. Adding the marker there was strictly harmful: it broketest_seeded_archive_corruption_is_refused_by_a_fresh_process, which relies on the cache.The production cache is untouched. In production its premise holds, and the perf win is the reason it exists.
Verification
No failure traded. Across all three DDL-adjacent modules together, deterministic order:
The two durable-change-train failures are fixed; the three remaining (
test_rebuild_index_source_replay_expands_every_execution_selection_to_authority_cohorts[all|only-missing|explicit]) are pre-existing on master, confirmed by running the identical selection on a stashed tree. They are untouched by this change and out of scope here.Bisect: what this is not
polylogue-s5iytwas raised tonight as possibly a new master red introduced by #4015's v68CONSTRAINT_ONLYdelta. It is not. Whole-module runs at7b671755b(pre-#4015),70a3ca2ad(#4015 itself),f93a8b87c, and current master HEAD all produce the identical 2 failures. The v68 CHECK widening is not implicated, and the failure long predates it.Two disproved hypotheses, recorded so nobody re-runs them:
bootstrapwhile the polluter patches bothbootstrapandmigration_runner. Adding the missingmigration_runnerpatch to the victims does not fix it.sys.modulesleakage. The polluter's fixed-namefixture_migrations_maintenancepackage does leak intosys.modulesand survive teardown (verified), and the module's own helper builds unique per-tmp_pathnames — a real inconsistency. But purging those entries between tests does not fix it either.Ref polylogue-s5iyt
Not in scope
test_archive_maintenance_cli.pycohort failures.test_durable_change_train.py— real, but not the cause, and changing it would be unmotivated churn in this PR.