Skip to content

feat(compile_formal_docs): mirror docs/ subtree so formal docs can embed assets#15

Open
abitofhelp wants to merge 2 commits into
mainfrom
feat/compile-formal-docs-diagram-assets
Open

feat(compile_formal_docs): mirror docs/ subtree so formal docs can embed assets#15
abitofhelp wants to merge 2 commits into
mainfrom
feat/compile-formal-docs-diagram-assets

Conversation

@abitofhelp
Copy link
Copy Markdown
Owner

Summary

Merges the compile_formal_docs feature into hybrid_scripts_python main.
Two commits, dated 2026-05-15:

  • feat(compile_formal_docs): mirror the docs/ subtree so formal docs can
    embed asset files.
  • test(compile_formal_docs): typst-free check of --root and the mirror
    mechanics.

Why this must be merged, not dropped

This branch was reviewed as a cleanup candidate. It is not disposable:
makefile/compile_formal_docs.py is already referenced by the
hybrid_lib_ada and hybrid_app_ada Makefiles
and is present in their
scripts/python/shared submodule checkouts. hybrid_scripts_python is the
shared-submodule source repo for that script; leaving these commits only on
an unmerged branch means main lags the script its consumers already depend
on. Merging brings main into sync with what the hybrid starters use.

Scope

makefile/compile_formal_docs.py + tests/test_compile_formal_docs.py only.
Shared-submodule source change — consumers pick it up on their next
git submodule update --remote.

…bed assets

adafmt#56 needs the SDS to embed architecture diagrams via
image("../diagrams/foo.svg").  The previous build copied .typ sources
flat into the temp directory, so any ../<dir>/ asset reference pointed
outside the Typst project root — typst rejected it with
"cannot read file outside of project root".

Fix: mirror the project's whole docs/ subtree into the temp build
(generated *.pdf excluded — build outputs, not inputs), overlay the
shared templates next to the mirrored .typ sources, and compile each
document with `--root` at the docs mirror.  Cross-directory asset
references now resolve while #import "core.typ" (a same-directory
import) still works.

This is a general docs-asset solution: any asset under docs/ is
reachable, not just docs/diagrams/.  No project-specific special case.

Tests: tests/test_compile_formal_docs.py — find_project_root, dry-run,
plain-doc compile (regression guard), embedded-diagram compile (the
adafmt#56 regression — fails pre-fix with the outside-root error),
and stale-PDF-in-docs tolerance.  typst-dependent tests skip cleanly
when typst is absent.  Full suite 139 passing.

Refs: adafmt#56
…chanics

GPT PR #14 review suggested a non-typst test so the docs-mirror
mechanics stay covered on runners without typst installed.  Monkeypatches
subprocess.run and asserts the compile command is rooted at the docs
mirror, the .typ source is mirrored under <root>/formal/, and the
sibling diagram asset is mirrored under <root>/diagrams/ at invocation
time.

Refs: adafmt#56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant