Skip to content

feat(audit): report a reset audit chain once, at daemon startup (#3772 slice 4a) - #3892

Merged
hsinatfootprintai merged 2 commits into
mainfrom
feat/3772-anchor-startup-detect
Dec 2, 2026
Merged

hsinatfootprintai merged 2 commits into
mainfrom
feat/3772-anchor-startup-detect

Conversation

@hsinatfootprintai

Copy link
Copy Markdown
Contributor

Part of #3772 (slice 4a; the issue stays open). Independent of #3891: this branch is cut from main.

What

  • AnchorManager checks at start (before the first interval) whether the chain's highest row id is below the anchor file's last checkpoint, which includes a database recreated empty.
  • It reports through the existing refusal path: the readiness entry goes NOT_SERVING (so /health and containarium doctor show it from startup) and the DEGRADED line is logged once, now marked "(found at startup)" and naming containarium audit anchor new-epoch for a deliberate reset.
  • The ticks that follow do not repeat the explanation (still once). The refusal counter counts only refused publishes, so the startup detection is not counted.
  • doctor's text for this state names new-epoch too.

Not in this PR (4b, needs a decision, asked on the issue thread)

doctor warning when only a local anchor file is configured, and the off-host copy. A readiness entry cannot carry a warning that is not a failure without showing OK: false on every default install in the cloud probe, so this wants a decision before code.

Test evidence

  • TestAnchorManager_DetectsAResetChainAtStartup, _DetectsAnEmptyChainAtStartup, _StartupCheckLeavesAHealthyChainAlone (nothing anchored / chain at the anchor / chain ahead), _StartRunsTheStartupCheck (an hour-long interval, reported within 2s of Start).
  • Red first (placeholder no-op). Mutation-checked: removing the call from run, >= to >, and counting the startup detection as a refusal each fail a test.
  • go test ./internal/audit ./internal/policyreadiness ./internal/gateway ./internal/server — ok. CI: pending, see the checks on this PR.

🤖 Generated with Claude Code

hsinatfootprintai and others added 2 commits December 2, 2026 21:42
…slice 4a)

The anchor manager now checks, as it starts, whether the chain is behind the
anchor file's last checkpoint (database recreated empty or restored from an
older copy) and reports it through the same state, readiness entry and log
line as a refused tick, with the new-epoch command in the message. The ticks
that follow do not repeat it, and the refusal counter still counts only
refused publishes.

Part of #3772

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Part of #3772

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5e98b76c-7b75-40ff-a470-9ec4371d95fb
Commits

Reviewing files that changed from the base of the PR and between 6f8f1d3 and 5771997.

Files selected for processing: 4

  • changelog.d/3892.changed.md
  • internal/audit/anchor.go
  • internal/audit/anchor_startup_test.go
  • internal/policyreadiness/readiness.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@hsinatfootprintai
hsinatfootprintai added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 8c5d524 Dec 2, 2026
31 checks passed
@hsinatfootprintai
hsinatfootprintai deleted the feat/3772-anchor-startup-detect branch December 2, 2026 14:16
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