Skip to content

feat(delivery): stamp the observed-range boundary into provenance (#297) - #298

Merged
Polichinel merged 1 commit into
developmentfrom
feat/297-stamp-observed-range-boundary
Aug 25, 2026
Merged

feat(delivery): stamp the observed-range boundary into provenance (#297)#298
Polichinel merged 1 commit into
developmentfrom
feat/297-stamp-observed-range-boundary

Conversation

@Polichinel

Copy link
Copy Markdown
Collaborator

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. In ged_sb the artifact would have been mute.

What

build_provenance requires observed_through and always emits it:

value meaning
559 clipped against this boundary
null boundary unreadable — clip skipped, unobserved months may be present (C-26)
UNREAD raises — call-order bug, not a delivery condition

The third state matters: collapsing UNREAD to 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_ids map isn't stamped: datafactory_query.defaults exposes 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

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>
@Polichinel
Polichinel merged commit 636d0df into development Aug 25, 2026
4 checks passed
@Polichinel
Polichinel deleted the feat/297-stamp-observed-range-boundary branch August 25, 2026 08:39
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