← Back to Pull requests

sds: format specification v0 and golden test vectors #118

Closed
unknown closed this pull request without merging on Oct 02, 2026 14:55 UTC
View on GitHub
unknown unknown commented on Oct 02, 2026 14:50 UTC
Author

This pull request implements the normative v0 format specification for Structured Data Streams (SDS) along with golden test vectors and validation tests.

Changes


  • Normative Format Specification (docs/sds-spec.md): Written with RFC 2119 normative language (MUST/SHOULD) and labelled v0 (draft; may change incompatibly). Covers framing and reserved type ID table, TypeDefinition semantics and canonical SHA-256 descriptor fingerprint algorithm, precise schema compatibility rules (compared with buf breaking), OpRecord row operations and canonical key encoding, raw application-typed records (keyless events), and the snapshot contract.

  • Design Document Consistency (docs/structured-data-streams.md and site/content/format.md): Updated design documentation and site pages to align with merged OpRecord (type ID 5), CREATE/UPDATE/DELETE row semantics, and transaction rules, while keeping the design doc as architecture rationale and cross-linking to the normative specification.

  • SDS Primary Key Validation: Added ValidateKeyBytes to check that OpRecord key bytes match declared primary key fields and contain no non-key or unknown fields, and ensured deterministic table row ordering by primary key.

  • Golden Test Vectors (pkg/sds/testdata/vectors/): Added 12 golden test vectors covering basic CRUD, multi-row atomic transactions, schema evolution (adding fields, renaming fields, reserving deleted fields), raw application-typed records, framework frames (SnapshotPointer, Padding), and error cases (reserved type ID, use before define, incompatible schema redefinition, key mismatch, and uncommitted tail).

  • Test Runner (pkg/sds/vectors_test.go): Added TestGoldenVectors with vector generators and validation against decoders and memtable projections, supporting regeneration via -regenerate.
  • Fixes #106

    Diff: 232 lines (+174 / -58) across 2 files Reviewer: justinsb Review duration: 4m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.56)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 232 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 82% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #118"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.1% (MEDIUM) · Higher = larger blast radius
    37.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.2% · Lower = rushed or shallow review
    56.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.2% · Safe to merge
    16.2%