Skip to content

fix: Degrade an operation read on unseeded audit continuity - #5123

Merged
Sinity merged 1 commit into
masterfrom
fix/gwns3-audit-continuity-read-degradation
Sep 14, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/gwns3-audit-continuity-read-degradation

Conversation

@Sinity

@Sinity Sinity commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

settled_read is on every operation read, and the one audit-continuity error shape it can raise on a not-yet-seeded archive was the one no degradation handler caught. Widen the handlers and give the wider state its own named gap.

Problem

AuditContinuityCoordinator.is_available (polylogue/storage/sqlite/audit_continuity.py:305, :307, :314) raises the base AuditContinuityError, not the AuditContinuityPendingError subclass, for an archive whose source or audit tier carries a continuity-era schema version without the matching audit_continuity_control / audit_continuity_head table. All seven degradation handlers (operations/operation_context.py:141 and daemon/operation_runtime.py:252, :274, :376, :573, :687) caught only the subclass.

Concrete input: a bootstrapped archive (bootstrap_archive_root, source user_version 44) whose audit_continuity_control table is absent.

Wrong observable outcome: observe_control_authority(root) raises

AuditContinuityError: current source schema is missing audit continuity control

out of a read that is documented never to repair or wait. Before the squash in #4867 operation reads did not consult audit continuity at all, so this is an always-on dependency whose bootstrap shape is unhandled.

Solution

  • Catch AuditContinuityError at all seven sites; AuditContinuityPendingError is a subclass, so the pending behaviour is unchanged.
  • observe_control_authority now names the wider state audit_continuity_unavailable rather than reusing audit_continuity_pending, so a degraded read still carries an explicit gap instead of collapsing to an empty scope.
  • No write path is widened: an audit mutation still raises. Nothing is discarded, and no audit state is lost.

Verification

devtools test tests/unit/operations/test_operation_snapshot.py
devtools test: PASSED exit=0 diagnosis=pytest_passed
devtools verify --quick   # exit=0, no gate FAILED

Anti-vacuity, verified by reverting the handler in observe_control_authority to AuditContinuityPendingError and re-running:

devtools test: FAILED exit=1 diagnosis=pytest_failed
AuditContinuityError: current source schema is missing audit continuity control
  polylogue/operations/operation_context.py:139 in observe_control_authority
  polylogue/storage/sqlite/audit_continuity.py:306 AuditContinuityError

devtools schema closure: polylogue/operations/operation_context.py out, polylogue/daemon/operation_runtime.py out, polylogue/operations/audit.py IN — the one-line re-export there moves the derived schema identity, so this must land before a fresh rebuild starts, never during one. No durable DDL changes; no migration.

Closure

Closes the defect in polylogue-gwns3.

Residuals

  • The regression test covers the operations/operation_context.py handler through the real route. The five daemon/operation_runtime.py handlers are the same one-word widening but are not independently covered here; standing up a DaemonOperationRuntime for each was out of proportion to the change.
  • This does not change is_available's classification of those states. If any of the three is genuinely a fault rather than a bootstrap condition, it still deserves a louder signal than a degraded read — that judgement is left open.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

`AuditContinuityCoordinator.is_available` raises the base
`AuditContinuityError` -- not the `AuditContinuityPendingError` subclass --
for an archive carrying a continuity-era schema version without the matching
control or head table. Every operation-read degradation handler caught only
the subclass, so that bootstrap shape escaped as an unhandled error from a
read that is never allowed to repair anything.

Widen the seven handlers to the base class and name the wider state
`audit_continuity_unavailable` so a degraded read still carries an explicit
gap rather than being reported as empty.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: feb59b48-111d-4510-9da6-efd69f06409c

📥 Commits

Reviewing files that changed from the base of the PR and between c53c640 and 8173fe3.

📒 Files selected for processing (4)
  • polylogue/daemon/operation_runtime.py
  • polylogue/operations/audit.py
  • polylogue/operations/operation_context.py
  • tests/unit/operations/test_operation_snapshot.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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-14T17:52:02.923392Z 8173fe3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 8e775ce into master Sep 14, 2026
3 checks passed
@Sinity
Sinity deleted the fix/gwns3-audit-continuity-read-degradation branch September 14, 2026 18:00
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