Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions devtools/docs_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ def _entry(title: str, path: str, description: str, tier: DocsTier) -> DocsEntry
"Privacy-safe read-only census of cursor and accepted-head readiness evidence.",
"evidence",
),
_entry(
"Topology Live-Proof Residue, 2026-08-06",
"evidence/polylogue-topology-live-proof-2026-08-06.md",
"Candidate topology census, production-route cycle evidence, and unexercised live-archive residue.",
"evidence",
),
_entry(
"Proof Artifacts",
"proof-artifacts.md",
Expand Down
347 changes: 344 additions & 3 deletions devtools/lineage_validation.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Start with **Guides** for a task, **Reference** for a surface contract, and **Ar
|----------|-------------|
| [Demos and Proofs](demos.md) | Reproducible proofs, construct-valid demo doctrine, and flagship demonstrations. |
| [Cursor Authority Census, 2026-08-04](evidence/polylogue-xeck9-cursor-authority-census-2026-08-04.md) | Privacy-safe read-only census of cursor and accepted-head readiness evidence. |
| [Topology Live-Proof Residue, 2026-08-06](evidence/polylogue-topology-live-proof-2026-08-06.md) | Candidate topology census, production-route cycle evidence, and unexercised live-archive residue. |
| [Proof Artifacts](proof-artifacts.md) | Claim-to-proof map for public-facing demo and evidence claims. |
| [README Public-Claims View](generated/public-claims/readme.md) | Generated compact status view for claims used in README-facing copy. |
| [Launch Public-Claims View](generated/public-claims/launch.md) | Generated launch-copy claim status with evidence blockers and remediation refs. |
Expand Down
34 changes: 34 additions & 0 deletions docs/evidence/polylogue-topology-live-proof-2026-08-06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Topology live-proof residue, 2026-08-06

## Scope

This report records the proof surface implemented for `polylogue-topology-live-proof`. The census reuses `devtools workspace lineage-validation` and the production topology write/read seams. The candidate evidence is a frozen test index populated by `write_parsed_session_to_archive`; it is not a claim about the operator's live archive.

## Candidate proof

The candidate fixture contains two resolved links and one unresolved native-parent link, all written through the production writer. The production writer supplies a non-empty method for all three rows. The census derives the ordinary `resolved` and `unresolved` states from `resolved_dst_session_id`, while preserving the nullable raw `status` column contract. The bounded unresolved-parent read sample exercises `read_archive_session_envelope` and proves the child remains child-local: no parent session is composed, and the served message count equals the child-owned count. Each receipt binds the report to the database and any SQLite sidecars by content digest, file identity, and a held read transaction. With a fixed capture time, an unchanged source reproduces the receipt, while a source mutation changes its binding.

| Evidence | Result |
| --- | ---: |
| effective topology states | `resolved=2`, `unresolved=1` |
| empty effective states | `0` |
| empty methods | `0` |
| raw nullable status values | `3` ordinary NULLs, reported transparently |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Pin the raw NULL status count with an assertion, or qualify the claim.

The table records 3 ordinary NULL raw status values for the candidate fixture. No test in this PR asserts raw_status_empty_count for the writer-backed candidate. test_lineage_validation_proves_writer_candidate_and_snapshot_identity asserts the effective status counts and the method counts, but not the raw status count. The effective-state derivation maps a NULL status and an explicit 'unresolved' status to the same value, so the existing assertions cannot distinguish the two cases for the orphan link.

Add assert topology["raw_status_empty_count"] == 3 to that test so the documented number is backed by the same evidence lane as the other rows.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/evidence/polylogue-topology-live-proof-2026-08-06.md` at line 16, Update
test_lineage_validation_proves_writer_candidate_and_snapshot_identity to assert
topology["raw_status_empty_count"] == 3, directly validating the documented raw
NULL status count for the writer-backed candidate.

| unresolved-parent reads sampled | `1` |
| unresolved-parent reads safe | `true` |
| cycle-quarantine evidence in candidate | `0` |
| candidate snapshot stable during census | `true` |

The production-route cycle fixture separately proves a `quarantined` closing edge with `cycle_rejected` evidence. Its census has `resolved=1`, `quarantined=1`, zero empty effective states, zero empty methods, one valid cycle-evidence row, and zero malformed quarantine-evidence rows. Mutations that blank a method, introduce malformed quarantine JSON, or give a quarantined row a resolved parent each make the census fail, and the reader leaves the contradictory quarantined row uncomposed.

## Live residue

No live archive was opened or mutated in this lane. The live database path is outside the assigned worktree and is excluded by the repository operating boundary. Therefore this report does not claim live zero-empty counts, archive convergence, or a post-reindex status distribution. The remaining named follow-up is `polylogue-topology-live-proof`: run the read-only census against the approved live or activated candidate index, retain the generated receipt, and compare `effective_status_counts`, `empty_effective_status_count`, `empty_method_count`, `cycle_evidence_count`, and `unresolved_read_sample`.

## Verification

```text
devtools test tests/unit/devtools/test_lineage_validation.py tests/unit/storage/test_topology_cycle_quarantine_live.py
```

The tests include mutations that blank a method, introduce an unknown status, make an unresolved child claim a parent in `sessions.parent_session_id`, introduce malformed quarantine JSON, and make a quarantined row resolve a parent; each mutation makes the relevant proof fail. The live receipt step was not run, so the live census remains explicitly not observed.
1 change: 1 addition & 0 deletions polylogue/storage/sqlite/archive_tiers/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2797,6 +2797,7 @@ def has_prefix_lineage(self, session_id: str) -> bool:
WHERE src_session_id = ?
AND inheritance = 'prefix-sharing'
AND resolved_dst_session_id IS NOT NULL
AND COALESCE(TRIM(status), '') != 'quarantined'
LIMIT 1
""",
(session_id,),
Expand Down
7 changes: 6 additions & 1 deletion polylogue/storage/sqlite/archive_tiers/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,8 @@ def _union_with_existing_rows(
# changes which messages exist).
is_prefix_sharing_parent = (
conn.execute(
"SELECT 1 FROM session_links WHERE resolved_dst_session_id = ? AND inheritance = 'prefix-sharing' LIMIT 1",
"SELECT 1 FROM session_links WHERE resolved_dst_session_id = ? AND inheritance = 'prefix-sharing' "
"AND COALESCE(TRIM(status), '') != 'quarantined' LIMIT 1",
(session_id,),
).fetchone()
is not None
Expand Down Expand Up @@ -4019,6 +4020,7 @@ def _refresh_session_projection(conn: sqlite3.Connection, session_id: str, *, se
SELECT resolved_dst_session_id, link_type
FROM session_links
WHERE src_session_id = ? AND resolved_dst_session_id IS NOT NULL
AND COALESCE(TRIM(status), '') != 'quarantined'
ORDER BY observed_at_ms IS NULL, observed_at_ms, dst_origin, dst_native_id, link_type
LIMIT 1
""",
Expand Down Expand Up @@ -5700,6 +5702,7 @@ def own_signatures(target_session_id: str) -> list[tuple[str, str]]:
AND inheritance = 'prefix-sharing'
AND resolved_dst_session_id IS NOT NULL
AND branch_point_message_id IS NOT NULL
AND COALESCE(TRIM(status), '') != 'quarantined'
LIMIT 1
""",
(cursor_session_id,),
Expand Down Expand Up @@ -6104,6 +6107,7 @@ def _repair_stale_prefix_branch_points_db(
WHERE l.inheritance = 'prefix-sharing'
AND l.resolved_dst_session_id IS NOT NULL
AND l.branch_point_message_id IS NOT NULL
AND COALESCE(TRIM(l.status), '') != 'quarantined'
{scope_clause}
AND NOT EXISTS (
SELECT 1 FROM messages m
Expand Down Expand Up @@ -6430,6 +6434,7 @@ def _prefix_sharing_edge_sync(conn: sqlite3.Connection, session_id: str) -> tupl
AND inheritance = 'prefix-sharing'
AND resolved_dst_session_id IS NOT NULL
AND branch_point_message_id IS NOT NULL
AND COALESCE(TRIM(status), '') != 'quarantined'
LIMIT 1
""",
(session_id,),
Expand Down
1 change: 1 addition & 0 deletions polylogue/storage/sqlite/queries/message_query_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async def _prefix_sharing_edge(conn: aiosqlite.Connection, session_id: str) -> t
AND inheritance = 'prefix-sharing'
AND resolved_dst_session_id IS NOT NULL
AND branch_point_message_id IS NOT NULL
AND COALESCE(TRIM(status), '') != 'quarantined'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Quarantine before slicing the inherited prefix

When re-ingesting session A with parent B would close a cycle and A's payload begins with messages copied from B, _extract_prefix_tail runs before _resolve_outbound_session_links detects and quarantines the cycle, so A is already stored as a divergent tail. This new predicate then refuses to compose B, causing both sync and async reads of A to silently omit the sliced prefix. Unlike the earlier contradictory-row case, the production writer can create this state with resolved_dst_session_id still NULL; detect the cycle before slicing or restore the removed prefix when quarantining.

AGENTS.md reference: AGENTS.md:L93-L97

Useful? React with 👍 / 👎.

@Sinity Sinity Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in follow-up PR #3858. Commits 9341993 and f3212f2 classify the proposed parent before prefix-tail extraction and preserve the complete child-owned transcript for cycle quarantine and bounded-walk exhaustion. Production sync and async reader regressions cover the route.

LIMIT 1
""",
(session_id,),
Expand Down
Loading