feat(manifold): add matcher versioning to separate legacy accepted matches from v3_outcome_guard metrics
CI/CD / build-and-push (push) Successful in 9s
CI/CD / build-and-push (push) Successful in 9s
Add MANIFOLD_MATCHER_VERSION="v3_outcome_guard" tag persisted to manifold_match_audit.matcher_version so metrics can isolate current-matcher stats from pre-versioning records, whose accepted matches the outcome guard would now reject. - schema: add matcher_version column + index; idempotent startup backfill tagging NULL rows as legacy_pre_outcome_guard (no outcome types) or v2_outcome_guard_no_version (has outcome type, version not persisted) - save_manifold_audit: write matcher_version on every new record - get_manifold_matches: split summary into current_version / all_time / legacy; recent_matches now carry matcher_version Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -220,6 +220,36 @@ CREATE INDEX IF NOT EXISTS idx_mfld_audit_poly_mkt ON manifold_match_audit(poly
|
||||
ALTER TABLE manifold_match_audit ADD COLUMN IF NOT EXISTS poly_outcome_type TEXT;
|
||||
ALTER TABLE manifold_match_audit ADD COLUMN IF NOT EXISTS mfld_outcome_type TEXT;
|
||||
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
-- Matcher versioning — separate current-matcher metrics from legacy records
|
||||
--
|
||||
-- matcher_version tags each audit row with the matcher that produced it
|
||||
-- (MANIFOLD_MATCHER_VERSION in bot/data/manifold.py). This lets the metrics
|
||||
-- endpoint isolate current_version stats from pre-versioning records, whose
|
||||
-- accepted matches would now be rejected by the outcome-compatibility guard.
|
||||
--
|
||||
-- Backfill is one-shot and idempotent (only touches NULL matcher_version rows):
|
||||
-- * rows with no outcome types → 'legacy_pre_outcome_guard' (pre outcome-guard;
|
||||
-- accepted without any outcome-type validation)
|
||||
-- * rows with an outcome type → 'v2_outcome_guard_no_version' (existed between
|
||||
-- the outcome-guard and this versioning; real version not persisted)
|
||||
-- We tag rather than infer the exact version that wasn't recorded.
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
ALTER TABLE manifold_match_audit ADD COLUMN IF NOT EXISTS matcher_version TEXT;
|
||||
|
||||
UPDATE manifold_match_audit
|
||||
SET matcher_version = 'legacy_pre_outcome_guard'
|
||||
WHERE matcher_version IS NULL
|
||||
AND poly_outcome_type IS NULL
|
||||
AND mfld_outcome_type IS NULL;
|
||||
|
||||
UPDATE manifold_match_audit
|
||||
SET matcher_version = 'v2_outcome_guard_no_version'
|
||||
WHERE matcher_version IS NULL
|
||||
AND (poly_outcome_type IS NOT NULL OR mfld_outcome_type IS NOT NULL);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_mfld_audit_version ON manifold_match_audit(matcher_version);
|
||||
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
-- Metric exclusion — administrative closure flag
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user