Repository navigation
fix!: 3.0 pre-release fixes for the core library (#130) - #132
Merged
Merged
Conversation
- Workers publish lifecycle events (Worker::with_event_manager) in every build, not only with `webhooks`. - [webhooks], [streaming], [alerting] and [metrics] are optional config sections; in a build without the feature, from_file rejects the section with HammerworkError::Config naming the feature. - TestQueue::set_throttle_config validates like the database backends. - Remove config::SimpleEventFilter. - MySQL key manager uses UTC_TIMESTAMP(6); migration 021 gives DATETIME columns (UTC_TIMESTAMP(6)) expression defaults, drops the ON UPDATE clause of hammerwork_queue_pause.updated_at, and converges schemas converted by its pre-release version. - WorkerConfig::validate rejects batch_size 0 / above MAX_DEQUEUE_BATCH_SIZE and batch_concurrency 0; Worker::with_hammerwork_config validates the worker section. - RateLimit::with_burst_limit(0), Worker::with_attempt_cap(<1) and WebhookManager::new (no panic; try_new removed) are fallible. - Share the dequeue 0/1/N dispatch and cap across backends; single weighted claims reuse fill_weighted_batch; drop dead cfg(not(feature)) fallbacks in alerting, metrics and encryption. Closes #130 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kend (#130) PostgreSQL and MySQL sorted queue names by the database collation, so the order differed between backends (and from TestQueue) and the regression test depended on other data in the database. Sort and deduplicate in Rust. 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.
Closes #130. Part of #122.
Pre-release fixes for the core library: six bugs and the cleanups listed in the issue.
Fixes
webhooks.Worker::with_event_manager, theevent_managerfield and the publish path inrecord_eventwere gated onwebhooks. They now compile in every build, because theeventsmodule always does. Streaming-only builds and plainEventManagersubscribers now get worker events. The worker event tests inworker_config_testsandpayload_encryption_testsno longer needwebhooks.webhooks,streaming,alertingandmetricsonHammerworkConfigare now#[serde(default)]. When a feature is off, a privateOption<serde::de::IgnoredAny>placeholder (skip_serializing) detects the section.from_filethen returnsHammerworkError::Config("[alerting] is set but hammerwork was built without thealertingfeature").from_envreads no sections, so it needs no check. Tests cover a file saved without the sections loading in any build, and the rejection message for each compiled-out feature.TestQueue::set_throttle_configcallsThrottleConfig::validate. The sharedthrottle_configurationscenario now asserts the rejection on PG, MySQL and TestQueue.config::SimpleEventFilteris deleted, along with its mentions in the CHANGELOG and the upgrade guide.UTC_TIMESTAMP(6)instead ofNOW(6)(12 sites).CURRENT_TIMESTAMPcolumns the expression default(UTC_TIMESTAMP(6))(MySQL 8.0.13+, now documented). It dropsON UPDATEonhammerwork_queue_pause.updated_at; every library write to that table (pause_queue's insert and upsert) already set it explicitly, as 2.5.0 did.current_timestampdefault or anon updateextra, so a schema converted by the old 021 converges.migration_datetime_testsnow checks:+05:00session;updated_atis not auto-touched, and pause writes it;WorkerConfig::validaterejectsbatch_size0 or aboveMAX_DEQUEUE_BATCH_SIZE, andbatch_concurrency0.Worker::with_hammerwork_confignow runsconfig.worker.validate()too.Cleanups
backend::dispatch_dequeueholds the 0/1/N dispatch and theMAX_DEQUEUE_BATCH_SIZEcap; PG, MySQL and TestQueue all use it. The caps insideclaim_manyare gone.fill_weighted_batchwith room 1. MySQL'sdequeue_with_priority_weights_inneris removed, and arunnable_levelshelper replaces the duplicated levels query. The behaviour is the same:weighted_seed(queue, attempt));cfg(not(feature))fallbacks are deleted, together with the always-truecfg(feature)attributes in those modules:alerting.rs: the webhook and Slack stubs;metrics.rs: the no-op collector and its test;encryption/engine.rs: the "feature not enabled" branch;webhooks.rs: the redundant attributes only.WebhookManager::newandnew_defaultreturnResult, andtry_newis removed.RateLimit::with_burst_limitreturnsResultand rejects 0.Worker::with_attempt_capreturnsResultand rejects values below 1. Both follow the fallible style 3.0: remove legacy compatibility paths #90 used forRateLimit.Not done
weighted_seed. It seeds from its mock clock, which keeps its picks deterministic under a frozen clock. The backends'weighted_seedhashes wall-clock nanoseconds and the thread id, so switching would make TestQueue picks non-deterministic. That is not provably the same behaviour, so it was left as is.NOW(). It remains only incargo-hammerwork/src/integration_tests/sql_query.rs:149,169(MySQL test queries usingDATE_SUB(NOW(), ...)). These were left for 3.0 pre-release: __private, requeue-stale scope, health lease rule, docs #131.hammerwork-webhas no MySQLNOW().Docs
[Unreleased]: the breaking changes and fixes, plus an updated 021 Database entry.with_attempt_cap, MySQL 021 defaults and Zero rates (burst limit);WebhookManager::newreturns aResult" subsection.?added to doc examples indocs/*.mdfor the now-fallible builders.Testing
cargo fmt --all --check,cargo clippy --workspace --all-features --all-targets -D warnings,cargo check --examples --all-featuresandcargo doc --workspace --all-features --no-deps(with-D warnings) are all clean.cargo clippy -p hammerwork --lib --tests --no-default-features -D warningsis clean for every one of these feature sets:"",postgres,mysql,streaming,kafka,kinesis,google-pubsub,alerting,metrics,webhooks,full,test-queue,postgres,streaming,encryptionandmysql,webhooks.queue_names_include_archived_queues, caused by leftoverhunt_*/hunt3_qqueues in the shared local databases. The database collation ordershunt_...beforehunt3_q, while Rust byte order does the opposite. No code here touches that query.021_mysql_datetimerow was deleted and migrations rerun. AllDATETIMEdefaults now readutc_timestamp(6), and noON UPDATEremains.🤖 Generated with Claude Code