Skip to content

test(cli): compile-check the shipped target source in the fast gate - #461

Merged
Ducksss merged 1 commit into
devfrom
fix/compile-check-shipped-source
Aug 9, 2026
Merged

Ducksss merged 1 commit into
devfrom
fix/compile-check-shipped-source

Conversation

@Ducksss

@Ducksss Ducksss commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Why

v1.3.0 shipped a starter base that could not compile — init --scaffold produced a project that failed tsc the moment a block was installed into it. It passed every gate, because no gate could see it: payload-components/source is excluded from tsc and this repo has no payload dependency, so nothing local ever compiled the code being shipped.

The bugs only surfaced once #458 added the bare smoke scenario — a ~7-minute run needing network and a database. That's the right full proof, but it's the wrong place for the only proof. This PR adds the fast half.

What

One new int spec, tests/int/payload-components-source-compiles.int.spec.ts:

  1. Parses every .ts/.tsx under payload-components/source — 162 files, enumerated by walking the directory so a new shipped file is covered the moment it's added, not when someone remembers to list it. Parsing needs no dependencies, so it covers the whole tree.
  2. Applies real manifest fragments from hero-basic and faq-card to the shipped RenderBlocks.tsx and Pages/index.ts, then re-parses the patched result and asserts the entries landed inside the structures they belong to — not merely somewhere in a file that happens to parse.
  3. Typechecks the renderer with a populated block map using a real TS program. The renderer imports nothing but React, so this runs without a Payload app.

Plus a paragraph in AGENTS.md recording the rule: shipped target code must be compile-checked, not just reviewed.

Verification

Negative controls — each fix reverted in turn, then restored:

Reverted Result
the patcher's same-line-object branch + = {} source shape ✗ patch check fails (12 parse errors)
the never-typed direct block lookup ✗ typecheck fails: expression of type 'string' can't be used to index type '{ heroBasic: …; faqCard: … }'

Both reproduce in milliseconds what previously took a 7-minute network+DB run.

Local gate: pnpm lint && pnpm format:check && pnpm exec tsc --noEmit && pnpm test:registry && pnpm run test:int — exit 0, 512 int tests passed.

e2e not re-run. The diff is one new test file and one markdown paragraph; no site, CLI, registry, or component code changed. Say the word if you'd rather have the full test:release on it.

Scope note

This does not replace pnpm test:fresh -- --scenario bare — that stays the full proof, since it compiles the bundle inside a real Payload app against real payload types. This is the check that runs on every save, and it would have caught two of the three bugs on the first run.

🤖 Generated with Claude Code

v1.3.0 shipped a starter base that could not compile. Nothing caught it
because nothing could: `payload-components/source` is excluded from tsc and
this repo has no `payload` dependency, so no local gate ever looked at the
bytes being installed. The bugs surfaced only when the bare smoke scenario
was added — a seven-minute run needing network and a database.

Add an int spec that closes the fast half of that gap:

- parse every `.ts`/`.tsx` under `payload-components/source` (162 files,
  enumerated so new ones are covered on sight)
- apply real manifest fragments from two components to the shipped
  `RenderBlocks.tsx` and `Pages/index.ts`, then re-parse the result and
  assert the entries landed inside the structures they belong to
- typecheck the renderer with a populated block map, using a real TS
  program (React is its only import, so it resolves here)

Verified by reverting each fix in turn: the same-line-object patcher bug
fails the patch check, and the `never`-typed block lookup fails the
typecheck. Both reproduce in milliseconds instead of only in the smoke.

The bare smoke stays the full proof — it compiles inside a real Payload
app. This is the check that runs on every save.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 9, 2026 17:58
@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview Aug 9, 2026 6:03pm
payload-components-97bf Ready Ready Preview Aug 9, 2026 6:03pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Ducksss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 463e0ebf-90b5-426c-ab77-2f26186c1387

📥 Commits

Reviewing files that changed from the base of the PR and between ededcde and 49b6145.

📒 Files selected for processing (2)
  • AGENTS.md
  • tests/int/payload-components-source-compiles.int.spec.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss merged commit 487d90b into dev Aug 9, 2026
12 checks passed
@Ducksss
Ducksss deleted the fix/compile-check-shipped-source branch August 9, 2026 18:12

This branch was successfully deployed

2 active deployments
Preview – payload-components-97bf — 49b61456 Deployed Aug 9, 2026 by vercel[bot]
Preview – payload-components — 49b61456 Deployed Aug 9, 2026 by vercel[bot]
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.

2 participants