-
Notifications
You must be signed in to change notification settings - Fork 0
chore(docs): correct false claims in CLAUDE.md and ARCHITECTURE.md (#1235) #1238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "version": "0.0.1", | ||
| "configurations": [ | ||
| { | ||
| "name": "storybook", | ||
| "runtimeExecutable": "bash", | ||
| "runtimeArgs": [ | ||
| "-c", | ||
| "export PATH=\"$HOME/.nvm/versions/node/v22.21.1/bin:$PATH\"; exec npm run storybook" | ||
| ], | ||
| "port": 6006 | ||
| } | ||
| ] | ||
| } | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { readFileSync, existsSync, readdirSync } from "node:fs"; | ||
| import { resolve, dirname } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| /** | ||
| * Guards the repo's own documentation against drift (#1235). | ||
| * | ||
| * CLAUDE.md is loaded as ground truth by agent sessions, so a stale path or | ||
| * count there becomes a wrong assumption in generated code. These tests fail | ||
| * loudly instead. | ||
| */ | ||
|
|
||
| const REPO_ROOT = resolve( | ||
| dirname(fileURLToPath(import.meta.url)), | ||
| "../../../..", | ||
| ); | ||
|
|
||
| const readDoc = (name: string) => | ||
| readFileSync(resolve(REPO_ROOT, name), "utf8"); | ||
|
|
||
| /** Top-level dirs that make a backticked token a repo path rather than an npm specifier. */ | ||
| const REPO_PREFIXES = [ | ||
| "app/", | ||
| "component/", | ||
| "connection/", | ||
| "connector-sdk/", | ||
| "cli/", | ||
| "docs/", | ||
| "scripts/", | ||
| ".claude/", | ||
| ".github/", | ||
| "docker/", | ||
| ]; | ||
|
|
||
| function referencedPaths(markdown: string): string[] { | ||
| const backticked = markdown.match(/`[^`\s]+`/g) ?? []; | ||
| return [ | ||
| ...new Set( | ||
| backticked | ||
| .map((t) => t.slice(1, -1)) | ||
| .filter((t) => REPO_PREFIXES.some((p) => t.startsWith(p))), | ||
| ), | ||
| ]; | ||
| } | ||
|
|
||
| const countFiles = (dir: string, ext = ".tsx") => | ||
| readdirSync(resolve(REPO_ROOT, dir)).filter((f) => f.endsWith(ext)).length; | ||
|
|
||
| describe("documentation accuracy", () => { | ||
| describe.each(["CLAUDE.md", "ARCHITECTURE.md"])("%s", (docName) => { | ||
| it("references only file paths that exist", () => { | ||
| const missing = referencedPaths(readDoc(docName)).filter( | ||
| (p) => !existsSync(resolve(REPO_ROOT, p)), | ||
| ); | ||
| expect(missing).toEqual([]); | ||
| }); | ||
| }); | ||
|
|
||
| describe("ARCHITECTURE.md component counts match the filesystem", () => { | ||
| // Each regex must match: a reworded claim should fail here rather than | ||
| // silently stop being checked. | ||
| it.each([ | ||
| [ | ||
| "shadcn/ui primitives", | ||
| /(\d+) shadcn\/ui primitives/, | ||
| () => countFiles("component/src/components/ui"), | ||
| ], | ||
| [ | ||
| "composed components", | ||
| /(\d+) higher-order components/, | ||
| () => countFiles("component/src/components/composed"), | ||
| ], | ||
| [ | ||
| "chart modules", | ||
| /BaseChart \+ (\d+) types/, | ||
| // charts/ holds base-chart.tsx plus one module per chart type. | ||
| () => countFiles("component/src/charts") - 1, | ||
| ], | ||
| ])("%s", (_label, pattern, actual) => { | ||
| const match = readDoc("ARCHITECTURE.md").match(pattern); | ||
| expect( | ||
| match, | ||
| `claim matching ${pattern} not found — was it reworded?`, | ||
| ).not.toBeNull(); | ||
| expect(Number(match![1])).toBe(actual()); | ||
| }); | ||
| }); | ||
|
|
||
| it("CLAUDE.md documents MIGRATE_ON_START, not a --skip-migrations flag", () => { | ||
| // Naming the flag to debunk it is fine (readers search for it); asserting | ||
| // it exists is not. The real escape hatch is MIGRATE_ON_START=0 (#1222). | ||
| const doc = readDoc("CLAUDE.md"); | ||
| expect(doc).toContain("MIGRATE_ON_START"); | ||
| expect(doc).not.toMatch(/`--skip-migrations`\s+flag\s+exists/); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| }); | ||
| }); | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: alfredo1996/neoboard
Length of output: 263
🏁 Script executed:
Repository: alfredo1996/neoboard
Length of output: 50377
🏁 Script executed:
Repository: alfredo1996/neoboard
Length of output: 41181
Avoid hardcoding the Storybook Node version in
.claude/launch.json.NODEis currently20, not22.21.1, and the path is developer-specific. If that directory is missing,npmfalls back to whatever is found next onPATH, so Storybook may start with the wrong node. Align this with the repo’s Node source or check a supported node version beforeexec npm run storybook.🤖 Prompt for AI Agents