Add source period metadata to Arch facts - #50
Closed
MaxGhenis wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Superseded by #73, which absorbs this design on the post-rename tree: reference-period semantics are now |
MaxGhenis
added a commit
that referenced
this pull request
Jul 2, 2026
…rtifacts (#73) * Type fact assertions and period coverage in the core schema Every Ledger fact now records who asserted its value: observation (the default) for publisher-measured outcomes, source_projection for the publisher's own forward-looking estimates (CBO baselines, BFP outlooks, SSA trustees tables, TPC/JCT scores). PolicyEngine-computed values fail validation. PeriodCoverage carries non-identity reference-period provenance (coverage dates, basis, publisher period label, accounting basis), absorbing the design from #50 on the current tree; a fact's period is documented as the period its value refers to. Key stability: assertion enters canonical v1/v2 key payloads only when non-default and serialization omits defaults, so every existing observation fact keeps byte-identical keys and JSONL. Golden tests pin the pre-change key hashes. Source packages declare assertion and period_coverage per record set; the SQLite registry gains matching columns; the consumer-contract schema and checked-in sample gain the always-explicit assertion field. Refs #71. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Add consumer artifacts with period-contract resolution New policyengine_ledger.consumer module: build-consumer-artifact bundles consumer-contract fact rows, target profiles, coverage diagnostics, and manifest content hashes into a reproducible directory Populace can load without database access or copied values (#61). resolve_profile_targets selects profile targets from fact rows and enforces the period contract: consuming a fact at a period other than its reference period raises PeriodContractError unless the consumer passes an explicit, versioned PeriodAlignmentDeclaration — the schema-level guard against the populace#212 silent un-aged calibration failure. Ledger records the declaration and returns the published level; it never computes the aligned value. Resolved rows carry basis, fact_period, requested_period, assertion, and lineage so diagnostics distinguish a missed published fact from a missed aged level. Refs #61, #71. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Document the facts-only boundary The store is facts-only and the line is who asserted the value: publisher projections are facts typed source_projection; PolicyEngine- computed levels never enter the store and aging stays in Populace as a named, versioned model over Ledger growth-factor facts. New ADR records the decision and why facts-plus-projections in one schema was rejected (Thesis resolution circularity, append-only churn, the consumer set). Judges must fail changes that store PolicyEngine-computed values. Refs #71. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 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
Why
Microplex needs target sources to distinguish calendar, tax, fiscal, projection, and cash/accrual semantics without overloading the coarse
period_type/periodpair. This keeps those semantics in Arch source packages rather than in downstream calibration glue.Validation
uv run ruff check arch/core.py arch/sources/specs.py arch/source_package.py arch/database.py tests/test_arch_core.py tests/test_arch_source_package.py tests/test_arch_database.pyuv run pytest tests/test_arch_core.py tests/test_arch_source_package.py tests/test_arch_database.py