seam: PH6.6's /metrics solver_run test updated for PH1.2 (solver_run now exists) #67
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patrick/Polaris#67
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Discovered while building PH1.2 (#10,
feature/db-schema-planning).backend/tests/integration/api/test_metrics_db.pyandbackend/src/polaris/api/metrics.pyare outside PH1.2's owned paths (backend/alembic/versions/**,backend/src/polaris/db/models/**) — they belong to PH6.6 (#47, already merged) — but PH1.2's whole purpose (creating thesolver_runtable) breaks a pre-existing PH6.6 test by design, so I fixed the test directly in the PH1.2 PR (#66) rather than leave a regression or widen the ticket, per the seam-request process in CLAUDE.md (mirroring issue #57 from PH1.1).What was stale:
api/metrics.py::_render_solver_metricswas written "best-effort" againstsolver_runnot existing yet (sa_inspect(bind).has_table("solver_run")gates the whole function), with a comment: "once the migration lands these lines start appearing with no further change here." The matching test,test_metrics_omits_solver_run_lines_when_table_does_not_exist_yet, asserted"polaris_solver_run_total" not in resp.text— but once the table exists (even empty), the function always emits the# HELP/# TYPEheader lines forpolaris_solver_run_total, which contain that exact substring, so the assertion fails against a real, correct, empty-table render.Fix (already in PH1.2's PR,
backend/tests/integration/api/test_metrics_db.py): no change toapi/metrics.pyitself — the module's own docstring already anticipated this and needed nothing further. The test was split into two:test_metrics_renders_solver_run_gauges_when_table_is_empty: asserts the HELP/TYPE headers and a zero-valuedpolaris_solver_run_duration_seconds_avgline appear, but no per-statuspolaris_solver_run_total{status=...}line, whensolver_runhas no rows.test_metrics_reports_solver_run_counts_against_running_postgres: inserts a couple ofSolverRunrows and asserts the per-status counter lines render correctly, exercising the query path PH6.6 could previously only test as "never runs, table absent".Also updated
tests/integration/db/test_migrations.py: the PH1.1 testtest_0002_upgrade_then_downgrade_minus_one_round_tripsdowngraded-1fromheadto check0002's round-trip — now thatheadis0003, that no longer tests what its name says. Changed it to upgrade explicitly to0002first, and addedtest_0003_upgrade_then_downgrade_minus_one_round_tripsas the0003equivalent athead. This file is squarely within PH1.1/PH1.2's ownOwnscolumn (it's the test companion tobackend/alembic/versions/**), not a seam, but noting it here for the same traceability reason.No action needed unless another session already has local changes to
api/metrics.pyortests/integration/api/test_metrics_db.pyon a different branch. Opened for traceability, not as a blocker (already resolved in #66).