fix(docs): strip foreign-schema bleed from per-stack schema docs#305
Open
WhatIfWeDigDeeper wants to merge 2 commits into
Open
fix(docs): strip foreign-schema bleed from per-stack schema docs#305WhatIfWeDigDeeper wants to merge 2 commits into
WhatIfWeDigDeeper wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes tbls per-schema documentation bleed by adding a cleanup pass to the schema-doc generation script and regenerating the committed docs/schema/<stack>/ outputs so each stack’s docs only reflect its own Postgres schema.
Changes:
- Clear each per-stack schema docs directory before running
tbls docto avoid stale.mdfiles and non-idempotent Mermaid column swaps. - Post-process generated READMEs to remove foreign-schema rows in
## Tables/## Enumsand foreign entities/relations in Mermaid ERDs; delete leaked${other_schema}.*.mdfiles; filterschema.jsontables to own-schema entries. - Update cspell dictionary to accept common constraint/sequence tokens emitted by
tbls.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/generate-schema-docs.sh | Clears per-stack docs dirs, scopes Mermaid column swap to generated dirs, and adds post-processing to strip foreign-schema leaks. |
| cspell.config.yaml | Adds schema/constraint-related terms to cspell allowlist. |
| docs/schema/vue-nuxt/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/svelte-hono/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/ruby-rails/schema.json | Regenerated: includes rails schema tables; (still includes cross-db enums in .enums). |
| docs/schema/ruby-rails/ruby_rails.schema_migrations.md | New generated table doc. |
| docs/schema/ruby-rails/ruby_rails.internal_metadata.md | New generated table doc. |
| docs/schema/ruby-rails/README.md | Regenerated: removes foreign-schema ## Enums section and includes rails-only tables/relations. |
| docs/schema/react-nestjs/schema.json | Regenerated: removes leaked react_nestjs_history.* table entries. |
| docs/schema/react-nestjs/README.md | Regenerated: removes leaked react_nestjs_history.* tables, enums, and Mermaid entities. |
| docs/schema/react-nestjs/react_nestjs_history.knex_migrations.md | Deleted leaked per-table doc from wrong schema directory. |
| docs/schema/react-nestjs/react_nestjs_history.knex_migrations_lock.md | Deleted leaked per-table doc from wrong schema directory. |
| docs/schema/react-nestjs/react_nestjs_history.application_history.md | Deleted leaked per-table doc from wrong schema directory. |
| docs/schema/react-nestjs-history/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/react-koa/schema.json | Regenerated output (includes normalized constraint expressions). |
| docs/schema/react-koa/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/python-fastapi/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/java-spring/schema.json | Regenerated output (includes normalized constraint expressions). |
| docs/schema/java-spring/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/graphql-yoga/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/go-gin/schema.json | Regenerated output (includes normalized constraint expressions). |
| docs/schema/go-gin/README.md | Regenerated: removes foreign-schema ## Enums section content. |
| docs/schema/express-prisma/README.md | Regenerated: removes foreign-schema enum rows from ## Enums. |
| docs/schema/express-prisma/express_prisma._prisma_migrations.md | Removed stale generated doc for a dropped table. |
2 tasks
WhatIfWeDigDeeper
added a commit
that referenced
this pull request
May 6, 2026
- Make jq a hard requirement (fail fast with install hint) — previously the schema.json post-process silently no-op'd when jq was absent, leaving foreign-schema tables in the JSON artifacts. - Filter `.enums` array in schema.json to own-schema entries only; drop the `enums` key entirely when no own-schema enums remain (rails, go, and react-nestjs-history have none). The `## Enums` README cleanup already did this for the markdown side; schema.json now matches. Co-authored-by: copilot-pull-request-reviewer[bot] <copilot-pull-request-reviewer[bot]@users.noreply.github.com>
WhatIfWeDigDeeper
added a commit
that referenced
this pull request
May 6, 2026
…307) ## Summary Resolves the high-severity Remote Code Execution advisory [GHSA-hffm-xvc3-vprc](GHSA-hffm-xvc3-vprc) by bumping the transitive `simple-git` from 3.35.2 → 3.36.0 (via `npm audit fix`). Pulled in via `nuxt → @nuxt/devtools → simple-git`. Other packages in the monorepo do not depend on `simple-git`, so no other lockfiles change. > Note on wording: "patch" in the PR title is used as a verb ("apply a fix") — it does **not** imply a semver patch-level bump. 3.35.2 → 3.36.0 is a minor bump, which is what `npm audit fix` recommends as the smallest available fix for this advisory. CI's `audit:ci:all` step has been failing on this advisory on every PR opened against `main`, blocking merges. This commit was cherry-picked from `feat/understand-codebase-graphs` (commit `f063bf3`) so the fix can land independently of that feature branch's review cycle. ## Test plan - [x] `cd nuxt-api && npx -y audit-ci --config .auditconfig.json` passes locally. - [ ] CI `audit:ci:all` passes on this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Update — additional pre-existing CI breakages folded in (seroval lockfile sync) After pushing the simple-git fix, CI surfaced additional pre-existing main-level breakages that had been masked by the audit failure: `npm ci` was failing in **both** `tanstack-start-ui/` and `react-apollo-ui/` with: ``` npm error Invalid: lock file's seroval@1.5.2 does not satisfy seroval@1.5.4 npm error Invalid: lock file's seroval-plugins@1.5.2 does not satisfy seroval-plugins@1.5.4 ``` `npm install` in each of those directories regenerates their lockfiles to 1.5.4 for both packages. Folded into this PR because (a) they're the same shape of pre-existing main breakage and (b) all three must land before any open PR can pass CI. PRs #305 and #306 are blocked on this PR landing. Commits in this PR: - `9331aa9` fix(deps): bump simple-git in nuxt-api to patch GHSA-hffm-xvc3-vprc - `1ade966` fix(deps): sync tanstack-start-ui lockfile (seroval 1.5.2 → 1.5.4) - `ec44aef` fix(deps): sync react-apollo-ui lockfile (seroval 1.5.2 → 1.5.4) --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Closes #303. `tbls`'s `--include "${schema}.*"` filter has two limitations the script didn't compensate for: - It filters tables, not enums — so every per-schema README's `## Enums` section listed the union of all 26+ Postgres enum types across every stack's schema. `docs/schema/ruby-rails/README.md` carried 24 foreign rows even though rails-api defines zero Postgres enums of its own. - It treats the `.` in `${schema}.*` as a regex match-any-char, so schemas whose names share a prefix (`react_nestjs` vs `react_nestjs_history`) bleed each other's tables, schema.json entries, Mermaid entities, and per-table `.md` files. Add a post-process pass to `scripts/generate-schema-docs.sh` that walks each per-schema dir and drops foreign-schema rows from `## Enums` and `## Tables`, drops Mermaid entity blocks and relation lines for foreign schemas, filters `schema.json` `tables[]` to own-schema entries only, and removes leaked `${other_schema}.*.md` files. The `## Enums` heading is dropped entirely when no own-schema rows remain (rails has none). Also clear each schema dir before invoking `tbls` — otherwise stale `.md` files (tables that have since been dropped from the DB, like the old `express_prisma._prisma_migrations`) survive forever and the Mermaid column-swap toggles their content on every run, breaking idempotence. Add `pkey`, `fkey`, `nextval`, `regclass` to cspell — they appear in constraint and sequence-default expressions tbls emits. Verified: - All 11 per-stack `## Enums` sections list only own-schema enums (or no section at all when the stack has none). - `docs/schema/react-nestjs/` contains no `react_nestjs_history.*.md` files; its README and schema.json reference only `react_nestjs.*`. - Re-running `npm run docs:schema` produces no diff (idempotent). - `docs/schema/lambda-api/` (hand-written DynamoDB docs, not in SCHEMAS) is unchanged from `main`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Make jq a hard requirement (fail fast with install hint) — previously the schema.json post-process silently no-op'd when jq was absent, leaving foreign-schema tables in the JSON artifacts. - Filter `.enums` array in schema.json to own-schema entries only; drop the `enums` key entirely when no own-schema enums remain (rails, go, and react-nestjs-history have none). The `## Enums` README cleanup already did this for the markdown side; schema.json now matches. Co-authored-by: copilot-pull-request-reviewer[bot] <copilot-pull-request-reviewer[bot]@users.noreply.github.com>
01220ab to
b746c68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #303.
tbls's--include "\${schema}.*"filter has two limitations the script didn't compensate for:## Enumssection listed the union of all 26+ Postgres enum types across every stack's schema.docs/schema/ruby-rails/README.mdcarried 24 foreign rows even though rails-api defines zero Postgres enums of its own..in\${schema}.*as a regex match-any-char — schemas whose names share a prefix (react_nestjsvsreact_nestjs_history) bleed each other's tables,schema.jsonentries, Mermaid entities, and per-table.mdfiles.This PR:
scripts/generate-schema-docs.shthat walks each per-schema dir and:## Enumsand## Tablesschema.jsontables[]to own-schema entries only${other_schema}.*.mdfiles## Enumsheading entirely when no own-schema rows remain (rails has none)tbls— otherwise stale.mdfiles (tables dropped from the DB, like the oldexpress_prisma._prisma_migrations) survive forever and the Mermaid column-swap toggles their content on every run, breaking idempotence.pkey,fkey,nextval,regclassto cspell — these appear in constraint and sequence-default expressions tbls emits.Acceptance criteria (per #303)
docs/schema/<stack>/README.md## Enumssection lists only enums from that stack's schema.docs/schema/ruby-rails/README.mdno longer has an## Enumssection.scripts/generate-schema-docs.shcontinues to be safe to re-run (idempotent).docs/schema/<stack>/README.md## Tablessection lists only tables from that stack's schema.docs/schema/<stack>/directory contains only${schema}.*.mdfiles.docs/schema/<stack>/schema.jsoncontains only its own schema's tables.docs/schema/<stack>/README.mdMermaid## Relationsdiagram contains only its own schema's entities.Test plan
docker compose up -d postgres && npm run docs:schemare-runs cleanly.docs/schema/ruby-rails/README.mdhas no## Enumssection.docs/schema/react-nestjs/README.mdreferences noreact_nestjs_history.*rows.docs/schema/lambda-api/README.md(hand-written DynamoDB docs, outsideSCHEMAS) unchanged frommain.🤖 Generated with Claude Code