feat(regression): repoint the build + generators at DATASET_DIR/regression (S2-E2) - #153
Conversation
…ssion (S2-E2) The dataset now carries the validated regression reports (kayak_data #15/#16), but the build still rendered them from the engine's docs/regression/. E2 repoints the read at the dataset so the served reports come from where they're owned + validated. - web/build/deploy.py: _deploy_regression_artifacts reads DATASET_DIR/"regression" (was BASE_DIR/"docs"/"regression"); DATASET_DIR added to the kayak.config import; docstrings updated. The missing-dir early-return ("none configured") is unchanged, so a dataset without regression/ serves no reports rather than failing. - scripts/regression/gauge_pair_linear.py + gauge_lead_lag.py: --out now defaults to $DATASET_DIR/regression/<name>.md when DATASET_DIR is set in the env, via a new _resolve_out() helper using stdlib os.environ only — the "no kayak imports / runnable without the venv" standalone contract is preserved. The generated calc_expression.note points at regression/<name>.md (dataset-relative). README + docstring examples updated to the DATASET_DIR flow. - scripts/wheel-smoke.sh: build now runs with DATASET_DIR=<fixture> (HOME→$WORK and SUDO_USER cleared so config ignores a dev ~/.config/kayak/.env; no-op in CI) and asserts the fixture report renders + is sanitized under /static/regression/ — exercising the full E2 path end-to-end in the packaged wheel. - tests: the 4 test_deploy_regression_* monkeypatch build_mod.DATASET_DIR and seed base/regression/; add _resolve_out unit tests for both generators. - doc sweep: models.py provenance_slug comment, validate_dataset _check_regression docstring, and docs/live-tree-workflow.md frozen-install table all updated — the regression read is now env-located (DATASET_DIR), off BASE_DIR. Cutover-safe: deploy.sh pulls kayak_data (which has regression/) before it builds, so the read finds the same reports it served from docs/regression (byte-identical). The engine's docs/regression/ copy is now unread by code; E3 deletes it. Verified: full gate green; wheel-smoke renders the fixture report from DATASET_DIR/regression; a real build against kayak_data renders all 25 reports (25 html/svg/json), no <script> leak. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adversarial review — PR #153 (S2-E2: repoint build + generators at DATASET_DIR/regression)Reviewed on the prod host, where the dataset cutover is already in place (kayak_data #15/#16 are pulled — Verdict: clean — ready to merge. The repoint is surgical and the E1 security posture is fully preserved. One low/medium availability hardening note, no blockers. What I verified
Findings1. [Low–Med, availability not security] The build now silently serves no regression reports if 2. [Nit] Deploy-readiness note (for when this lands)E2 is safe to deploy now specifically because the dataset cutover preceded it: the live Net: a faithful, security-preserving cutover with good test/wheel-smoke coverage. Worth the small build-time warning so a stale dataset checkout can't quietly drop the reports. |
Adversarial rereview — PR #153 @
|
Address the S2-E2 review's availability note: the hourly pipeline build doesn't pull kayak_data, so a stale/misconfigured DATASET_DIR checkout (no regression/ directory) would silently publish zero reports even when calc rows declare provenance_slugs. Surface that as a build-time warning, the parallel to validate-dataset's deploy-time slug↔dir check. _build_to_dir counts the non-empty CalcExpression.provenance_slug rows and threads the count through _deploy_source_files → _deploy_static_assets → _deploy_regression_artifacts; the missing-dir early return warns via the extracted _warn_regression_dir_missing helper (keeps the deploy function under the C901 complexity limit). A dataset that simply ships no reports (zero slugs) stays silent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Addressed the availability note (non-blocking suggestion) in 2f2a086. What it does: This is the build-time parallel to The warning lives in an extracted |
Adversarial re-review — PR #153 (after
|
Adversarial rereview — PR #153 after
|
…reading Address the re-review's optional residual: the prior test exercised only the leaf (_deploy_regression_artifacts with an explicit count), not that the count is actually computed from the DB or threaded through the deploy hops. Extract the inline provenance_slug count into a _count_regression_slugs(session) helper (also tidies _build_to_dir) and unit-test it — including the NULL and whitespace-only slug edge cases that must not count. Add a threading test that drives the full _deploy_source_files → _deploy_static_assets → _deploy_regression_artifacts chain and asserts the warning fires, closing the untested wiring link between the leaf warn test and _build_to_dir. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Addressed the re-review residuals in 5ddb876. Residual A (optional — end-to-end threading test): done. Two angles, no full-
Together these close the gap between the leaf-level warn test and Residual B (empty/incomplete Full gate green (ruff/format/mypy/pytest -m 'not slow' → 1543 passed/wheel-smoke/git diff --check). |
…154) E2 (#153) repointed the build at DATASET_DIR/regression/ and the dataset (kayak_data) now owns + validates the 25 published reports, so the engine's in-tree docs/regression/ copy is dead code. Delete it (76 files). - Repoint tests/test_regression.py's real-artifact tests from the deleted docs/regression/ to the committed tests/fixtures/dataset/regression/ so the skipif(not _REAL_*) sanitizer tests keep running (2 fixture stems -> 6 cases) instead of silently dropping to zero once the engine copies are gone. The real 25 reports are sanitizer-gated by kayak_data's own validate CI. - Sweep stale docs/regression/ prose: the markdown-dep comment (pyproject), the pip-audit/markdown-DoS suppression rationale (ci.yml -- input is now dataset-authored but PR-reviewed + rendered/validated at validate-dataset), and two docs/one-offs scripts. docs/one-offs/*.py refs are left untouched. The dataset's regression/README.md gains the report index + lead/lag table in the paired kayak_data PR. Verified: a real build against kayak_data still renders all 25 reports from DATASET_DIR/regression/ (the deleted dir was unread). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
S2-E2 of the regression slice. The dataset now carries the validated reports (kayak_data #15/#16), but
levels buildstill rendered them from the engine'sdocs/regression/. E2 repoints the read at the dataset (DATASET_DIR/regression/) so the served reports come from where they're owned and validated. Engine-only; nokayak_datachange.Changes
web/build/deploy.py):_deploy_regression_artifactsreadsDATASET_DIR / "regression"(wasBASE_DIR / "docs" / "regression");DATASET_DIRadded to thekayak.configimport; docstrings updated. The missing-dir early-return ("none configured") is unchanged — a dataset withoutregression/serves no reports rather than failing.scripts/regression/gauge_pair_linear.py+gauge_lead_lag.py):--outdefaults to$DATASET_DIR/regression/<name>.mdwhenDATASET_DIRis set, via a new_resolve_out()using stdlibos.environonly — the "no kayak imports / runnable without the venv" standalone contract is preserved. The generatedcalc_expression.notenow points atregression/<name>.md(dataset-relative). README/docstring examples updated.DATASET_DIR=<fixture>(HOME→$WORK+SUDO_USERcleared so config ignores a dev~/.config/kayak/.env; no-op in CI) and asserts the fixture report renders + is sanitized under/static/regression/— the full E2 path end-to-end in the packaged wheel.test_deploy_regression_*monkeypatchbuild_mod.DATASET_DIR+ seedbase/regression/;_resolve_outunit tests for both generators.models.pyprovenance_slugcomment, thevalidate_dataset_check_regressiondocstring, anddocs/live-tree-workflow.md's frozen-install table — the regression read is now env-located (DATASET_DIR), offBASE_DIR.Cutover safety
deploy.shpullskayak_data(which hasregression/, from D1) before it builds, so the read finds the same reports it served fromdocs/regression(byte-identical). The engine'sdocs/regression/copy is now unread by code; E3 deletes it.Verified
pytest -m "not slow"(1540 passed) /git diff --check.wheel-smokerenders the fixture report fromDATASET_DIR/regressionand asserts it's sanitized.kayak_datarenders all 25 report stems (25 html/svg/json), no<script>leak — parity with the pre-E2docs/regressionoutput.Follow-up (E3)
Delete
docs/regression/*.{md,svg,json}from the engine; move the report index intokayak_data/regression/README.md; repointtests/test_regression.py's real-artifact tests at the dataset/fixture (else they silently skip once the engine copies are gone).🤖 Generated with Claude Code