Skip to content

fix(docs): compile the examples in package READMEs, which nothing read - #1825

Merged
mobeenabdullah merged 1 commit into
mainfrom
feat/readme-examples-compile
Sep 12, 2026
Merged

mobeenabdullah merged 1 commit into
mainfrom
feat/readme-examples-compile

Conversation

@mobeenabdullah

Copy link
Copy Markdown
Collaborator

The gap

A README is the first code a user copies, and it was the only documentation no
gate had an opinion about. check-docs-compile reads docs/. This gate read
docs/. Measured on main: 43 TypeScript examples across 29 package and
template READMEs, compiled by nothing at all.

Three of them could not work as written, and the gate found all three on its
first run.

What was broken

  • packages/module-specifiers called readFileSync(file, "utf8") with
    neither readFileSync imported nor file declared. Its only usage example
    was unrunnable.
  • packages/builder illustrated its entry points by importing rectToHost
    from the root package AND from /geometry in one block. Both exports are
    real, so the snippet was correct about the API and uncompilable as a paste. It
    names a distinct symbol from /geometry now, so it still makes its point.
  • packages/plugin-page-builder's defineBlock example omitted example,
    which is REQUIRED by BlockDefinition. The block API gained a required field
    and the documentation did not follow — the drift nothing was watching for.

Why this widens the existing gate instead of adding one

The READMEs join the SAME collector, so they pass through the same extraction,
the same reader-owned classification, the same continuation handling and the
same ratchet. Exactly one line assumed docs/; everything downstream was
already path-agnostic.

A separate checker would need its own copy of all four, and a second baseline
is a second thing that goes stale
— this repository was red on the existing
one earlier today, until #1810 regenerated it. One population, one baseline, one
place to keep honest.

What is left, and why it is recorded rather than fixed

Four findings remain, all reader placeholders: myPosts, router,
getPostBySlug, and an implicitly-typed params. They are in the baseline,
which only shrinks.

Recording them required --allow-new-findings. That is the gate refusing to
absorb findings quietly, and widening the population is precisely the deliberate
act the flag exists for — worth noting rather than passing silently.

Evidence

  • check:doc-samples exits 0. Coverage moves from 51 pages / 345 samples to
    69 pages / 388 samples, 244 compiled.
  • Controls, both verified to go RED: breaking a README example (an import of an
    export that does not exist) fails the gate; narrowing the collector back to
    docs/ alone fails two of the new tests. Four new tests pin the population by
    NAME rather than by count, including one that the docs pages must still be
    there, so a collector rewritten to return only READMEs cannot pass.
  • pnpm test:scripts 1348 passed; check:docs-compile, comment convention and
    fallow:audit all green, zero introduced findings.

A README is the first code a user copies, and it was the only documentation no
gate had an opinion about: `check-docs-compile` reads `docs/`, this gate read
`docs/`, and 43 TypeScript examples across 29 package and template READMEs were
compiled by nothing at all. Three of them could not work as written.

Widened rather than duplicated. The READMEs join the SAME collector, so they
pass through the same extraction, the same reader-owned classification, the same
continuation handling and the same ratchet. A second checker would need its own
copy of all four, and a second baseline is a second thing that goes stale, which
this repository has already been red over once. One line of the walk changed;
everything downstream was already path-agnostic.

The three the gate found on its first run:

- `module-specifiers` called `readFileSync(file, ...)` with neither imported nor
  declared, so its only usage example could not run.
- `builder` listed entry points by importing `rectToHost` from the root AND from
  `/geometry` in one block. Both exports are real, so the snippet was correct
  about the API and uncompilable as a paste; it names a distinct symbol now.
- `plugin-page-builder`'s `defineBlock` example omitted `example`, which is
  REQUIRED. The block API gained the field and the documentation did not follow.

The four left are reader placeholders — `myPosts`, `router`, `getPostBySlug`, an
implicitly-typed `params` — and they are recorded in the baseline, which only
shrinks. `--allow-new-findings` was needed to record them, which is the gate
refusing to absorb findings quietly; widening the population is the deliberate
act that flag exists for.

Verified in both directions: breaking a README example turns the gate red, and
narrowing the collector back to `docs/` alone fails two of the new tests.
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 048f1694-f6e9-42b0-ba5a-2b198e839085

📥 Commits

Reviewing files that changed from the base of the PR and between 83a2e49 and b31ea2a.

📒 Files selected for processing (6)
  • packages/builder/README.md
  • packages/module-specifiers/README.md
  • packages/plugin-page-builder/README.md
  • scripts/check-doc-samples.mjs
  • scripts/check-doc-samples.test.mjs
  • scripts/doc-samples-baseline.json

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.

@mobeenabdullah

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T08:22:20.054961Z b31ea2a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added type: docs Documentation only scope: plugin @nextlyhq/plugin-* packages labels Sep 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Whole-Repository Code Hygiene Summary

Full dead-code, duplication, and complexity report for the PR branch as it stands now. Playground is excluded. Quality gate enforcement on introduced issues is performed by the Changed files job.

🌿 Fallow

Warning

Review needed

⚠️ 73 code issues · ⚠️ 684 clone groups · ⚠️ 1035 health findings

See inline review comments for per-finding details.

Code issues (73)
Category Count
Unused files 2
Unused exports 5
Unused dependencies 19
Unused devDependencies 6
Unresolved imports 2
Unlisted dependencies 1
Circular dependencies 38
Duplication (684 groups · 28715 lines · 4%)
Locations Lines Tokens
schemas/_dialect-bundles/mysql.relations.ts:40-134
schemas/_dialect-bundles/postgres.relations.ts:40-134
schemas/_dialect-bundles/sqlite.relations.ts:40-134
95 593
cli/commands/db-sync-demote.ts:70-75
cli/commands/db-sync-promote.ts:38-43
cli/commands/dev-build.ts:100-105
cli/commands/dev-build.ts:179-184
cli/commands/dev-build.ts:299-304
cli/commands/dev-build.ts:411-416
cli/commands/dev-build.ts:552-557
cli/commands/dev-server.ts:575-580
cli/commands/dev-server.ts:840-845
cli/commands/dev-server.ts:1143-1148
cli/commands/migrate-field-groups.ts:110-115
6 70
entries/EntryList/EntryTableSkeleton.tsx:74-98
collection/components/CollectionTableSkeleton.tsx:94-118
field-group/components/FieldGroupTableSkeleton.tsx:90-114
plugins/components/PluginsTableSkeleton.tsx:86-110
singles/components/SinglesTableSkeleton.tsx:77-101
src/components/table-skeleton.tsx:100-124
25 89
collections/config/validate-config.ts:380-433
field-groups/config/validate-field-group.ts:185-238
singles/config/validate-single.ts:190-243
54 152
dispatcher/handlers/collection-dispatcher.ts:925-967
field-groups/services/field-group-table-provisioning.ts:186-236
singles/services/reconcile-single-companion.ts:110-160
51 149

… and 679 more groups.

Across 422 files.

Complexity (1035 functions above threshold)
File Function Severity Cyclomatic Cognitive CRAP Lines
singles/services/single-mutation-service.ts:937 <arrow> critical 245 ! 307 ! 13210.4 ! 1588
collections/services/collection-mutation-service.ts:6117 <arrow> critical 169 ! 160 ! 6338.2 ! 1261
src/init/reload-config.ts:1441 applyReload critical 137 ! 208 ! 4191.1 ! 1388
shared/lib/entry-validation.ts:223 validateFieldValue critical 109 ! 157 ! 2675.3 ! 432
blocks-engine/src/measure-bytes.ts:646 surveyDocument critical 102 ! 250 ! 137.1 ! 658

5032 files, 77465 functions analyzed (thresholds: cyclomatic > 20, cognitive > 15, CRAP >= 30)

Codebase health

Metric Value
Maintainability 91.7 / 100
Avg complexity 1.8

Tip

Run fallow fix --dry-run to preview auto-fixes.
Add /** @public */ above exports to preserve them.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: b31ea2a3d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pkg-pr-new

pkg-pr-new Bot commented Sep 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nextlyhq/adapter-drizzle

npm i https://pkg.pr.new/@nextlyhq/adapter-drizzle@b31ea2a

@nextlyhq/adapter-mysql

npm i https://pkg.pr.new/@nextlyhq/adapter-mysql@b31ea2a

@nextlyhq/adapter-postgres

npm i https://pkg.pr.new/@nextlyhq/adapter-postgres@b31ea2a

@nextlyhq/adapter-sqlite

npm i https://pkg.pr.new/@nextlyhq/adapter-sqlite@b31ea2a

@nextlyhq/admin

npm i https://pkg.pr.new/@nextlyhq/admin@b31ea2a

@nextlyhq/admin-css

npm i https://pkg.pr.new/@nextlyhq/admin-css@b31ea2a

@nextlyhq/blocks-engine

npm i https://pkg.pr.new/@nextlyhq/blocks-engine@b31ea2a

@nextlyhq/blocks-react

npm i https://pkg.pr.new/@nextlyhq/blocks-react@b31ea2a

@nextlyhq/builder

npm i https://pkg.pr.new/@nextlyhq/builder@b31ea2a

create-nextly-app

npm i https://pkg.pr.new/create-nextly-app@b31ea2a

@nextlyhq/eslint-plugin

npm i https://pkg.pr.new/@nextlyhq/eslint-plugin@b31ea2a

nextly

npm i https://pkg.pr.new/nextly@b31ea2a

@nextlyhq/plugin-form-builder

npm i https://pkg.pr.new/@nextlyhq/plugin-form-builder@b31ea2a

@nextlyhq/plugin-page-builder

npm i https://pkg.pr.new/@nextlyhq/plugin-page-builder@b31ea2a

@nextlyhq/plugin-sdk

npm i https://pkg.pr.new/@nextlyhq/plugin-sdk@b31ea2a

@nextlyhq/plugin-seo

npm i https://pkg.pr.new/@nextlyhq/plugin-seo@b31ea2a

@nextlyhq/storage-s3

npm i https://pkg.pr.new/@nextlyhq/storage-s3@b31ea2a

@nextlyhq/storage-uploadthing

npm i https://pkg.pr.new/@nextlyhq/storage-uploadthing@b31ea2a

@nextlyhq/storage-vercel-blob

npm i https://pkg.pr.new/@nextlyhq/storage-vercel-blob@b31ea2a

@nextlyhq/ui

npm i https://pkg.pr.new/@nextlyhq/ui@b31ea2a

commit: b31ea2a

@mobeenabdullah
mobeenabdullah merged commit 7fb7745 into main Sep 12, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: plugin @nextlyhq/plugin-* packages type: docs Documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant