Skip to content

🔧 update: streamline compilation and report excessive nesting - #11

Merged
warengonzaga merged 1 commit into
devfrom
refactor/streamline-engine
Oct 6, 2026
Merged

warengonzaga merged 1 commit into
devfrom
refactor/streamline-engine

Conversation

@warengonzaga

Copy link
Copy Markdown
Member

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_DEEP diagnostic instead of an unhandled stack-overflow exception. Other errors still propagate, and failed compilations never return a partial site.

Validation:

  • Lint, TypeScript, build, and 92 tests / 300 assertions pass; dependency audit reports no known vulnerabilities.
  • The same packed build passes Node 22.0.0, 22.16.0, 24.21.0, and 26.10.0, including parsing/rendering overflow fixtures.
  • Synthetic 120-page Node 24 benchmarks preserve exact output: article median 708.4 → 608.2 ms; repeated-image median 1042.6 → 747.1 ms. Asset realpath/stat calls fall from 2,400 each to one each per compilation. Local timings vary by workload and environment.
  • Independent source security and maintainability reviews found no remaining actionable findings in scope.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:57
@warengonzaga warengonzaga added refactor [Type] Code improvement without changing functionality [PRs] performance [Type] Optimization, speed, or resource usage improvements [issues, PRs] security [Type] Security vulnerability or hardening [issues, PRs] core [Area] Core logic, business rules, and primary functionality [issues, PRs] labels Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_DEEP diagnostics.
  • 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 warengonzaga left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@warengonzaga warengonzaga added the ready [Status] Triaged and ready to be picked up [issues] label Oct 6, 2026
@warengonzaga
warengonzaga merged commit a53efd7 into dev Oct 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Area] Core logic, business rules, and primary functionality [issues, PRs] performance [Type] Optimization, speed, or resource usage improvements [issues, PRs] ready [Status] Triaged and ready to be picked up [issues] refactor [Type] Code improvement without changing functionality [PRs] security [Type] Security vulnerability or hardening [issues, PRs]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants