Skip to content

refactor: eliminate stringly-typed history status and DRY violations#52

Merged
deepjoy merged 2 commits into
mainfrom
internal-refactor
Mar 19, 2026
Merged

refactor: eliminate stringly-typed history status and DRY violations#52
deepjoy merged 2 commits into
mainfrom
internal-refactor

Conversation

@deepjoy
Copy link
Copy Markdown
Owner

@deepjoy deepjoy commented Mar 18, 2026

Summary

  • Replace insert_history(status: &str) with a HistoryStatus enum — typos now
    fail at compile time and the increments_retries() predicate replaces a string
    comparison across 7 call sites
  • Add TaskRecord::module_name() helper and replace 5 identical split_once("::")
    expressions in dispatch.rs and gate.rs
  • Consolidate 6 ActiveTaskMap snapshot methods (records, progress_snapshots,
    byte_progress_snapshots + their _with_prefix variants) into 3 that accept
    Option<&str>; update all 9 call sites
  • Extract merge_module_tags() in SubmitBuilder and replace both duplicated
    tag-merge loops in resolve()

Notes

  • Internal (pub(crate)) changes only — no public API surface affected
  • All 271 tests pass unchanged

@deepjoy deepjoy force-pushed the internal-refactor branch 2 times, most recently from 97a2f35 to d02e45f Compare March 18, 2026 15:41
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Comparison

Click to expand
group                         current
-----                         -------
dep_chain_dispatch/10         1.00     30.2±0.95ms        ? ?/sec
dep_chain_dispatch/25         1.00     65.8±1.77ms        ? ?/sec
dep_chain_dispatch/50         1.00    140.7±3.47ms        ? ?/sec
dep_chain_submit/10           1.00     12.4±0.44ms        ? ?/sec
dep_chain_submit/200          1.00   635.6±45.65ms        ? ?/sec
dep_chain_submit/50           1.00     58.5±4.73ms        ? ?/sec
dep_fan_in_dispatch/10        1.00     26.6±0.33ms        ? ?/sec
dep_fan_in_dispatch/100       1.00    157.3±3.03ms        ? ?/sec
dep_fan_in_dispatch/50        1.00     85.2±0.88ms        ? ?/sec
dispatch_group_scaling/1      1.00   734.6±13.20ms        ? ?/sec
dispatch_group_scaling/10     1.00   741.8±14.31ms        ? ?/sec
dispatch_group_scaling/100    1.00   744.8±13.99ms        ? ?/sec
dispatch_group_scaling/50     1.00   742.7±13.73ms        ? ?/sec
dispatch_no_groups_500        1.00   670.4±13.08ms        ? ?/sec
dispatch_one_group_500        1.00   739.9±14.99ms        ? ?/sec

@deepjoy deepjoy force-pushed the internal-refactor branch from d02e45f to 26cd7b0 Compare March 19, 2026 02:09
deepjoy added 2 commits March 18, 2026 21:27
…atus enum

Introduces a sealed `HistoryStatus` enum with 7 variants (Completed,
Failed, DeadLetter, Cancelled, Expired, Superseded, DependencyFailed),
replacing the `status: &str` parameter on `insert_history`. The retry
count increment now uses `status.increments_retries()` instead of a
string comparison. All 8 call sites across lifecycle, hierarchy, and
submit modules updated. No public API changes.
- Add TaskRecord::module_name() helper; replace 5 split_once("::") sites
  in dispatch.rs and gate.rs
- Consolidate 6 ActiveTaskMap snapshot methods into 3 with Option<&str>
  prefix parameter; update all 9 call sites
- Extract merge_module_tags() in SubmitBuilder; replace both duplicated
  tag-merge loops in resolve()
@deepjoy deepjoy force-pushed the internal-refactor branch from 26cd7b0 to 61cfe8a Compare March 19, 2026 04:28
@deepjoy deepjoy merged commit fad99d0 into main Mar 19, 2026
1 of 2 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 19, 2026
deepjoy pushed a commit that referenced this pull request Mar 19, 2026
## 🤖 New release

* `taskmill`: 0.5.0 -> 0.5.1 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.5.1](v0.5.0...v0.5.1)
- 2026-03-19

### Fixed

- *(bench)* eliminate per-sample scheduler setup cost in history
benchmarks ([#55](#55))
- *(bench)* remove premature cancellation token call in history
benchmark setup ([#54](#54))
- *(ci)* bootstrap _benchmarks branch on first push to main
([#53](#53))
- *(ci)* restore stderr capture for benchmark output on main
([#51](#51))
- *(ci)* exclude lib target from cargo bench to fix benchmark CI
([#49](#49))

### Other

- decompose internal god objects into focused, single-responsibility
modules ([#56](#56))
- eliminate stringly-typed history status and DRY violations
([#52](#52))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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