-
Notifications
You must be signed in to change notification settings - Fork 1
fix(preflight): classify blocked replay evidence #3905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e2d5531
f095128
4c75565
21e805f
fd99263
67ae58e
d9138a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,15 +114,15 @@ def _source_distribution(root: Path) -> dict[str, object]: | |
| c.status AS census_status, | ||
| CASE WHEN c.raw_id IS NULL THEN 1 ELSE 0 END AS coverage_unknown, | ||
| CASE WHEN c.status IN ('failed', 'non_session') THEN 1 ELSE 0 END AS terminal, | ||
| CASE WHEN (r.parse_error IS NOT NULL AND TRIM(r.parse_error) != '') | ||
| CASE WHEN r.parse_error IS NOT NULL | ||
| OR LOWER(COALESCE(r.validation_status, '')) = 'failed' | ||
| THEN 1 ELSE 0 END AS failure, | ||
| CASE WHEN c.status = 'complete' AND c.member_count > 0 THEN 1 ELSE 0 END AS census_eligible | ||
| FROM raw_sessions AS r | ||
| LEFT JOIN raw_membership_census AS c ON c.raw_id = r.raw_id | ||
| ) | ||
| SELECT origin, COUNT(*), COALESCE(SUM(blob_size), 0), | ||
| COALESCE(SUM(parse_error IS NOT NULL AND TRIM(parse_error) != ''), 0), | ||
| COALESCE(SUM(parse_error IS NOT NULL), 0), | ||
| COALESCE(SUM(validation_status = 'failed'), 0), | ||
| COALESCE(SUM(revision_authority = 'quarantined'), 0), | ||
| COALESCE(SUM(CASE WHEN revision_authority = 'quarantined' THEN blob_size ELSE 0 END), 0), | ||
|
|
@@ -149,7 +149,7 @@ def _source_distribution(root: Path) -> dict[str, object]: | |
| totals = conn.execute( | ||
| """ | ||
| SELECT COUNT(*), COALESCE(SUM(blob_size), 0), | ||
| COALESCE(SUM(parse_error IS NOT NULL AND TRIM(parse_error) != ''), 0), | ||
| COALESCE(SUM(parse_error IS NOT NULL), 0), | ||
| COALESCE(SUM(LOWER(COALESCE(validation_status, '')) = 'failed'), 0), | ||
| COALESCE(SUM(revision_authority = 'quarantined'), 0), | ||
| COALESCE(SUM(CASE WHEN revision_authority = 'quarantined' THEN blob_size ELSE 0 END), 0), | ||
|
|
@@ -365,19 +365,29 @@ def _replay_preflight(root: Path, *, limit: int) -> dict[str, object]: | |
| ) | ||
| candidate_count = _count(payload.get("candidate_count")) | ||
| blocked_count = _count(payload.get("blocked_candidate_count")) | ||
| state = "fail" if candidate_count else "warn" if blocked_count else "pass" | ||
| executable_component_count = _count(payload.get("executable_authority_component_count")) | ||
| # ``candidate_count`` counts raw rows, while ``blocked_candidate_count`` | ||
| # includes authority/resource debt. The backlog already computes the | ||
| # executable authority-component population, so use that typed relation | ||
| # to distinguish executable work from blocked-only work. | ||
| state = ( | ||
| "fail" if executable_component_count else "warn" if blocked_count else "unknown" if candidate_count else "pass" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Fresh evidence in this head is the new AGENTS.md reference: AGENTS.md:L480-L482 Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an unclassified replay candidate coexists with any unrelated adoption-deferred or byte-authority-pending row, this ordering returns Useful? React with 👍 / 👎. |
||
| ) | ||
| return _status( | ||
| state=state, | ||
| reason=( | ||
| "executable raw replay candidates remain" | ||
| if state == "fail" | ||
| else "raw replay candidates are authority/resource blocked" | ||
| if state == "warn" | ||
| else "raw replay candidates lack executable or blocked classification" | ||
| if state == "unknown" | ||
| else None | ||
| ), | ||
| available=True, | ||
| candidate_count=candidate_count, | ||
| blocked_candidate_count=blocked_count, | ||
| executable_authority_component_count=executable_component_count, | ||
| authority_quarantined_count=_count(payload.get("authority_quarantined_count")), | ||
| evidence=payload, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,10 +120,7 @@ def read_raw_failure_lifecycle(source_db: Path, *, sample_limit: int = 10) -> Ra | |
| if raw_table is None: | ||
| return RawFailureLifecycleSnapshot(False, reason="source.db is missing raw_sessions") | ||
| parse_failures = int( | ||
| conn.execute( | ||
| "SELECT COUNT(*) FROM raw_sessions WHERE parse_error IS NOT NULL AND TRIM(parse_error) != ''" | ||
| ).fetchone()[0] | ||
| or 0 | ||
| conn.execute("SELECT COUNT(*) FROM raw_sessions WHERE parse_error IS NOT NULL").fetchone()[0] or 0 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a durable raw has an empty or whitespace-only AGENTS.md reference: AGENTS.md:L37-L40 Useful? React with 👍 / 👎. |
||
| ) | ||
|
Comment on lines
122
to
124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For a raw row whose AGENTS.md reference: AGENTS.md:L37-L40 Useful? React with 👍 / 👎. |
||
| validation_failures = int( | ||
| conn.execute("SELECT COUNT(*) FROM raw_sessions WHERE validation_status = 'failed'").fetchone()[0] or 0 | ||
|
|
@@ -138,7 +135,7 @@ def read_raw_failure_lifecycle(source_db: Path, *, sample_limit: int = 10) -> Ra | |
| SELECT r.raw_id, r.origin, r.source_path, r.source_index, | ||
| r.validation_status, r.acquired_at_ms | ||
| FROM raw_sessions AS r | ||
| WHERE (r.parse_error IS NOT NULL AND TRIM(r.parse_error) != '') | ||
| WHERE r.parse_error IS NOT NULL | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a raw has an empty or whitespace-only AGENTS.md reference: AGENTS.md:L37-L40 Useful? React with 👍 / 👎. |
||
| OR r.validation_status = 'failed' | ||
| ) | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For an empty or whitespace-only
parse_error, this changed predicate now reports a parse failure and actionable source debt, while theraw_failure_lifecyclecheck included in the same ledger still selects onlyparse_error IS NOT NULL AND TRIM(parse_error) != ''(polylogue/storage/raw_failure_lifecycle.py:122-142) and therefore reports zero failures and a healthy lifecycle. The exact report can consequently present two contradictory failure universes, and downstream lifecycle consumers continue treating the newly recognized evidence as clean; define the non-null failure semantics in the shared lifecycle authority and consume it here rather than changing only this projection.AGENTS.md reference: AGENTS.md:L37-L40
Useful? React with 👍 / 👎.