#1092

RFC: single-source manifests + codegen + contract tests (tools / events / env / CI gates)

Openaryanranderiyaopened 3mo ago

Problem

The 40-agent friction audit (report: .agents/plans/shipping-friction-analysis.md) found that most of our worst shipping friction traces back to one structural cause: load-bearing cross-app contracts exist only as prose or hand-synced lists. Violations produce zero in-loop signal until something breaks at runtime — which is exactly the class of failure small models die on (hallucinated schemas, tools that silently never bind) and a recurring tax on frontier models and humans too.

Verified live divergences (receipts)

  1. Tool-name union drifted across three self-labeled-"canonical" registries

    • apps/api/app/models/chat_models.py (tool_fields, ~L56)
    • libs/shared/ts/src/chat/types.ts (~L796–836)
    • apps/web/src/config/registries/toolRegistry.ts (~L115+)
    • Audit-time counts: 31 vs 35 vs 36 names.
  2. Analytics split-funnel bug (live right now)

    • API emits "workflow:created" — apps/api/app/services/analytics_service.py:34
    • Web emits "workflows:created" — apps/web/src/lib/analytics.ts:54
    • Directly violates the repo's own one-event-one-emitter PostHog rule (AGENTS.md); cross-surface funnels silently stop joining. Same class: client-side capture double-counting server-side events.
  3. Env-var registration requires 4 hand-synced places

    • Pydantic field + validator group + .env.example + TS regex parser; audit measured ~112 registered vs ~94 documented. Drift yields warnings, not gate failures.

Proposal

Single-source manifests consumed by codegen + enforced by contract tests:

  1. Manifests: tools.yaml, analytics-events.yaml, env-vars.yaml, ci-gates.yaml — one authoritative definition per domain.
  2. Codegen emits every derived artifact: TS unions, Python enums, registry stubs, docs tables. Hand-editing generated files fails a check.
  3. Contract tests in CI assert: generated outputs are fresh; cross-system invariants hold (byte-identical queue names, Pydantic↔zod envelope mirror, event-name parity api↔web↔bots↔voice).
  4. Generators (nx g tool|event|env-var) scaffold every touchpoint from the manifest — makes the current 6-place new-tool checklist ("forget one = silent non-binding") structurally impossible.
  5. Gates manifest feeds local verification (companion mise verify effort): lane names/versions/scopes become data, killing the local-vs-CI version skew (bare uvx ruff vs pinned CI was yesterday's instance of this) and the dual change-detection truths (code-quality.yml extension matching vs main.yml nx-affected).

Why this collapses multiple top themes at once

  • Verification theater (agents claiming done without executing): contract failures become loud, mechanical, local.
  • Small-model cliff: the fatal class is prose-contracts-without-signal; manifests convert them into compile/test failures exactly where cheap models are strong.
  • Split-funnel/double-count analytics bugs: event-name parity becomes a tested invariant instead of a convention.

Open questions

  • First domain: tools/events (worst observed divergence) or ci-gates (largest time sink)?
  • Ownership: which team/domain owns manifest schema evolution?

Activity

0

No activity yet.