Repository navigation
feat: Circuit diagram style, embed fix, strict-typed core and unit tests - #6
Merged
Merged
Conversation
- /3d/, /embed/ and /embed/3d/ (trailing slash) now serve the pages, and vendor/, fonts and favicons requested relative to those paths are found. Before, the 3D embed could not load Three.js and 3D client links (/3d/) were 404. - Never serve dotfiles, node_modules, package/tsconfig files, tools/, tests/ or server.js; reject malformed URLs and NUL bytes. - Export resolveFile/handle and only listen when run directly, so the routes are unit-tested (tests/server.test.mjs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Circuit style: dark board, flat chip-shaped blocks with an inset top and pins (2D and 3D), thin steel-blue lines, plain monospace capital labels, light-blue highlight. - Client and embed links are built without a trailing slash (pageUrl). - The whole shared core (helpers, markdown + 23 Mermaid parsers, layout, diagram styles/settings UI) is one synced block and is fully typed with JSDoc: 0 TypeScript strict-mode errors, enforced with no baseline. The baseline for the rest went from 1995 to 809. - Bug found by the strict types: a ZenUML participant declared by name only (e.g. a line with just Alice) crashed the parser (assignment precedence in if(m=...&&...)). Fixed, with a regression test. - Unit tests (node:test): every example parses into a valid graph, behaviour tests per new type, parser-output snapshot, style completeness, 3d core equals index core, server routes. Run in CI. - server.js, tools and tests are type-checked in strict mode. - README: Circuit style, Code checks section; AGENTS notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
/embed/3dcould not load Three.js, and 3D client links (/3d/) returned 404. Both work now, with or without a trailing slash.npm testunit tests run in CI.Bugs found and fixed
/embed/3d,/embed/3d/) could not loadvendor/three.module.js, so it showed nothing. Fonts and favicons were also 404 under/embed/.server.js/3d/,/embed/and/embed/3d/now find their relative assets.…/3d/, which returned 404.pageUrl()), and the server accepts both forms.Alice) crashed the parser.parseZenif(m=a&&b)assigned a boolean and readm[1]beforemwas set. Fixed, with a regression test. Found by the strict types.server.jsalso servedpackage.json, and could servetools/,server.jsand any dotfiles if deployed.server.jsCode checks (
npm run check, also in CI)tools/sync-parser.py --check)tests/checkJson the page scripts, plusserver.js,tools/andtests/in strict modenpm test(node:test, 63 tests)How it's organised:
index.htmlinto3d.htmlbytools/sync-parser.py. The only difference between the pages, layout spacing, comes fromIS_3D_PAGE.FxNode,FxLink,Step,Graph,Scene,MdDoc,DiagramStyle, plus per-parser types.tests/load-core.mjsevaluates the shared core straight out ofindex.htmlin a Node VM, so the pages stay standalone files and the logic is still unit-testable.tests/parser.snapshot.jsonpins the parsed output (nodes, links, step text) of every example. All typing changes were made against that snapshot, so the parser output did not change except the one bug fix. To accept an intended change, runnpm run test:update.Testing
npm run checkpasses.node server.js, the client and embed links from 2D and 3D load without errors or 404s, both with and without a trailing slash, and inside an iframe.Refs AHL-571.
🤖 Generated with Claude Code