Appearance
ADR-105: Codebase Cleanup, Test Pipeline Fixes, and Documentation Preflight Standardization
- Status: Accepted
- Date: 2026-08-20
- Authors: @fderuiter
- Deciders: @fderuiter
- Requirements: PRD-SYS-001
1. Context & Problem Statement
During repository maintenance and continuous verification runs, several test, lint, and documentation pipeline execution issues were identified:
apps/designer/rendering.pyimportedweasyprintat the top level, causing C-library loading failures (libgobject-2.0-0/libpango) during module imports and pytest test collection on systems where WeasyPrint dependencies are absent.apps/etmfmodules andapps/execution/database/models.pyhad unformatted import blocks flagged by RuffI001.apps/webVitest tests failed due to missingwindow.localStoragemethods in jsdom test environments.package.json'scheckscript referenced a non-existentcheck-links.jsscript in thescriptsdirectory.
2. Decision Drivers & Constraints
- Driver 1: 100% automated test suite pass rate across Python (
pytest) and Vue/JS (vitest) environments. - Driver 2: Strict compliance with GxP verification gates defined in
AGENTS.md. - Driver 3: Hermeticity of documentation portal builds without unhandled missing script references.
3. Options Considered
Option 1: Require system-level C dynamic library installations on all execution environments
- Overview: Force all developer workstations and CI containers to install
gobjectandpango. - Pros:
- ✅ Avoids modifying
rendering.py.
- ✅ Avoids modifying
- Cons:
- ❌ Breaks portability across minimal development environments and non-PDF rendering pipelines.
Option 2: Lazy loading of WeasyPrint and Vitest setup polyfills (Selected)
- Overview: Import
weasyprintlazily insiderender_protocol_to_pdf(), add a Vitestsetup.jsforwindow.localStorage, and clean uppackage.jsonscript dependencies. - Pros:
- ✅ Preserves full test suite collection across all 137 test modules without requiring C shared library dependencies during module import.
- ✅ Resolves all frontend Vitest failures.
- ✅ Ensures
pnpm checkandnode scripts/build-docs.jsrun smoothly.
- Cons:
- ❌
weasyprintimport errors surface at PDF render time rather than import time.
- ❌
4. Decision Outcome
- Chosen Option: Option 2
- Justification: Lazy loading WeasyPrint decouples general API server initialization and test suite collection from platform-specific C shared library loading. Adding a dedicated Vitest setup file ensures standard browser Storage APIs are consistently available across all frontend tests.
5. Consequences & Trade-offs
- Positive Impact: All 137 Python test files, 15 frontend Vitest suites, schema compilers, and VitePress docs builders execute cleanly.
- Negative Impact / Technical Debt: None.
6. Implementation & Verification
- Affected Repositories / Services:
apps/designer,apps/etmf,apps/execution,apps/web,scripts/,docs/. - Verification Plan: Verified via
uv run ruff check,uv run pytest,pnpm -r test,uv run python scripts/validate_schemas.py, andnode scripts/build-docs.js.