feat(delivery): stamp the observed-range boundary into provenance (#297) - #298
Merged
Merged
Conversation
CRAF'd received July 2026 as history. #297 established the month was real but ~1% reported — six cells of 64,742, zero in `ged_sb` but non-zero in `ged_ns` and `ged_os` — so the producer's inferred boundary declared it observed and the clip kept it, correctly, by its own contract. Establishing that took a day, because the artifact could not answer the question a partner asks afterwards: observed through when, and decided against what? The boundary was recoverable only because those six cells happened to land in the two columns that leave a trace. In `ged_sb` the data would have been mute. `build_provenance` now requires `observed_through` and always emits it. Required rather than optional because a caller that forgets it is the failure being fixed; always emitted because an absent key is indistinguishable from an artifact built before the field existed. An explicit null carries the degrade-open case — the boundary could not be read, so this delivery was NOT clipped — which is the case that most needs recording and exactly the one an omit-when-absent field drops. A third state is kept distinct: `UNREAD`, the managers' initial value, refuses at build time. Letting it collapse to null would report "clip skipped" for a run whose clip in fact ran — the C-103 conflation, one layer down. `observed_through` joins the essential set in `compact_description`, or the 255-char fallback would drop it precisely when descriptions are long, and joins the redaction guard's declared keyset deliberately: a month_id integer, no PII, no credential, and what the partner needs to tell a sparse month from a fabricated one. Both partners, not just CRAF'd. The managers are deliberate clones and the UN-FAO side has the external partner; a fix in one is half a fix. A test asserts they do not diverge. Deferred with a trigger: the producer also publishes a per-source `last_valid_month_ids` map. `datafactory_query.defaults` exposes only the scalar, and a multi-source map would not fit the 255-char carrier. When C-15's structured metadata field lands upstream and the ceiling goes, stamp the map too. 12 tests: the rule on primitives, and the wiring as declaration checks. One asserts the assignment precedes the degrade-open early return — placed after it, the path that most needs recording would raise at provenance time instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closed
6 tasks
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.
Closes the forward-looking half of #297.
Why
#297's investigation (review) found the CRAF'd July artifact was not a fabricated month: 6 of 64,742 cells carry events (
lr_ged_ns=12.0,lr_ged_os=3.0,lr_ged_sb=0.0). The producer's inferred boundary saw those six and declared July observed; the clip kept it, correctly.Reaching that took a day, and only worked because the six cells landed in
ns/os. Inged_sbthe artifact would have been mute.What
build_provenancerequiresobserved_throughand always emits it:559nullUNREADThe third state matters: collapsing
UNREADto null would report "clip skipped" for a run whose clip ran — the C-103 conflation one layer down.Also joins the essential set in
compact_description(or the 255-char fallback drops it exactly when descriptions are long) and the redaction guard's declared keyset (a month_id integer — no PII, no credential).Both partners
#297 was filed as CRAF'd. The managers are line-for-line clones and UN-FAO has the external partner. A test asserts they don't diverge.
Deferred, with a trigger
The per-source
last_valid_month_idsmap isn't stamped:datafactory_query.defaultsexposes only the scalar, and a multi-source map won't fit 255 chars. Trigger: when C-15's structured metadata field lands upstream.Verification
507 passed, ruff clean. Line budgets 442/450 both managers.
🤖 Generated with Claude Code