Skip to content

S2 — unfao/wire/header.py: the §2 contract header builder (pinned key order, closed sub-objects) #107

Closed

Description

@Polichinel

Part of epic #105. Depends on S1.

Problem

The §2 header is byte-pinned by the golden fixture (key order matters — §2's key-order rule), but no vpp code can build one. The sink needs to embed it in every arrow shard.

Work

views_postprocessing/unfao/wire/header.py: CONTRACT_VERSION = "1.5"; build_header(*, sample_count, dtype, target, time_id, run_id, generated_at, provenance, sharding_index, sharding_count) emitting the 13 keys in exactly the §2 pinned order; the three closed sub-objects (id_semantics, provenance, sharding) reject extra keys (§2.1 rule-1 clarification). Mirror scripts/build_wire_fixture.py:_header — do NOT import from scripts (fixture stays canonical).

Acceptance criteria

  • json.dumps(build_header(...), indent=2).encode() byte-equals the fixture Track-A metadata.json.
  • Equals the header recovered from the fixture arrow shard (views_frames.io.arrow.load → state['metadata']).
  • Extra key in any closed sub-object raises, naming the key.

Tests: tests/test_wire_header.py. Oracle: fixture .tap.zip member + arrow shard metadata.

🤖 Generated with Claude Code

Activity

  1. added
    story
    implementation
    on Jul 19, 2026
  2. added a commit that references this issue on Jul 20, 2026
  3. Polichinel commented on Jul 31, 2026

    @Polichinel
    CollaboratorAuthor

    Shipped and proven by run-0. unfao/wire/header.py (75 lines) exists on development with the pinned key order and closed sub-objects, is covered by the wire test suite (and by the ADR-013 §2 falsification guards), and was exercised end-to-end in the first FAO global-land delivery on 2026-07-27. Live API confirmed serving it 2026-07-31 (smoke test ALL PASS, contract=1.5). Closed during the development→main cleanup sweep; reopen if anything here is unfinished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementationstory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions