feat(manifold): add outcome compatibility guard and conditional market rejection
CI/CD / build-and-push (push) Successful in 7s
CI/CD / build-and-push (push) Successful in 7s
Reject false-positive matches where Jaccard overlap is high but the outcome is not equivalent (e.g. Poly nomination vs Manifold "If X is nominee, will he win"). - _is_conditional(): detect conditional Manifold markets (If/Conditional on/ Assuming/Given that prefixes + mid-sentence " if ...," clauses) -> reject with reason "conditional_market". - _classify_outcome(): classify into nomination|primary_win|general_win| conditional|other; reject when poly/mfld types differ or either is conditional -> reason "outcome_mismatch: poly=... manifold=...". - Persist poly_outcome_type/mfld_outcome_type on ManifoldMatchResult, in manifold_match_audit (CREATE + idempotent ALTER), save_manifold_audit() and the bayesian call site. - Tests covering classification, conditional detection and the Graham Platner regression (now rejected); valid nomination<->nomination still accepted. Untouched: _MATCH_THRESHOLD (0.40), MANIFOLD_LOGODDS_WEIGHT, edge thresholds, exposure, trading logic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+6
-2
@@ -530,6 +530,8 @@ class Database:
|
||||
match_score: Optional[float],
|
||||
match_reason: Optional[str],
|
||||
match_status: str,
|
||||
poly_outcome_type: Optional[str] = None,
|
||||
mfld_outcome_type: Optional[str] = None,
|
||||
) -> None:
|
||||
async with self._pool.acquire() as conn:
|
||||
await conn.execute("""
|
||||
@@ -537,13 +539,15 @@ class Database:
|
||||
id, poly_market_id, poly_question, search_query,
|
||||
mfld_market_id, mfld_market_title, mfld_market_url,
|
||||
prob_raw, prob_final, inverted,
|
||||
match_score, match_reason, match_status, used_in_trade
|
||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,FALSE)
|
||||
match_score, match_reason, match_status, used_in_trade,
|
||||
poly_outcome_type, mfld_outcome_type
|
||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,FALSE,$14,$15)
|
||||
""",
|
||||
audit_id, poly_market_id, poly_question, search_query,
|
||||
mfld_market_id, mfld_market_title, mfld_market_url,
|
||||
prob_raw, prob_final, inverted,
|
||||
match_score, match_reason, match_status,
|
||||
poly_outcome_type, mfld_outcome_type,
|
||||
)
|
||||
|
||||
async def mark_manifold_audit_used(self, audit_id: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user