Skip to content

fix(queue): make the effective store visible and surface delivery stats - #493

Merged
ytallo merged 1 commit into
mainfrom
fix/queue-store-observability
Jul 14, 2026
Merged

fix(queue): make the effective store visible and surface delivery stats#493
ytallo merged 1 commit into
mainfrom
fix/queue-store-observability

Conversation

@ytallo

@ytallo ytallo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The builtin queue adapter silently falls back to the in-memory store when the stored configuration has no adapter entry — even when the --config seed explicitly asks for file_based persistence. The only boot log line (loaded seed config path=…) reads as if the seed took effect, so a stack can run without durability and nothing says so. Hit this on a live dev stack: the store file had been frozen for days while turns ran through an in-memory store.

  • Boot now logs the effective store: store="file_based" path=… or store="in_memory" (with a note that jobs don't survive restarts).
  • When a --config seed specifies an adapter that differs from the authoritative stored value, boot logs a WARN showing both, instead of discarding the seed silently. The stored value still wins — configuration-worker authority is unchanged.
  • engine::queue::topic_stats now returns the delivered/failed counters the store already tracks (additive fields; single construction site, no existing consumers read them).

Test plan

  • cargo test in queue/ — 130 passed, including the extended list_and_stats_return_adapter_state assertion on delivered/failed
  • Live boot against a stored config without adapter: WARN + store="in_memory" lines appear
  • Live configuration::set adding the adapter: hot-swap logs store="file_based" path=./data/harness-queue, store file resumes updating (revision advances, delivered increments)
  • Live engine::queue::topic_stats returns delivered/failed

Summary by CodeRabbit

  • New Features
    • Queue topic statistics now report delivered and failed message counts.
  • Bug Fixes
    • Added validation to detect when a provided configuration differs from the stored queue configuration, with a warning shown while preserving the stored settings.
  • Chores
    • Improved startup logging for file-based and in-memory queue storage, including the storage location and whether jobs persist across restarts.

The builtin adapter silently fell back to the in-memory store when the
stored configuration lacked an adapter entry, even if the --config seed
asked for file_based persistence. Boot now logs the effective store
(file_based + path, or in_memory) and warns when the seed's adapter is
discarded in favor of the authoritative stored value.

engine::queue::topic_stats now returns the delivered/failed counters
the store already tracks, so queue throughput is observable via the
API.
@ytallo ytallo added the no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only) label Jul 14, 2026
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jul 14, 2026 12:26am
workers-tech-spec Ready Ready Preview, Comment Jul 14, 2026 12:26am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 42 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The queue worker now logs store initialization, exposes delivered and failed topic outcomes, and warns when a configuration seed’s adapter differs from the stored adapter.

Changes

Queue runtime updates

Layer / File(s) Summary
Store initialization logging
queue/src/boot.rs
File-based and in-memory store construction now emits informational logs with the selected store details.
Topic statistics outcomes
queue/src/functions.rs
Topic statistics responses now include delivered and failed, with updated test data and assertions.
Configuration seed validation
queue/src/main.rs
The worker compares a provided seed adapter with the stored adapter and warns when the seed is ignored.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: guibeira

Poem

A rabbit watched the queue boot bright,
With logs that marked each store just right.
Delivered hops and failures show,
Seed mismatches warn before they go.
The worker bounds through startup light!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main changes: store visibility logging and delivery stats exposure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/queue-store-observability

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@queue/src/main.rs`:
- Around line 92-100: Update the adapter comparison in the seed validation block
to run only when seed.adapter is Some, while preserving the existing mismatch
warning and stored-configuration authority behavior for explicitly provided
adapters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4fc3201-85e2-455a-9a42-fda46e4d628d

📥 Commits

Reviewing files that changed from the base of the PR and between f072b50 and d7b3fb5.

📒 Files selected for processing (3)
  • queue/src/boot.rs
  • queue/src/functions.rs
  • queue/src/main.rs

Comment thread queue/src/main.rs
Comment on lines +92 to +100
if let Some(seed) = seed.as_ref() {
if seed.adapter != config.adapter {
tracing::warn!(
seed_adapter = ?seed.adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Only compare adapters when the seed specifies one.

seed can be present while seed.adapter is None. In that case, this emits an “adapter ignored” warning when the stored configuration has an adapter, even though --config did not provide one. Gate the comparison on seed.adapter.is_some().

Proposed fix
     if let Some(seed) = seed.as_ref() {
-        if seed.adapter != config.adapter {
+        if let Some(seed_adapter) = seed.adapter.as_ref() {
+            if Some(seed_adapter) != config.adapter.as_ref() {
             tracing::warn!(
-                seed_adapter = ?seed.adapter,
+                seed_adapter = ?seed_adapter,
                 stored_adapter = ?config.adapter,
                 "--config seed adapter ignored; the stored configuration is authoritative"
             );
+            }
         }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if let Some(seed) = seed.as_ref() {
if seed.adapter != config.adapter {
tracing::warn!(
seed_adapter = ?seed.adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}
if let Some(seed) = seed.as_ref() {
if let Some(seed_adapter) = seed.adapter.as_ref() {
if Some(seed_adapter) != config.adapter.as_ref() {
tracing::warn!(
seed_adapter = ?seed_adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}
}
🤖 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 `@queue/src/main.rs` around lines 92 - 100, Update the adapter comparison in
the seed validation block to run only when seed.adapter is Some, while
preserving the existing mismatch warning and stored-configuration authority
behavior for explicitly provided adapters.

@ytallo
ytallo merged commit c28d5f3 into main Jul 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant