Repository navigation
Conversation
No live consumer read the legacy targets / strata / stratum_constraints tables. After chronicle#348 only db/etl_soi.py and db/etl_snap.py wrote them, and the source packages already publish those values as facts through the bundle. Delete the tables (Target, Stratum, StratumConstraint, TargetType, GeographicLevel), `chronicle load` / `stats` / `query`, the last two loaders, the Supabase query_targets / query_strata / insert_targets_batch helpers, scripts/export_to_json.py, the as_target / target_kwargs / TargetBlueprint normalization helpers, and the legacy names re-exported by chronicle.targets and policyengine_chronicle.targets. Keep the source-artifact tables and CLI (init, load-source-files, source-stats), the Jurisdiction and DataSource enums, query_sources and the Supabase client, and the US poverty/nonfiler target source coverage. Move the AGI-bracket tables chronicle/jurisdictions/us/soi.py imported from etl_soi.py into soi.py. Replace CI's `load all` step with an init + source-stats smoke. Move the SNAP fiscal-2024 period and checksum checks from the deleted ETL test into the package test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Retires Chronicle's legacy SQLite target path: the
targets/strata/stratum_constraintstables, everything that wrote or read them, and the Supabase helpers for atargetsschema that doesn't exist. Follow-on to #348 (merged as 130b95b), which deleted 12 of the 14 loaders that fed the table.No live consumer read the table. After #348, its only writers were
db/etl_soi.pyanddb/etl_snap.py. Both copy values that thesoi-table-1-1,soi-table-1-4andusda-snap-fy69-to-currentsource packages already publish as facts through the bundle and the consumer-fact export. Those outputs don't change: abuild-bundle --year 2023of the three packages is byte-identical before and after (below).Removed
db/schema.pylosesTarget,Stratum,StratumConstraint,TargetTypeandGeographicLevel.chronicle initnow creates only the four source-artifact tables.chronicle load,chronicle statsandchronicle query(db/cli.py). These now exit 2 with argparse's "invalid choice".db/etl_soi.pyanddb/etl_snap.py, withtests/test_etl_soi.py,tests/test_etl_snap.pyandtests/test_congressional_districts.py. The last of these held one test, pinning theGeographicLevelenum.query_targets,query_strata,insert_targets_batchandTARGETS_SCHEMA(db/supabase_client.py).chronicle/targets/loaders.py,chronicle/targets/client.py, and the legacy names re-exported fromchronicle.targetsandpolicyengine_chronicle.targets.as_target,target_kwargsandTargetBlueprint.chronicle/normalization/targets.pyis renamed totransforms.py, since nothing about targets is left in it.scripts/export_to_json.py, which wrote../policyengine.org/public/data/targets_summary.json.Kept
SourceArtifact/SourceTable/SourceColumn/SourceRowtables withinit,load-source-filesandsource-stats. They have no foreign key to the legacy tables.Jurisdiction(used bySourceArtifactandpe_source_inventory) andDataSource(a type onSourceFactandSourceReference).SupabaseConfig,get_supabase_client,query_sourcesandLEDGER_SCHEMA, used bychronicle/mirror.py,chronicle.clientandchronicle.sources.chronicle/targets/us_poverty.py.chronicle.targetsandpolicyengine_chronicle.targetsnow export exactly its seven names.convert_units,scale_value,apply_shareandformat_derivation.db/data/and thedbpackage in the wheel. 387 source packages read their files throughresource_package: db.Moved
AGI_BRACKETSandTABLE_1_1_AGI_LABEL_TO_BRACKETwere imported by the live SOI harness module (chronicle/jurisdictions/us/soi.py:27) fromdb/etl_soi.py. They now live insoi.pyitself, byte for byte. That import was the one live dependency on a loader that #348's Consumers section did not list.CI
init/load all/stats) becomes "Smoke-test the source-artifact database CLI" (init/source-stats).policyengine_chronicle.targetsas before. It now also checks that the coverage API works from the wheel and thatquery_targetsis gone.Consumers (audit, 2026-10-12)
Full evidence is in
~/PolicyEngine/_reviews/chronicle-legacy-targets-audit/. Five investigators ran first, then two adversarial passes tried to find a reader they had missed. Every check was read-only.Inside Chronicle: no module under
chronicle/reads the three tables. This was checked by grep for ORM selects and raw SQL, and by the import closure.chronicle/database.pyandchronicle/mirror.pywork on their own ledger tables, and the bundle and consumer-fact export never touched the legacy ones.Other repositories: none read or write the path. The search covered:
Three past readers are dead: microplex-us's
ArchSQLiteTargetProvider(deleted 2026-06-08, repo archived), microplex'srun_supabase_calibration.py(archived) and cosilico-microdata'svalidation/targets_db.py(archived 2025-12-22). Microcosm and chronicle.institute use onlychronicle build-bundle/build-consumer-artifact(chronicle.institute through theledgeralias), which this PR leaves working.Supabase: the repo's configured project has no
targetsschema, soquery_targetsandquery_stratareturnedPGRST106 Invalid schema: targets. An older copy of the tables sits in that project'smicroplexschema:This PR leaves that hosted data alone. Whether to drop it is d1438.
Websites:
targets_summary.jsonfed a CosilicoAI/cosilico.ai calibration page, deleted 2026-02-23 in 1e8157df. The../policyengine.orgpath came from the 2026-05-26 branding rename (Update PolicyEngine branding #6).PolicyEngine/policyengine.orgdoesn't exist,https://www.policyengine.org/data/targets_summary.jsonreturns 404, and policyengine-app-v2's history never contains the name. No workflow ever ran the script.Packaging: Chronicle has never been on PyPI.
policyengine-chronicle,policyengine-ledger,policyengine-arch-dataand three older names all return 404, and no repo declares a git dependency on it. So removing the legacy names frompolicyengine_chronicle.targetsbreaks no installed user. The changelog fragment carries a migration note.Not covered by this PR:
codex/thesis-ledger-factsbranch: it carries its own frozen copy of the legacy loaders, and its required "Arch checks" job still runsarch load all. A PR on main doesn't touch that branch; a separate task covers it.query_sourcesdefault to aledgerschema that the configured project lacks. That is a separate task too.Invariants
The PR removes code and adds no computational logic, so there are no property-based tests. Instead, the following properties are checked directly:
chronicle build-bundle --year 2023 --source soi-table-1-1 --source soi-table-1-4 --source usda-snap-fy69-to-currentwas run on maina5280e18and on this branch, and all 16 JSONL outputs are byte-identical. The mergedconsumer_facts.jsonlsha256 is96a2e62e…on both sides. Output is in the audit folder'sdiff-bundle/.test_chronicle_soi_targets.py) compares_legacy_soi_table_1_1_source_record_specs, which reads the moved tables, against the record-set specs, and it passes.chronicle initcreates exactly the four source-artifact tables and none of the legacy ones (test_init_creates_only_source_artifact_tables).db/etl_*.pyremains.load(with every former source andall),statsandquery.chronicle.targets,policyengine_chronicle.targets,db.schemaanddb.supabase_client, andscripts/export_to_json.pydoesn't exist (test_legacy_target_api_is_retired).Tests
ruff check chronicle policyengine_chronicle db scripts tests(locked ruff) passes, andruff format --checkpasses on every touched file.test_chronicle_boundaries,test_chronicle_facts,test_chronicle_namespace,test_chronicle_normalization,test_policyengine_chronicle_imports,test_supabase_client,test_source_files,test_chronicle_soi_targetsandtest_us_poverty_target_coverage.chronicle.cli(test_chronicle_artifacts,test_chronicle_verify_raw) pass: 76 passed.chronicle initandsource-statswork.chronicle --helplists the remaining commands.chronicle load allexits 2.ledger --helpworks.Coverage dropped with the deleted tests:
test_etl_soi.pychecked the loader's own Table 1.1/1.4 parser, which is gone. The same 2023 workbook values are pinned through the packages intest_chronicle_soi_targets.py.test_etl_snap.py's source-fact checks are covered bytest_usda_snap_source_package_builds_fy24_national_and_state_facts, which now also pins the fiscal-2024 period and the source checksum.Chronicle governance
This PR removes the legacy target path. It adds no source package, fact, schema contract or consumer contract.
ledger-source-ingestor(as for Retire US legacy ETLs whose values don't trace to publisher bytes #348 and UK enablement tooling: source-inventory de-hardcode, UK consumer-artifact suite, legacy ETL cleanup #135). Most edits (db/,docs/,scripts/,.github/workflows/ci.yml) fall outside its listed paths. They are the same kinds of files UK enablement tooling: source-inventory de-hardcode, UK consumer-artifact suite, legacy ETL cleanup #135 and Retire US legacy ETLs whose values don't trace to publisher bytes #348 changed to retire legacy ETLs.20261012-144145-chronicle-legacy-targets-review) approvedefc80749with no P0–P2 findings. It confirmed by mutation that the boundary, provenance, derivation-order, namespace-identity and public-removal tests fail when their guarded conditions break, and found no dangling references (dynamic imports, resource paths, package YAML, packaging). Its five P3s were fixed before the rebase onto main (55b2f30f): a guard on the canonicalchronicle.normalization, the SNAP fiscal-2024 period and checksum moved into the package test, "no live consumer" wording, "last observed index read" for the Supabase date, and the historical CI description.Decisions queued: d1438 (keep or drop the stale hosted
microplex.*tables). Separately, d1437 asks whether to rotate a Supabase secret that the audit's tooling exposed to local session logs. It is unrelated to this code.axiom: n/a: data infrastructure; no policy rule changes
🤖 Generated with Claude Code