# VRT-Protocol Quiet Frame Gap Closure Prompt

meta:
  repo: Fountain-Coach/midi2
  owner: MIDI2 Maintainers
  date: 2025-12-12
  cadence: quarterly
  goal: Close drift from MIDI 2.0 spec by codifying baselines and acceptance.

areas:
  property_exchange:
    baseline_spec: M2-103-UM (v1.2) §§5–7
    observed_implementation:
      files:
        - Sources/MIDI2/MidiCiPropertyExchangeBody.swift:1
        - Sources/MIDI2CI/PropertyExchange.swift:1
        - Sources/MIDI2CI/CIHandshake.swift:1
      tests:
        - Tests/MIDI2Tests/MidiCiHandshakeIntegrationTests.swift:23
    drift:
      - Schema-bound validation of JSON properties is not enforced.
      - Hardware interop coverage is missing.
    quiet_frame_goal:
      - Bind spec JSON schema to Swift types with validation.
      - Capture interop traces against external devices.
    acceptance_criteria:
      - Schema validation rejects invalid payloads with clear errors.
      - Interop runbooks + fixtures committed.
    tasks:
      - code: Generate Swift types from midi2.full.closed.schema.json for PE payloads.
      - test: Add schema-validation tests over PE JSON bodies.
      - interop: Capture device PE traces and assert decoding.

  profiles_and_fb:
    baseline_spec: M2-102-U (Profiles) and M2-104-UM §5 (Function Blocks)
    observed_implementation:
      files:
        - Sources/MIDI2/MidiCiProfilesBody.swift:1
        - Sources/MIDI2CI/ProfileInquiry.swift:1
        - Sources/MIDI2/StreamOpcode.swift:1
        - Sources/MIDI2/StreamBody.swift:1
        - Sources/MIDI2/Stream/FunctionBlockMessage.swift:1
        - Sources/MIDI2/Stream/FunctionBlockDiscovery.swift:1
      tests:
        - Tests/MIDI2Tests/MidiCiHandshakeIntegrationTests.swift:1
        - Tests/MIDI2Tests/StreamFunctionBlockDiscoveryTests.swift:1
    drift:
      - Function Block descriptors implemented for index/group range only; remaining descriptor fields and flow semantics pending.
      - Profiles: richer configuration/detail reports and spontaneous added/removed sequences pending.
    quiet_frame_goal:
      - Implement profile enable/disable + report messages end-to-end, including details and added/removed reports.
      - Define and parse full Function Block discovery/info structures.
    acceptance_criteria:
      - Enable/disable flows with success/NAK test coverage; detail reports exercised.
      - Function Block discovery parsing test vectors per spec examples and extended descriptors.
    tasks:
      - code: Extend profiles model with reports and handlers.
      - code: Add full Function Block descriptor types and parser.
      - test: Add XCTest covering discovery and configuration.

  ump_stream_config:
    baseline_spec: M2-104-UM §5 (Endpoint Discovery & Stream Config)
    observed_implementation:
      files:
        - Sources/MIDI2/StreamOpcode.swift:1
        - Sources/MIDI2/StreamBody.swift:1
        - Sources/MIDI2/Stream/EndpointDiscoveryMessage.swift:1
        - Sources/MIDI2/Stream/StreamConfigurationMessage.swift:1
        - Sources/midi2demo/StreamConfig.swift:1
      tests:
        - Tests/MIDI2Tests/StreamBodyTests.swift:1
        - Tests/MIDI2Tests/StreamTypedTests.swift:1
        - Tests/MIDI2Tests/StreamReservedBitsTests.swift:1
    drift:
      - Endpoint Discovery typed mapping present; remaining device info advertisement detail pending.
      - Stream Configuration request/notification present; GTB negotiation semantics pending.
    quiet_frame_goal:
      - Implement Endpoint/Device Info types and encoders/decoders.
      - Implement full Stream Configuration handshake (request/reply) and checks, including GTB negotiation semantics.
    acceptance_criteria:
      - Round-trip encode/decode tests for each message.
      - Negative tests for malformed fields and reserved bits.
    tasks:
      - code: Add stream config models and codecs.
      - test: Provide exhaustive tests including invalid cases.

  jr_clock:
    baseline_spec: M2-104-UM §4 (JR Clock/Timestamp)
    observed_implementation:
      files:
        - Sources/MIDI2/System/Utility.swift:1
        - Sources/jitterdemo/JitterApp.swift:1
      tests:
        - Tests/MIDI2Tests/System/JitterReductionTests.swift:1
    drift:
      - JR receiver available; demo polish optional.
    quiet_frame_goal:
      - Add receiver-side reconstruction and latency/jitter measurement.
    acceptance_criteria:
      - Demo computes expected absolute times from clock + offsets with tolerance.
    tasks:
      - code: Receiver model for JR sync.
      - test: Deterministic tests using seeded delays.

  sysex8:
    baseline_spec: M2-104-UM §6 (SysEx8)
    observed_implementation:
      files:
        - Sources/MIDI2/Data/SysEx8.swift:1
      tests:
        - Tests/MIDI2Tests/SysEx8Tests.swift:1
    drift:
      - Edge coverage implemented; maintain tests.
    quiet_frame_goal:
      - Expand tests for invalid sequences, multi-frame boundaries, and counts.
    acceptance_criteria:
      - Tests assert errors on all invalid sequences per §6.2.
    tasks:
      - test: Add exhaustive sequence tests.

  ump_extensions:
    baseline_spec: M2-104-UM §§4–6, Appendix A (Reserved IDs)
    observed_implementation:
      files:
        - Sources/MIDI2/System/Utility.swift:1
    drift:
      - Reserved-ID tests for all decoders to be broadened; placeholder handling not unified.
    quiet_frame_goal:
      - Define placeholder handling and enums for reserved ranges.
    acceptance_criteria:
      - Decoders ignore/flag reserved messages per policy with tests.
    tasks:
      - code: Extend enums and parsers.
      - test: Add reserved-range tests.

  testing_validation:
    baseline_spec: Project quality bar
    observed_implementation:
      files:
        - Tests/**
        - Scripts/SchemaGen.swift:1
        - Scripts/inject_schema_docs.py:1
    drift:
      - Limited CI negotiation and stream config tests at system level.
      - No VRT-Protocol visual baselines for CI messages.
      - No hardware interop capture tests.
    quiet_frame_goal:
      - Add end-to-end CI and stream config tests; VRT-Protocol baselines; optional hardware fixtures.
    acceptance_criteria:
      - Coverage threshold set; CI passes; VRT-Protocol diffs stable.
    tasks:
      - test: Add E2E scenario tests.
      - infra: Introduce VRT-Protocol baseline generation and review.
      - interop: Add capture/replay harness for hardware traces.

timeline:
  q1:
    - property_exchange: schema validation + interop captures
    - sysex8: edge-case tests (maintain)
  q2:
    - ump_stream_config: endpoint/device info + requests + GTB semantics
    - profiles_and_fb: enable/disable flows + details/added-removed reports
  q3:
    - ump_extensions: reserved ranges coverage
    - testing_validation: VRT-Protocol baselines
