Surfaced by the independent review of #126 (#117). PRE-EXISTING (not introduced by #126), tracked here for a proper fix.
Problem. api/routers/athlete.py:set_signature writes/upserts FitnessSignature rows directly, bypassing the sanctioned record_signature() seam, and never sets effective_to. So writing a NEW effective_date for the same sport does not close the prior open interval → two FitnessSignature rows with NULL effective_to for the same sport (a latent GBO-R27 double-open-interval).
Why it is currently latent, not active-wrong. Both resolvers (_effective_signature, analytics _load_effective_signature) use ORDER BY effective_date DESC LIMIT 1, so the latest-effective threshold still resolves correctly. The stale uncloseable interval only surfaces in signature history hygiene, not in #117/#126 behavior (which is correct and merged).
Why it was deferred. Naively routing set_signature through record_signature() invokes _refuse_overlapping, which refuses same-date/back-dated writes — breaking the GBO-R26/API-R52 same-date in-place idempotency pinned by test_set_signature_is_idempotent_on_same_effective_date. So this needs a design that BOTH preserves same-date in-place idempotency AND closes the prior open interval on a new effective_date.
Acceptance. A new effective_date for the same sport closes the prior interval (single open interval per sport); same-date write stays idempotent in place; spec GBO-R27 / API-R52 correspondence extended; non-vacuous tests.
Surfaced by the independent review of #126 (#117). PRE-EXISTING (not introduced by #126), tracked here for a proper fix.
Problem.
api/routers/athlete.py:set_signaturewrites/upsertsFitnessSignaturerows directly, bypassing the sanctionedrecord_signature()seam, and never setseffective_to. So writing a NEWeffective_datefor the same sport does not close the prior open interval → twoFitnessSignaturerows with NULLeffective_tofor the same sport (a latent GBO-R27 double-open-interval).Why it is currently latent, not active-wrong. Both resolvers (
_effective_signature, analytics_load_effective_signature) useORDER BY effective_date DESC LIMIT 1, so the latest-effective threshold still resolves correctly. The stale uncloseable interval only surfaces in signature history hygiene, not in #117/#126 behavior (which is correct and merged).Why it was deferred. Naively routing
set_signaturethroughrecord_signature()invokes_refuse_overlapping, which refuses same-date/back-dated writes — breaking the GBO-R26/API-R52 same-date in-place idempotency pinned bytest_set_signature_is_idempotent_on_same_effective_date. So this needs a design that BOTH preserves same-date in-place idempotency AND closes the prior open interval on a new effective_date.Acceptance. A new effective_date for the same sport closes the prior interval (single open interval per sport); same-date write stays idempotent in place; spec GBO-R27 / API-R52 correspondence extended; non-vacuous tests.