Skip to content

test(core): deterministic per-field guard that every config schema field survives normalization — the Arbitrary round-trip missed the provider_routes drop #1285

Closed

Description

@dezren39

test(core): add a deterministic per-field guard that every config schema field survives normalization — the Arbitrary round-trip missed the provider_routes drop that reached production

Evidence (verified 2026-11-01 on main 23b2e8e659)

packages/core/src/config/normalize.ts rebuilds the config document key by
key (normalizeExperimental at line 461ff, the nativeAtomic table at
lines 218–232, and per-section helpers). A schema field that nobody adds to
the rebuild is silently dropped — no diagnostic, no error.

This exact omission has now bitten twice in the routing surface alone:

The existing guard did not catch either: packages/core/test/config/normalization.test.ts
has a property test, "preserves arbitrary JSON-round-tripped native
configuration" (line ~144), which runs Arbitrary.schema(Info) for only
100 runs. The schema is almost entirely optional and deeply nested, so a
given run rarely populates any specific field — and the test file's own
history proves the gap: the property test has existed since 2026-10-17
(commit 1fc489d878), provider_routes entered the schema later (#1132),
and the drop still shipped. The regression tests added by #1277
(normalization.test.ts lines 960 and 992) pin those two fields by name —
the next new field gets no such protection unless someone remembers.

Proposal

Add a deterministic guard test in
packages/core/test/config/normalization.test.ts (or a sibling file) that
enumerates the schema itself — e.g. Object.keys(Config.Info.fields) and
Object.keys(ConfigExperimental.Info.fields) — and, for every field,
asserts a normalization round-trip with that field populated by a minimal
schema-valid value (generated per-field via Arbitrary on the single field
schema, or a maintained minimal-fixture table keyed by field name, failing
loudly when a new field has no fixture). Fields with intentional transforms
(legacy migrations, experimental.policies → top-level policies,
experimental.aliases → top-level aliases, malformed-note filtering) are
asserted at their documented destination, reusing the existing
withoutEmptyCompatibilityContainers / withoutMalformedNotes adjustments
where they already encode the intent.

Why it matters

Config normalization sits under every config read in the fork; its failure
mode is the worst kind — a user's setting silently does nothing. The routing
features are actively growing new experimental fields (#1132–#1142 in the
last weeks), so the hand-maintained rebuild list will keep drifting from
the schema until the schema itself drives the test.

Acceptance criteria

Activity

  1. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    on Nov 1, 2026
  2. developing-today commented on Nov 1, 2026

    @developing-today
  3. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/corePackage: core (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  4. dezren39 commented on Nov 1, 2026

    @dezren39
    Author

    🤖 Agent note · filed

  5. added
    work/assignedAn agent holds this item via the queue (claimed task)
    queue/claimedA queue worker has claimed the task for this item
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  6. dezren39 commented on Nov 1, 2026

    @dezren39
    Author

    🤖 Agent note · state: picked up

  7. added a commit that references this issue on Nov 1, 2026
  8. removed
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    on Nov 1, 2026
  9. dezren39 commented on Nov 1, 2026

    @dezren39
    Author

    🤖 Agent note · state: done

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

    app/corePackage: core (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/testTest coverage, test infrastructure, or test-only fixespriority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions