diff --git a/AGENTS-TASKS.md b/AGENTS-TASKS.md index d67dc7c..6226fcb 100644 --- a/AGENTS-TASKS.md +++ b/AGENTS-TASKS.md @@ -1,5 +1,16 @@ # Reporting migration tracker +## Pass 7 — Remove production Python + +- [x] P7.1 Rewrite agent instructions and public commands around Make, shell, jq, PowerShell, and Typst; confine Python to uv-managed tests. +- [x] P7.2 Replace win-diagnostics Python normalization, analysis, and validation without changing contract or rule outcomes. +- [x] P7.3 Replace beffroi-reports Python adaptation and immutable publication while preserving race safety and regeneration guarantees. +- [x] P7.4 Replace Reportist Python validation/rendering while preserving input, asset, overwrite, and standalone behavior. +- [x] P7.5 Remove Python from bootstrap and runtime dependency checks; make uv and Python test-only dependencies. +- [x] P7.6 Run component tests through uv, then verify capture-to-PDF integration without Python on the runtime PATH. + +Validation: 70 component tests pass through uv-managed environments, including all five owning-validator adapter integration tests. The root workflow then performs capture analysis, draft generation, validation, and PDF rendering using only shell, jq, Typst, and the native publication helper. + ## How to use this tracker This is the cross-repository handoff for a migration in several passes. Follow diff --git a/AGENTS.md b/AGENTS.md index 4145223..aaeda54 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -117,6 +117,18 @@ actually owns it. --- +## Implementation constraints + +Production workflows use Make, POSIX-oriented shell, jq, PowerShell where +Windows collection requires it, and Typst. Python is allowed only under test +directories as a test harness or independent oracle; it must never be required +to bootstrap, analyse, adapt, validate, render, package, or publish a report. + +Every Python test invocation must use an environment created by `uv venv` and +synchronized by `uv pip`. Do not invoke system Python or install packages with +`pip` directly. Keep Make targets as the public interface and shell scripts as +thin, inspectable orchestration. + ## Testing Provide at least one integration test using sanitized fixture data: @@ -143,4 +155,4 @@ A developer wanting the complete Beffroi reporting environment can run: and obtain a coherent set of known-compatible tools and reports. -A developer wanting only one component should never need this repository. \ No newline at end of file +A developer wanting only one component should never need this repository. diff --git a/README.md b/README.md index f5a825c..ddbc47f 100644 --- a/README.md +++ b/README.md @@ -47,18 +47,18 @@ For an existing checkout: ``` Bootstrap initializes the exact submodule revisions recorded by this repository, -checks Git, uv, and Typst, and prepares isolated Python 3.11 environments under -`.venv/component-checks/`. It may download submodules, Python, or pinned Python -packages, but it does not install system packages. Use `./bootstrap.sh --check` +checks Git, Make, jq, Typst, and a C compiler, and builds the small atomic +publication helper. It may download submodules but does not install system +packages. Use `./bootstrap.sh --check` for a read-only dependency and pinned-revision check. ### External dependencies | Tool | Supported/tested use | | --- | --- | -| Bash, Git, Make | Workspace scripts, pinned submodules, and high-level commands | -| uv 0.12.13 | Creates Python 3.11 environments and installs locked dependencies | -| Python 3.11.14 | Tested component runtime, selected through uv | +| Bash, Git, Make, jq | Workspace scripts, structured transformations, and high-level commands | +| C compiler | Builds the native atomic no-replace directory publisher | +| uv 0.12.13 and Python 3.11.14 | Test harness only; uv creates and synchronizes every Python environment | | Typst 0.15.1 | PDF compilation; Reportist supports Typst 0.15 or newer | | DejaVu Sans / Sans Mono | Fonts selected by the bundled synthetic examples | | Poppler `pdfinfo` / `pdftotext` | Optional pagination/text inspection in Reportist tests | diff --git a/bootstrap.sh b/bootstrap.sh index 7e27ac5..7076abe 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Initialize pinned components and prepare isolated Python environments. +# Initialize pinned components and check non-Python runtime dependencies. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" @@ -13,12 +13,12 @@ elif [[ $# -ne 0 ]]; then fi missing=() -for command in git uv typst; do +for command in git make jq typst cc; do command -v "$command" >/dev/null 2>&1 || missing+=("$command") done if ((${#missing[@]})); then echo "Missing required tools: ${missing[*]}" >&2 - echo 'Install Git, uv, and Typst, then rerun bootstrap.' >&2 + echo 'Install Git, Make, jq, Typst, and a C compiler, then rerun bootstrap.' >&2 exit 1 fi @@ -40,26 +40,16 @@ while IFS= read -r status; do exit 1 fi done < <(git submodule status --recursive) -for component in diagnostics reporter; do - if [[ ! -f "$component/requirements.txt" ]]; then - echo "Missing dependency lock: $component/requirements.txt" >&2 - exit 1 - fi -done - git --version -uv --version +jq --version typst --version +cc --version | head -n 1 if $check_only; then echo 'Pinned components and required tools are available.' exit 0 fi -for component in diagnostics reporter; do - environment=".venv/component-checks/$component" - uv venv --python 3.11 --allow-existing "$environment" - uv pip sync --python "$environment/bin/python" "$component/requirements.txt" -done +make -C reports build echo 'Bootstrap complete. Run make check or make help.' diff --git a/diagnostics b/diagnostics index 343f505..f93c5d3 160000 --- a/diagnostics +++ b/diagnostics @@ -1 +1 @@ -Subproject commit 343f5055067f97bb23ba2319859351b85a94fcbc +Subproject commit f93c5d308319d3d74b71249880bbfa5a82c7b34f diff --git a/docs/migration-baseline.md b/docs/migration-baseline.md index 90c8c5c..ce93e89 100644 --- a/docs/migration-baseline.md +++ b/docs/migration-baseline.md @@ -7,7 +7,8 @@ Sans Mono fonts. Dependencies are checked, not installed automatically. Choose a new output directory: ```bash -python3 scripts/check-legacy-baseline.py --output /tmp/beffroi-baseline-review +uv venv --python 3.11 --allow-existing .venv/root-tests +uv run --python .venv/root-tests/bin/python tests/check-legacy-baseline.py --output /tmp/beffroi-baseline-review ``` The runner reads an explicit source allowlist from legacy renderer commit diff --git a/reporter b/reporter index b4472e9..76ef076 160000 --- a/reporter +++ b/reporter @@ -1 +1 @@ -Subproject commit b4472e9055fc86045e1eec53100154d89a618035 +Subproject commit 76ef0760891c93c0e6821f5be24b0904091dbcbe diff --git a/reports b/reports index 6a1d1fb..03fc452 160000 --- a/reports +++ b/reports @@ -1 +1 @@ -Subproject commit 6a1d1fb4bdfe93966c057ea1ec72dc5c5f0044ca +Subproject commit 03fc452e2bf599e3a44a1528d95961ecf50ea206 diff --git a/scripts/check-components.sh b/scripts/check-components.sh index 62b3d42..ebf0031 100644 --- a/scripts/check-components.sh +++ b/scripts/check-components.sh @@ -8,8 +8,8 @@ command -v uv >/dev/null 2>&1 || { exit 1 } -for component in diagnostics reporter; do - if [[ ! -f "$component/requirements.txt" || ! -f "$component/tests/test_contract.py" ]]; then +for component in diagnostics reporter reports; do + if [[ ! -f "$component/requirements.txt" || ! -d "$component/tests" || ! -f "$component/Makefile" ]]; then echo "Missing $component checks. Run: git submodule update --init --recursive" >&2 exit 1 fi @@ -24,21 +24,16 @@ typst --version uv --version for component in diagnostics reporter; do echo "Checking $component ($(git -C "$component" rev-parse HEAD))" - environment=".venv/component-checks/$component" - uv venv --python 3.11 --allow-existing "$environment" - uv pip sync --python "$environment/bin/python" "$component/requirements.txt" - "$environment/bin/python" --version - "$environment/bin/python" -m unittest discover -s "$component/tests" -p 'test_*.py' -v + make -C "$component" test done echo "Checking reports ($(git -C reports rev-parse HEAD))" -DIAGNOSTIC_VALIDATOR="$(pwd)/diagnostics/tools/validate.py" \ -REPORT_VALIDATOR="$(pwd)/reporter/tools/validate.py" \ +DIAGNOSTIC_VALIDATOR="$(pwd)/diagnostics/tools/validate.sh" \ +REPORT_VALIDATOR="$(pwd)/reporter/tools/validate.sh" \ BRANDING="$(pwd)/reports/config/branding/default.json" \ BRANDING_ROOT="$(pwd)/reports" \ BRANDING_DIRECTORY="$(pwd)/reports/config/branding" \ - .venv/component-checks/reporter/bin/python -m unittest discover \ - -s reports/tests -p 'test_*.py' -v + make -C reports test pipeline_check_parent="$(mktemp -d "${TMPDIR:-/tmp}/beffroi-pipeline-check.XXXXXX")" trap 'rm -rf -- "$pipeline_check_parent"' EXIT @@ -49,9 +44,7 @@ bash scripts/workflow.sh all \ "$pipeline_check_root" \ 2026-09-15T12:00:00Z \ 'Synthetic diagnostic draft' 'CI Test' 2026-09-15 -.venv/component-checks/diagnostics/bin/python -c \ - 'import json,sys; d=json.load(open(sys.argv[1], encoding="utf-8")); assert d["findings"][0]["id"] == "event-service-control-manager-7000"; assert d["findings"][0]["evidence"] == ["event-recent_system_errors-1"]' \ - "$pipeline_check_root/diagnostic.json" +jq -e '.findings[0].id == "event-service-control-manager-7000" and .findings[0].evidence == ["event-recent_system_errors-1"]' "$pipeline_check_root/diagnostic.json" >/dev/null test "$(head -c 5 "$pipeline_check_root/report.pdf")" = '%PDF-' echo 'Raw-capture analysis, adapter, and PDF pipeline passed. Native collection and non-event health checks remain.' diff --git a/scripts/workflow.sh b/scripts/workflow.sh index d19fa3e..aa0d8ee 100755 --- a/scripts/workflow.sh +++ b/scripts/workflow.sh @@ -21,20 +21,13 @@ require_values() { done } -diagnostic_python=.venv/component-checks/diagnostics/bin/python -report_python=.venv/component-checks/reporter/bin/python -for executable in "$diagnostic_python" "$report_python"; do - [[ -x "$executable" ]] || { - echo "Missing prepared environment: $executable" >&2 - echo 'Run ./bootstrap.sh first.' >&2 - exit 1 - } -done +for executable in jq typst; do command -v "$executable" >/dev/null || { echo "Missing runtime dependency: $executable" >&2; exit 1; }; done +[[ -x reports/build/publish-exclusive ]] || make -C reports build analyse() { [[ $# -eq 4 ]] || usage require_values "$@" - "$diagnostic_python" diagnostics/tools/analyse.py "$1" \ + bash diagnostics/tools/analyse.sh "$1" \ --evidence-root "$2" --output "$3" --reference-time "$4" \ --producer-version "$(git -C diagnostics rev-parse HEAD)" } @@ -42,12 +35,12 @@ analyse() { draft() { [[ $# -eq 6 ]] || usage require_values "$@" - "$report_python" reports/tools/diagnostic-to-report.py \ + bash reports/tools/diagnostic-to-report.sh \ --diagnostic "$1" --evidence-root "$2" --output-dir "$3" \ --title "$4" --author "$5" --date "$6" \ --generator-version "$(git -C reports rev-parse HEAD)" \ - --diagnostic-validator diagnostics/tools/validate.py \ - --report-validator reporter/tools/validate.py \ + --diagnostic-validator "$(pwd)/diagnostics/tools/validate.sh" \ + --report-validator "$(pwd)/reporter/tools/validate.sh" \ --branding reports/config/branding/default.json \ --branding-root reports } @@ -55,7 +48,7 @@ draft() { render() { [[ $# -eq 2 ]] || usage require_values "$@" - "$report_python" reporter/tools/render.py "$1" --output "$2" + bash reporter/tools/render.sh "$1" --output "$2" } command_name="${1:-}" diff --git a/scripts/check-legacy-baseline.py b/tests/check-legacy-baseline.py similarity index 100% rename from scripts/check-legacy-baseline.py rename to tests/check-legacy-baseline.py