lease test: assert the one-shot store's monitor settings directly
Astra review of 2fc00aea (P2): the upload half of the test can pass with the fix removed. A monitor's Open pass returns ErrDBNotReady before any listing if the database is not yet initialized, and retries only a second later, after Close, so the listing barrier never engages. The test now also checks the store as built (no compaction or snapshot monitor, no L0 retention monitor) through StoreMonitorsForTest; removing the oneShot flag fails it 3 of 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/lease/checkpoint_monitors_test.go+7 −0internal/lease/export_test.go+7 −0
CI failed — run details
Intent
<task-notification> <task-id>blnicf8qx</task-id> <tool-use-id>toolu_01KacPpf2wt6MpMfj7vry4V2</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/827c02f3-27d0-4c98-a90c-8a82a4cf9e05/tasks/blnicf8qx.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of the narrow fix" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 38.1 g CO₂e (4,721,098 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on lease-checkpoint-no-compaction, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/lease/checkpoint_monitors_test.go b/internal/lease/checkpoint_monitors_test.go| index c9a968c2b..3df58da0e 100644 |
| --- a/internal/lease/checkpoint_monitors_test.go |
| +++ b/internal/lease/checkpoint_monitors_test.go |
| @@ -86,6 +86,13 @@ func TestCheckpointReplicatorWritesOnlyL0AndTheLease(t *testing.T) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| + // The store as built: no monitor at all. The uploads below are the |
| + // behaviour; this is the deterministic half, since a monitor's Open |
| + // pass can find the database not yet ready and retry only a second |
| + // later, after Close. |
| + if compaction, l0 := lease.StoreMonitorsForTest(rep); compaction || l0 != 0 { |
| + t.Errorf("a one-shot store starts monitors: compaction %v, L0 retention check every %s", compaction, l0) |
| + } |
| if err := rep.SyncAndWait(ctx); err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/lease/export_test.go b/internal/lease/export_test.go| index 3afd92d03..383a9d033 100644 |
| --- a/internal/lease/export_test.go |
| +++ b/internal/lease/export_test.go |
| @@ -51,3 +51,10 @@ func SetFinalSyncHookForTest(hook func()) func() { |
| finalSyncHook = hook |
| return func() { finalSyncHook = prev } |
| } |
| + |
| +// StoreMonitorsForTest reports whether r's litestream store starts the |
| +// compaction and snapshot monitors, and its L0 retention check interval |
| +// (0: no L0 retention monitor). |
| +func StoreMonitorsForTest(r *Replicator) (compaction bool, l0RetentionCheck time.Duration) { |
| + return r.store.CompactionMonitorEnabled, r.store.L0RetentionCheckInterval |
| +} |