loop: cycle 16 — ✅ regression + acceptance PASS · 1 findings · reach 56.4% - #73
Conversation
|
So merging this PR adds a permanently-failing, unsatisfiable test to The underlying finding is real though: ADR 0013 claims
Recommend re-triaging this finding and picking (1) or (2); I can implement either once you decide. Left unmerged. |
Resolves the cycle-16 finding via Option 2 (owner decision): ADR 0013's claim that "every reported merged stop is a genuine cluster: radius_m <= stop_radius_m" was FALSE. The anchor cap bounds MEMBERSHIP to a disk of radius stop_radius_m around the anchor — diameter 2x — while radius_m is measured from the sample_count-weighted centroid. An asymmetric group (ten dwells 49m east of the anchor, one 49m west) centres 36.8m east and reports radius_m ~86m against stop_radius_m=50. Why not enforce the tighter bound: doing so at full merge reach needs a per-admission recompute against the moving centroid — the O(n^2) blow-up ADR 0011 exists to avoid — and the only O(1) alternative (capping members to ~half the stop radius) would fragment exactly the large-site dwells a big stop_radius_m is for. A warehouse, DC, or port is legitimately one "place" and callers size stop_radius_m (up to 10km) to match; splitting those to flatter a radius bound is the worse answer. So: report the true spread, and make the overshoot impossible to miss. - ADR 0013: withdraw the false guarantee, state the real one (membership within stop_radius_m of the anchor), with the measured counter-example and rationale. - merge_nearby_stops docstring + inline comment: same correction. - StopOut.radius_m: schema description now says it is the true spread, not a bound, and that merged stops can reach ~2x stop_radius_m. - compute_insights: emit a quality issue when a merged stop's radius exceeds the configured stop_radius_m — the finding's real complaint was silence. Only fires when merging is enabled; verified silent otherwise. The cycle-16 test asserted len(stops)==1 AND radius_m<=60, which are mutually exclusive (the input spans 98m, so merging it all gives ~86m; getting <=50m requires splitting). No correct implementation satisfies both, so it now asserts the achievable contract: bounded by the anchor-disk diameter, and flagged whenever it exceeds stop_radius_m. 205 passed; ruff, mypy, openapi + frontend codegen all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Autonomous SDLC cycle 16 against
spec/spec.md.bhulan/has been attacked — gaps inreports/adversary/coverage-gaps.md(a targeting aid, not a KPI)Ranked findings — you decide
Triage — cycle 16 surviving findings
poetry run pytest tests/adversary/ -q→ 1 failed, 65 passed. Onedistinct defect survives this cycle.
test_merge_nearby_stops_anchor_cap_radius_still_balloons.py::test_merged_stop_radius_m_balloons_far_beyond_stop_radius_m/v1/insights, ordinary documentedInsightsOptionsfields (merge_stops_within_m,stop_radius_m), no special payload shapestop_radius_mof the anchor) is merged into a single reported stop whoseradius_m(86m) is a 71% overshoot of the configuredstop_radius_m(50m) — with no error orquality.issuesentry, so a consumer trustingradius_m <= stop_radius_mper ADR 0013 is silently misled.High detail
#1 — Anchor-based merge cap bounds the wrong point, so
radius_mcan approach2x
stop_radius_m(high). ADR 0013's fix tomerge_nearby_stops(
bhulan/analytics/stops.py) caps merge admission by requiring eachcandidate member to lie within
stop_radius_mof the group's anchor (itsfirst member), and the ADR's stated guarantee is the stronger claim that
"every reported merged stop is a genuine cluster:
radius_m <= stop_radius_m... so a downstream 'was the vehicle parked here' consumer can trust the
location and spread" (matching spec.md AC1: "each reported centroid lies
within
stop_radius_mof its own members"). Those are two differentguarantees: bounding every member's distance to the anchor only constrains
membership to a disk of radius
stop_radius_mcentred on the anchor — it saysnothing about where the
sample_count-weighted centroid of an asymmetricgroup within that disk ends up. When ten dwells sit ~49m east of the anchor
and one sits ~49m west (each individually admissible under the cap), the
weighted centroid is pulled toward the heavy east side, and the correctly
computed enclosing
radius_mfrom that centroid to the lone west outlierlegitimately reports ~86m — approaching the disk's full diameter
(
2 * stop_radius_m) rather than staying within it. This is not a contrivedtie-breaking edge case: a single popular location with occasional stops on
its far side is the ordinary shape of any frequently-visited-place track
(e.g., a loading dock approached from two directions), it is reachable
unauthenticated with a single
POST /v1/insightscall using only documentedoptions, and it reproduces exactly the "unbounded blob" symptom ADR 0013 was
written to eliminate — just capped at ~2x
stop_radius_minstead ofunbounded. Ranked high rather than critical because it is a correctness
defect with a bounded (not unbounded) overshoot and no availability/crash
impact, unlike prior cycles' critical findings (e.g. cycle 12's unauthenticated
recursion-crash DoS).
Triage ranks only; nothing is auto-promoted. Pick the findings worth fixing and they become the next cycle's spec. Refuted false positives: see
reports/adversary/refuted-16.md.The build proposed the code changes; you decide. Merge to keep or close to discard. This loop never merges to master and never deploys. bhulan is a public demo — review carefully.