Skip to content

S6 — forecast outbound → arrow sample-frame wire (ships (N,S) to FAO) #91

Closed

Description

@Polichinel

Epic: #85 · S6 · [CROSS-REPO-GATED] · blocked · depends on #88, faoapi #45, register C-40

Background

This is the step that actually propagates (N,S) to FAO. Today _save writes object-dtype df.to_parquet (unfao.py:298,309) to Appwrite, and views-faoapi reads it (pd.read_parquet → to_array_columns decodes object-dtype cells → numpy → build_prediction_frame). The forecast parquet is a wire contract vpp cannot change unilaterally.

Work (gated — coordinated two-sided cutover)

  • vpp _save: emit the forecast as a views-frames arrow sample-frame (views_frames.io.arrow.save — flat columnar time/unit/sample/value) instead of object-dtype parquet.
  • views-faoapi: ingest via arrow.load → PredictionFrame instead of pd.read_parquet → to_array_columns → build_prediction_frame.

Acceptance criteria

  • Forecast delivery carries (N,S) uncollapsed as an arrow sample-frame; faoapi reconstructs the PredictionFrame.
  • On S=1 inputs the reconstructed output is identical to today's point delivery (regression).
  • Cutover is coordinated (faoapi can read the new format before vpp stops writing the old).

Parity / validation

Dual-write / golden-file during cutover: emit both legacy object-dtype parquet and the arrow sample-frame; assert faoapi's reconstructed PredictionFrame is array-equal from both. S1's conformance harness is the shared contract both repos test against.

Dependencies / gate

Blocked on: S3 (interior already a PredictionFrame), faoapi #45 (consumer half + ADR-046 amendment), and register C-40. Never change the emitted wire before faoapi can read it.

Files

views_postprocessing/unfao/managers/unfao.py (_save); coordinated changes in views-faoapi (tracked there). Target API: views_frames.io.arrow.


Review amendment (expert-code-review, 2026-06-28) — wire I/O behind a sink adapter

Emit the arrow sample-frame through a small delivery sink adapter the manager _save calls, not inline to_parquet/arrow.save in the method.

  • Why: same SRP/DIP reason as S3 (S3 — forecast convert-at-the-door (internal PredictionFrame) #88) — keep representation/I/O out of the manager god-method (register C-40 thin-shell). The sink adapter is the symmetric counterpart to S3's source adapter.
  • Acceptance criteria addition:
    • Outbound arrow serialization lives behind a delivery sink adapter; _save calls it.

Activity

  1. added
    story
    implementation
    blocked
    needs-decision
    on Jun 28, 2026
  2. Polichinel commented on Jul 2, 2026

    @Polichinel
    CollaboratorAuthor

    Scope update per the wire contract (views-platform/views-models#149 (comment: Sampled-Forecast Wire Contract v1, 2026-07-03)): the gate on faoapi is now bounded by a ratified format.

    • Output = one views_frames.io.arrow file per (target, month) — per-month sharding is mandated (a single-file full-draw artifact is ~9.5 GB/target and arrow.load has no mmap; sharding is the mitigation on both counts).
    • The §2 contract header rides in the arrow views_frames KV header's open metadata dict (frame_type, sample_count, dtype, spatial_level, target, sharding, provenance).
    • The 9 GAUL columns do NOT ride per-row — gid-keyed sidecar per run (§5).
    • delivery/draws.py (§6) runs before every upload here.
    • Historical artifact unchanged in v1. Consumer half: views-faoapi#100. Producer leg upstream: Hop A publish leg: PFE forecasts never reach the prediction store — add the Track A archive upload views-pipeline-core#269.
  3. Polichinel commented on Jul 15, 2026

    @Polichinel
    CollaboratorAuthor

    Contract ADOPTED as ADR-013 (views-postprocessing/docs/ADRs/013_sampled_forecast_wire_contract.md); see the adoption comment on views-platform/views-models#149 (2026-07-15). This story (S6, the sink adapter) is now spec'd by §4: per-(target,month) arrow shards, the run manifest last (§4.2, one per run spanning targets), the geo sidecar (§5), store documents under the pinned name (§4.1a — note the explicit obligation: the forecast document's name changes from ensemble-name to the pinned consumer name in this leg), after the §6 draws.py policy gate. Still gated on #88 (S3) and coordinated with faoapi#100 — but the format question this story was blocked on is settled.

  4. Polichinel commented on Jul 19, 2026

    @Polichinel
    CollaboratorAuthor

    Superseded by epic #105 (ADR-013 Hop-B sink leg). This issue's scope — forecast outbound as a views-frames arrow wire behind a sink adapter — is carried, refined, and extended there (per-month shards #108, run manifest #110, sidecar #109, composed sink + §6 gate + upload interlock #112), per the adopted contract docs/ADRs/013_sampled_forecast_wire_contract.md §4. The blockers recorded here are restructured: the faoapi format question is settled by ADR-013; live upload is gated on faoapi C-161 (production deploy), enforced in code by the upload-disabled-by-default interlock. Closing.

    🤖 Generated with Claude Code

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

    blockedimplementationneeds-decisionstory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions