Skip to content

refactor: split classify_raw_revision_cohort's identity-split flag - #3645

Merged
Sinity merged 2 commits into
masterfrom
feature/storage/split-classify-raw-revision-cohort-flag
Aug 3, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/storage/split-classify-raw-revision-cohort-flag

Conversation

@Sinity

@Sinity Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

classify_raw_revision_cohort's check_source_path_identity_split: bool parameter answered two semantically distinct questions that happened to share one flag: whether to apply the source-path cross-key divergent-evidence guard. Its own docstring stated the heuristic is sound for one caller and unsound for the other, so every caller had to independently get the right literal right. This PR replaces the single flag with two named entry points.

Problem

polylogue/storage/sqlite/archive_tiers/revision_governance.py:classify_raw_revision_cohort gates a source-path identity-split guard behind check_source_path_identity_split. The rebuild/backfill path (sources/revision_backfill.py) always needs the guard on (a stale pre-fix parser identity can split one physical document's re-acquisitions across two logical_source_keys). The live-watch path (sources/live/batch.py, sources/live/append_ingest.py) must always leave it off (a watched source path can be legitimately, atomically replaced with a different session's content, which must not be quarantined as "divergent evidence"). A boolean shared between two callers who need opposite fixed answers is a naming/logic bug waiting to bite the next caller that gets the literal wrong.

Solution

  • Renamed the implementation to a private _classify_raw_revision_cohort (unchanged body/logic).
  • Added classify_raw_revision_cohort_for_rebuild_repair (always applies the guard) and classify_raw_revision_cohort_for_live_watch (never does), each a thin wrapper with no boolean parameter.
  • Updated ArchiveStore's two delegating methods, the three production call sites, every test call site (including the ArchiveStore/ArchiveBlobPublisher monkeypatch targets in tests/infra/append_cohort_memory_counter.py and tests/integration/test_append_cohort_memory.py, which patch the method by name), and docs/plans/layering.yaml's writer-module entrypoint inventory.
  • Pure refactor: no behavior change at any call site, each caller now gets the fixed-correct answer by construction instead of by remembering the right boolean literal.

Verification

  • devtools test tests/unit/storage/test_revision_replay.py tests/unit/sources/test_live_append_cursor_resynthesis.py tests/unit/storage/test_raw_authority_verdict_projection.py -> 44 passed
  • devtools test tests/integration/test_append_cohort_memory.py -> 1 passed, 3 pre-existing failures confirmed unrelated (reproduced identically against unmodified origin/master before this change; these tests do not reference classify_raw_revision_cohort in their failure path)
  • devtools test tests/unit/sources/test_live_batch_support.py -> 3 pre-existing failures (test_full_ingest_skips_durably_excised_content_without_aborting_batch, test_full_ingest_writes_archive_with_route_observability, test_append_multi_session_payload_is_rejected_before_index_write) confirmed to reproduce identically on unmodified origin/master; not caused by this change
  • devtools verify --quick -> exit 0 (all steps ok, including verify layering after updating docs/plans/layering.yaml's entrypoint list)

Ref polylogue-vp2ky

Co-Authored-By: Claude [email protected]

Sinity and others added 2 commits August 3, 2026 13:16
Replace the single check_source_path_identity_split boolean parameter
with two named entry points -- classify_raw_revision_cohort_for_rebuild_repair
(always applies the source-path cross-key divergent-evidence guard) and
classify_raw_revision_cohort_for_live_watch (never does). The shared
implementation moves to a private _classify_raw_revision_cohort.

Problem: the function's own docstring stated the guard is sound for the
offline rebuild/backfill caller and unsound for the live-watch caller, so
every caller had to independently pass the correct literal boolean by hand.

Solution: name each question instead of sharing one flag. Updated the two
production call sites (sources/revision_backfill.py,
sources/live/batch.py, sources/live/append_ingest.py), ArchiveStore's
delegating methods, and every test call site (including the
ArchiveBlobPublisher/ArchiveStore monkeypatch targets in
tests/infra/append_cohort_memory_counter.py and
tests/integration/test_append_cohort_memory.py, which patch the method by
name). Pure refactor -- no behavior change at any call site.

Ref polylogue-vp2ky

Co-Authored-By: Claude <[email protected]>
docs/plans/layering.yaml's writer-module entrypoint audit for
revision_governance.py still listed the retired classify_raw_revision_cohort
name; list the two replacement entrypoints instead.

Ref polylogue-vp2ky

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c55d801d-38c9-45b7-87f6-71c185b9748c

📥 Commits

Reviewing files that changed from the base of the PR and between f226244 and c3c2a0c.

📒 Files selected for processing (13)
  • docs/plans/layering.yaml
  • polylogue/archive/revision_authority.py
  • polylogue/sources/live/append_ingest.py
  • polylogue/sources/live/batch.py
  • polylogue/sources/revision_backfill.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/revision_governance.py
  • tests/infra/append_cohort_memory_counter.py
  • tests/integration/test_append_cohort_memory.py
  • tests/unit/sources/test_live_append_cursor_resynthesis.py
  • tests/unit/sources/test_live_batch_support.py
  • tests/unit/storage/test_raw_authority_verdict_projection.py
  • tests/unit/storage/test_revision_replay.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit dd36856 into master Aug 3, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/storage/split-classify-raw-revision-cohort-flag branch August 3, 2026 12:06
Sinity added a commit that referenced this pull request Aug 3, 2026
PR #3645 (vp2ky, split classify_raw_revision_cohort into
_for_rebuild_repair/_for_live_watch variants) and PR #3639 (sp72,
Drive revision lineage) landed within minutes of each other; sp72's
new call site in _core.py still referenced the removed name, breaking
every polylogue CLI invocation on master (ImportError). Use
_for_live_watch, matching the actual live-tailed-watcher call sites
(sources/live/append_ingest.py, sources/live/batch.py) and sp72's own
stated intent ('the same governance the live tailed-watcher path
already uses').

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant