Skip to content

feat(core): .AsStream() catalog view + deferred streaming Load() #116

Description

@Spelkington

Parent

#112

What to build

The catalog surface for streaming reads: a .AsStream() container-axis modifier and the deferred streaming Load() path. .AsStream() derives a read-only streaming view of an existing eager item — IItem<IEnumerable<T>>IReadOnlyItem<FlowSource<T>> — read-only because composed streaming writes are out of scope. It is gated to composed formats that can actually stream (via the streaming-decode marker); calling it on a direct storage adapter (EFCore/Sheets/GQL, which have no format serializer) is a design-time/pre-flight error, never a silent materialize.

Requires a capability seam on the composed storage adapter (exposing the medium + reader) that also composes through the constrained-adapter wrapper. Streaming Load() is a new deferred-acquisition path — it returns a FlowSource description that brackets the medium open on first pull; it is not an eager container adapter (whose FromRows returns an eager Task<T>). Typed schema-mismatch translation is performed in the storage-layer per-pull producer (the Prelude cannot see SchemaMismatchException), preserving the typed RuntimeError.SchemaMismatch the eager path gives.

Design: ADR-0023.

Acceptance criteria

  • .AsStream() derives IReadOnlyItem<FlowSource<T>> from an eager item via a capability seam that composes through the constrained-adapter wrapper.
  • Streaming Load() opens the medium on first pull (deferred), not eagerly; fan-out (two consumers) re-acquires, matching eager multi-consumer behavior (test).
  • .AsStream() on a direct adapter (no IFormatStreamReader) fails at design-time/pre-flight — never wraps an eager load in a FlowSource.
  • A mid-stream schema mismatch surfaces as typed RuntimeError.SchemaMismatch (not External), matching the eager path (test).

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions