Repository navigation
docs: fix job-types guide; doctests pass with default features - #51
Merged
Merged
Conversation
- Compile-check docs/job-types.md and fix its examples: fragments get a hidden prelude; Job::with_delay is a constructor; Job::with_cron takes a CronSchedule (with_cron_schedule is a constructor); handlers are typed JobHandler and return HammerworkError::Processing; retry comments match the max_attempts/with_max_retries semantics from #29. - Add Job::with_scheduled_at, which the README and guides already used. - The README TestQueue example was wrapped in cfg(feature = "test"), which doctests don't see, so it never compiled; drop the wrapper and gate the README/guide includes (one cfg'd module) on the features their examples use. - cargo test --doc with default features failed: the guide includes (#49) and 23 API examples needed the postgres feature. Gate those examples' fences with cfg_attr(feature = "postgres") and add a CI step running doctests with default features. Part of #48. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #48.
docs/job-types.mdis now compile-checked, and its 8 failing examples are fixed. Real API errors in the guide:.with_delay(...)isn't a builder (Job::with_delayis a constructor);.with_cron_schedule("…".parse()?)→.with_cron(CronSchedule::with_timezone(…)?)?;Err("…".into())instead ofHammerworkError::Processing;max_attemptsis the limit;with_max_retriesis a cap).Job::with_scheduled_at: the README and guides already used it, but it didn't exist.TestQueueexample never compiled. It was wrapped in#[cfg(feature = "test")], but doctests don't see the crate's features, so the body was compiled out. The wrapper is gone, and the README and guide includes now sit in one#[cfg(all(doctest, feature = …))]module.cargo test --docwith default features was broken. The includes from docs: compile-check the README and seven guides, and fix their examples #49 and 23 API examples (lib.rs,migrations,archive,worker) neededpostgres. Those examples' fences now usecfg_attr(feature = "postgres", doc = "```rust,no_run")/cfg_attr(not(…), doc = "```rust,ignore"). New CI step: doctests with default features.Doctests: 357 pass with
--all-features, 183 pass (24 ignored) with default features.🤖 Generated with Claude Code