Skip to content

Improve batch publish errors & bump dependencies#23

Open
Jarema wants to merge 1 commit into
mainfrom
fix-errors
Open

Improve batch publish errors & bump dependencies#23
Jarema wants to merge 1 commit into
mainfrom
fix-errors

Conversation

@Jarema
Copy link
Copy Markdown
Collaborator

@Jarema Jarema commented May 8, 2026

Signed-off-by: Tomasz Pietrek tomasz@synadia.com

Signed-off-by: Tomasz Pietrek <tomasz@synadia.com>
@synadia-claude-reviewer
Copy link
Copy Markdown

synadia-claude-reviewer Bot commented May 8, 2026

Claude finished @Jarema's task in 2m 10s —— View job


PR Review

  • Gather PR diff and context
  • Review changed files
  • Post inline comments for issues found
  • Post summary review

Summary

The error-handling additions (BatchPublishTooManyInflight, ErrorCode::ATOMIC_PUBLISH_TOO_MANY_INFLIGHT mapping, and the Display impl) are clean and follow the existing pattern. The test assertion update is logically correct for the inflight-limit scenario.

One blocking issue and two minor ones:

Blocking — missing batch_publish_fast.rs
pub mod batch_publish_fast; is declared in lib.rs (line 81) and the module is documented in both lib.rs and README.md, but no corresponding source file exists. The crate will not compile. Either include the implementation file in this PR or defer the module declaration and its docs to the PR that adds the implementation.

Minor — hard-coded server limit in error messages
Both the doc comment and Display impl for BatchPublishTooManyInflight embed (limit: 50). The NATS server limit could change; the number will silently become wrong. Dropping it from the user-facing string (keeping it, if needed, in a code comment) avoids stale documentation.

Minor — stale test name
test_incomplete_batch_error (line 216) now asserts BatchPublishTooManyInflight, not BatchPublishIncomplete. Renaming the function keeps the test suite readable.


pub mod batch_fetch;
pub mod batch_publish;
pub mod batch_publish_fast;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Build-breaking: batch_publish_fast.rs is missing.

pub mod batch_publish_fast; is declared here, and the README/crate-level docs reference jetstream_extra::batch_publish_fast::FastPublishExt, but no batch_publish_fast.rs (or batch_publish_fast/mod.rs) file exists in the repository. The crate will not compile as-is. The file needs to be included in this PR, or the module declaration and its documentation should be deferred to the follow-up PR that implements the module.

BatchPublishNotEnabled,
/// Batch publish is incomplete and was abandoned
BatchPublishIncomplete,
/// Server has too many inflight batches (server limit: 50)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The server limit of 50 is hard-coded in both the doc comment and the Display impl below. If the NATS server changes this limit in a future release the error message will be stale. Consider either omitting the specific number or noting it as the value at the time of the async-nats 0.48 / nats-server 2.14 release:

Suggested change
/// Server has too many inflight batches (server limit: 50)
/// Server has too many inflight batches
BatchPublishTooManyInflight,

Self::BatchPublishIncomplete => {
write!(f, "batch publish is incomplete and was abandoned")
}
Self::BatchPublishTooManyInflight => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same hard-coded limit concern as the doc comment above. Suggestion:

Suggested change
Self::BatchPublishTooManyInflight => {
Self::BatchPublishTooManyInflight => {
write!(f, "server has too many inflight batches")
}

err.unwrap_err().kind(),
BatchPublishErrorKind::BatchPublishIncomplete
err.kind(),
BatchPublishErrorKind::BatchPublishTooManyInflight
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The assertion flip from BatchPublishIncomplete to BatchPublishTooManyInflight is correct for this test scenario (51st concurrent batch hitting the server inflight limit), but the test name test_incomplete_batch_error no longer matches what it actually tests. Consider renaming it to test_too_many_inflight_error to avoid confusion.

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