fix(decision-records): assign counters in argument order - #10
Merged
Merged
Conversation
`promote A B` built its seed set as a set and numbered it with sorted(), so the counters followed the alphabet rather than the caller. `promote OPER DASH` gave DASH the lower counter, and there was no way to choose which co-promoted record got which number. That matters whenever one record of a set is the foundation the others name: the record they build on should read as the earlier decision, and only the caller knows which one that is. promote now keeps a deduped list in argument order and assigns from it. The seed set stays a set for reference classification, so the blocking-set closure, --deref and --allow-replace are untouched. The refusal messages printed sorted commands, which under the new behaviour would silently pick the counters for you. Each now prints the requested drafts in the order given -- the blocking suggestion appends whatever the closure pulled in, so it stays a valid promotion that keeps the caller's counters -- and the blocking listing is ordered to match the command it prints.
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.
promote A Bassigned counters in sorted order, not the order given. Observed in a real promotion:promote OPER DASHproducedDASH=0041andOPER=0042, becauseDASHsorts first. There was no way to choose which co-promoted record got which counter.That matters whenever one record of a set is the foundation the others name — the record they build on should read as the earlier decision, and only the caller knows which one that is. It is not cosmetic once the set is merged: the counter is the permanent identity, so getting it backwards is only fixable by hand-renumbering records that are already referenced.
The fix
promotenow keeps a deduped list in argument order and numbers from it. The seed set stays a set for reference classification, so the blocking-set closure,--deref,--allow-replaceand the co-promoted counter↔counter rewrites are all untouched._do_dereftakes the ordered list and derives its own set.The refusal messages each printed a suggested command built with
sorted(). Under the new behaviour that would silently pick the counters for you, so each now prints the drafts in the order given:--derefand--allow-replacere-run suggestions preserve the caller's order, so adding the flag does not change the numberingTests
Three added. Co-promotion in a deliberately reverse-alphabetical order (
ZZZZbeforeAAAA) lands the counters on the arguments; the same pair reversed proves the order is read rather than incidental; and the blocking refusal's printed command is extracted from the error text and executed, asserting both that it is a valid promotion and that the requested draft keeps the first counter.Two of the three fail against the previous implementation, which I checked before writing the fix. Suite: 100 pass (82 existing + 3 new here, plus the repo's own 15).
references/promotion.md, the module usage block and the--helptext now state that co-promoted counters follow argument order.