Give failure codes one table in the store, tested both ways
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
Research direction
Begin at FailureReason::code in crates/domain/src/execution.rs for the canonical spellings, then encode_failure/decode_failure in crates/adapters/store/src/codec.rs where the duplicate literals sit. Copy the #733 pattern: one table read both ways, plus a test walking every variant through a wildcard-free match; reasons carry fields, so supply one sample value each. Extend the existing round-trip tests (repository_exists_round_trips, daemon_stopped_round_trips). Done when both functions read the single table, the exhaustive both-directions store test passes, and no stored text changes.
Written by the indexing model from the issue text.
Description
A failure's stored code is spelled three times, by hand, with nothing that checks they agree for every variant:
FailureReason::codeincrates/domain/src/execution.rs(the code a hook'sLADDERBACK_ERRORand the operation log carry);encode_failureincrates/adapters/store/src/codec.rs, which writeserror_codefrom its own literals rather than fromFailureReason::code, except for a refused setting (refusal.code());decode_failurein the same file, which readserror_codeback through a third set of literals.
A typo in one of them would write a code that hooks and the log disagree on, or make a stored failure unreadable (StoreError::Corrupt). Only some reasons have a round-trip test (repository_exists_round_trips, daemon_stopped_round_trips, the refusals), so most reasons' codes are asserted nowhere in the store.
#733 did this for operation kinds and warning kinds: each word is written by one spelling, read through a table of the kinds by that same spelling, and the codec's tests walk every variant (from the enum's derived Deserialize) through a match with no wildcard that spells each code as a literal. Failure reasons carry fields, so the same walk needs a list of one sample value per reason rather than the derived variant names.
Change: encode_failure takes the code from FailureReason::code, decode_failure reads it through one table, and a store test walks every reason through an exhaustive match that spells its code as a literal, in both directions. No stored text changes.
Follow-up from #733, which left failure codes out of scope.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 56m
- Merged PRs (30d)
- 349
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nledford/Ladderback
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nledford/Ladderback#809 ·
Maintainers usually reply within 1 day
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nledford/Ladderback#759 ·
Maintainers usually reply within 1 day
-
enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nledford/Ladderback#746 ·
Maintainers usually reply within 1 day
-
enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nledford/Ladderback#745 ·
Maintainers usually reply within 1 day
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nledford/Ladderback#647 ·
Maintainers usually reply within 1 day
All issues in nledford/Ladderback
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
matrix-org/matrix-rust-sdk#7495 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yantrikos/yantrik-os#1272 ·
Maintainers usually reply within 1 day
-
crate: spate-kafka priority: low tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
macOS 菜单栏托盘图标保留橙色,与系统单色图标风格不一致Possibly taken @xhugoliu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
YizhengWw/HachimoDock#56 · 1 comment ·