Skip to content

Add a compatibility contract, cleanup rules, and an API route snapshot gate - #1402

Merged
ebma merged 3 commits into
stagingfrom
chore/compatibility-guardrails
Oct 5, 2026
Merged

ebma merged 3 commits into
stagingfrom
chore/compatibility-guardrails

Conversation

@ebma

@ebma ebma commented Oct 5, 2026

Copy link
Copy Markdown
Member

Why

The cleanup in #1397 kept SDK and API users working only because every agent run was briefed by hand: which surfaces must not change, which areas were out of scope, and how to prove a refactor is equivalent. This PR makes those rules the default for every agent session (Claude Code and Codex). Where it can, it turns them into a CI failure instead of guidance.

Changes

1. Compatibility Contract in the root CLAUDE.md

The root CLAUDE.md loads in every session and reaches general-purpose subagents. Codex gets it through AGENTS.md. The new section states the invariants for every change, especially refactors and cleanups:

  • mounted HTTP endpoints keep their paths, methods, validation, status codes, error codes and response bodies;
  • the SDK's exports, emitted types, runtime behaviour and wire requests stay unchanged;
  • anything the SDK references in the published @vortexfi/shared stays;
  • persisted formats (ramp state, rebalancer state files, browser storage keys, webhook payloads) stay readable;
  • refactors prove equivalence with characterization tests first, with no exceptions in fund-moving code;
  • a cleanup must remove net code.

2. vortex-cleanup repo skill (.agents/skills/vortex-cleanup/SKILL.md, symlinked into .claude/skills/)

The ponytail plugin can't be configured from the repo; a same-named repo skill only loads next to it. So the cleanup-specific rules live in a repo skill that CLAUDE.md links to:

  • the scope exclusions decided on 2026-10-01 (ABIs, Storybook, AssetHub flows, generic shared shrinking, BlindPay, gold demo mode, stdlib sleeps);
  • the deferred swaps, each with the behaviour change it would cause;
  • the procedure for proving code is dead, checking dependencies and lockfiles, refactoring, running gates and committing;
  • the practical lessons from running parallel workstreams.

Subagent model hints are given for both Claude Code and Codex. Built-in Explore/Plan subagents don't load CLAUDE.md, so the skill tells delegating agents to restate the contract in their prompts.

3. CI enforcement: mounted routes in the wire-contract snapshot

wire-contract:check already pinned the shared endpoint types and the public SDK surface, so an SDK snapshot already existed. The gap was the API: api-surface-inventory.test.ts only counts *.route.ts files, so removing or renaming one endpoint inside a mounted router failed nothing.

  • The report now lists every mounted METHOD /path (230 today, including the /brl↔/brla and Alfredpay country aliases). The routes are derived statically from apps/api/src/config/express.ts by following app.use/router.use mounts.
  • An unreadable route declaration (a non-literal path) makes the generator throw instead of silently dropping the route. A one-argument app.get(name) (Express's settings getter) is ignored.
  • An independent count of route-method calls (134 declarations) matches the extracted table after collapsing aliases.
  • New fixture tests cover mounts, path aliases, route() chains, the settings getter and the fail-loud case.
  • docs/api/README.md and the address-feedback skill describe the wider gate. MAP.md's stale .agents/skills description is refreshed.

The snapshot change adds the route section only. #1397 removes no mounted route, so it needs no snapshot update.

Verification

  • cd scripts/wire-contract && bun test: 5 pass (2 new).
  • bun run wire-contract:check is up to date with the regenerated snapshot.
  • bun run verify (Biome) is clean.
  • api-surface-inventory.test.ts passes.
  • The skill's frontmatter parses as YAML.

ebma added 3 commits October 5, 2026 15:36
The gate already pinned the shared endpoint types and the public SDK surface, but removing or renaming an endpoint inside a mounted router only showed up in the route-file count. The report now lists every mounted METHOD /path, derived statically from config/express.ts, so such a change fails CI until the snapshot is deliberately updated. Unreadable route paths fail the generator instead of silently dropping routes.
Ponytail and other cleanup runs need the scope decisions and verification procedure from the 2026-10 cleanup. The ponytail plugin can't be configured from the repo, so a repo skill carries them for both Claude Code and Codex.
Cleanups and refactors kept existing integrators working only because each run was briefed by hand. The contract makes that the default for every agent session: mounted endpoints, the SDK surface, published shared exports and persisted formats stay compatible, and refactors prove equivalence first.
@netlify

netlify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 3301010
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6ac3a885a229ab0008ddd5ed
😎 Deploy Preview https://deploy-preview-1402--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vortexfi ready!

Name Link
🔨 Latest commit 3301010
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6ac3a88539c7790008ddb767
😎 Deploy Preview https://deploy-preview-1402--vortexfi.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vrtx-dashboard canceled.

Name Link
🔨 Latest commit 3301010
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6ac3a88533f2460008dc2899

@ebma
ebma merged commit 34a7acf into staging Oct 5, 2026
6 checks passed
@ebma
ebma deleted the chore/compatibility-guardrails branch October 5, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant