Skip to content

Add source period metadata to Arch facts - #50

Closed
MaxGhenis wants to merge 1 commit into
mainfrom
codex/source-package-harness-guards-20260530
Closed

Add source period metadata to Arch facts#50
MaxGhenis wants to merge 1 commit into
mainfrom
codex/source-package-harness-guards-20260530

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Summary

  • add optional period metadata to Arch canonical facts: start/end dates, period basis, authority, source label, and accounting basis
  • propagate the metadata from source-package YAML through source-record specs and fact construction
  • store the metadata in the relational Arch DB schema and concept-alignment rows

Why

Microplex needs target sources to distinguish calendar, tax, fiscal, projection, and cash/accrual semantics without overloading the coarse period_type/period pair. 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.py
  • uv run pytest tests/test_arch_core.py tests/test_arch_source_package.py tests/test_arch_database.py

@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Superseded by #73, which absorbs this design on the post-rename tree: reference-period semantics are now PeriodDimension (documented as the value's reference period) plus a non-identity PeriodCoverage object carrying start/end dates, period basis, the publisher's period label, and accounting basis — declared per record set in source-package YAML and threaded through specs to facts. The distinction this draft wanted (calendar/tax/fiscal/projection semantics living in Ledger source packages rather than downstream glue) is preserved, and consumption at a period other than the fact's reference period now hard-fails without a declared alignment. Closing in favor of that PR.

@MaxGhenis MaxGhenis closed this Jul 2, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant