Repository navigation
🔧 update: streamline compilation and report excessive nesting - #11
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The optimizations preserve documented contracts and have focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Streamlines compilation while preserving output and adding graceful handling for excessively nested Markdown.
Changes:
- Caches validated assets and removes redundant Markdown tree cloning.
- Converts stack overflows from deep content into
CONTENT_TOO_DEEPdiagnostics. - Adds regression and packed-runtime coverage.
| File | Description |
|---|---|
src/links.ts |
Reuses validated assets and simplifies error handling. |
src/markdown.ts |
Removes raw HTML during parsing and avoids tree cloning. |
src/index.ts |
Reports excessive nesting atomically. |
src/project.ts |
Removes unused internal fields. |
tests/compile.test.ts |
Covers asset reuse and validation. |
tests/markdown.test.ts |
Verifies HTML removal and tree stability. |
scripts/smoke.mjs |
Exercises nesting failures in packed Node consumers. |
README.md |
Documents the new diagnostic. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
warengonzaga
left a comment
There was a problem hiding this comment.
Clean Workflow review completed for 00fed4d against dev@b2753008a3f32963e586086e8121607bc0228c3d. No actionable findings remain.
The final diff preserves asset/path validation, route precedence, per-reference image restrictions, sanitized HTML, deterministic output, and atomic failure behavior. The stack-overflow diagnostic is narrowly scoped and does not mask unrelated errors.
Verification: 92 tests / 300 assertions, lint, typecheck, build, dependency audit, exact-output benchmark comparisons, and the same packed build on Node 22.0.0, 22.16.0, 24.21.0, and 26.10.0. GitHub Node 22/24/26 checks and CodeQL passed. Copilot completed on this head with no findings; all review/comment/thread collections were fetched and no unresolved threads remain. GitHub reports CLEAN and MERGEABLE.
Package/release jobs are intentionally skipped for this PR. Source security review does not establish general CPU/memory limits for arbitrarily large documents.
Repeated asset references previously rechecked the same file, and every rendered page deep-copied its Markdown tree. Reuse successfully validated assets within each compilation and remove the redundant tree copy while preserving routes, diagnostics, sanitization, and rendered output. Remove unused internal project fields and unreachable error handling.
Excessive Markdown nesting now returns a source-attributed
CONTENT_TOO_DEEPdiagnostic instead of an unhandled stack-overflow exception. Other errors still propagate, and failed compilations never return a partial site.Validation: