Skip to content

feat: track stable Next.js API surface and contract coverage#461

Draft
Divkix wants to merge 7 commits intocloudflare:mainfrom
Divkix:feat/api-surface-tracking
Draft

feat: track stable Next.js API surface and contract coverage#461
Divkix wants to merge 7 commits intocloudflare:mainfrom
Divkix:feat/api-surface-tracking

Conversation

@Divkix
Copy link
Contributor

@Divkix Divkix commented Mar 11, 2026

Closes #454

Summary

This PR finishes the stable API-tracking work for vinext's Next.js compatibility layer.

It adds three things that now work together:

  • discovery-based API manifest extraction from the published next package
  • strict shim coverage enforcement against that manifest plus known-gaps.json
  • a real dual-target HTTP contract suite that runs against vinext and real next dev

It also moves the server-action redirect 303 assertion out of the shared contract layer and into the regular App Router regression suite, because that flow depends on vinext's action transport details.

What Changed

  • replaced the extractor's hard-coded module lists with published-package discovery and directory re-export support
  • regenerated api-manifest.json for next@16.1.6
  • expanded known-gaps.json for intentional gaps surfaced by discovery (next/babel and experimental test helpers)
  • hardened .github/workflows/nextjs-api-track.yml to work from npm pack output and de-dupe issues by version marker
  • replaced the vinext-only behavioral contract file with a shared dual-target HTTP contract suite
  • moved the 303 server-action redirect assertion into tests/app-router.test.ts
  • pinned the shared fixture server helper to 127.0.0.1 for reliable local server boot in tests

Scope Notes

  • manifest enforcement is runtime-only in v1
  • extra migration shims may still exist outside manifest coverage when they are not part of the stable published runtime surface
  • server-action redirect coverage stays in the vinext regression suite, not the shared contract suite

Verification

  • pnpm test tests/api-manifest.test.ts tests/manifest-diff.test.ts tests/shim-coverage.test.ts
  • pnpm test tests/app-router.test.ts -t "uses 303 for server action redirects"
  • pnpm test tests/contracts/http.contract.test.ts
  • CONTRACT_TARGET=nextjs pnpm test tests/contracts/http.contract.test.ts
  • pnpm test tests/shims.test.ts
  • manifest parity against the published next@16.1.6 package
  • coverage parity check against the updated manifest
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run fmt:check

Divkix added 3 commits March 10, 2026 23:47
Add machine-readable API tracking infrastructure to enforce compatibility
between vinext's shims and the published Next.js API surface.

- Extract API manifest from next@16.1.6 (18 modules, scripts/extract-nextjs-api.ts)
- Add manifest diff script for detecting API changes (scripts/diff-nextjs-api.ts)
- Extract inline shim map into shared registry module (shims/registry.ts)
- Add shim coverage checker with known-gaps support (shims/coverage.ts)
- Add CI gate for shim coverage (ci.yml shim-coverage job)
- Add 5 behavioral contract tests (redirect 303, cookies, headers, middleware, metadata)
- Fix server action redirect status: 307 → 303 to match Next.js behavior
- Add weekly Next.js stable release tracking workflow (nextjs-api-track.yml)
- Enhance tip.yml with optional compat test job

Closes cloudflare#454
- Fix workflow tsx invocations: pnpm tsx → pnpm dlx tsx
- Add label creation step before issue search in tracking workflow
- Fix HEREDOC indentation in issue body template
- Stop skipping default exports in shim coverage check
- Add subdirectory module discovery (compat/router, legacy/image,
  font/google, font/local, web-vitals) to manifest extractor
- Regenerate api-manifest.json: 18 → 21 modules covered
- Add test fixtures for subdirectory module extraction
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@461

commit: bef0c34

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.

Track stable Next.js API surface with a checked-in manifest and CI coverage gate

1 participant