Conversation
Closes #317. `ratatoskr-store` and `ratatoskr-cli` each resolved a run-id prefix, and the copy in the CLI is where `runs rm --force ""` found a run to delete. #315 fixed that copy; it did not remove the reason there were two. A rule added to one was a rule the other silently lacked. Collapsing them was unsafe while `Store::resolve_run` handed a full-length id straight back without looking for it: an id nobody had ever stored resolved to itself, and the six subcommands routed through the matcher include ones that delete what they resolve. A full id is now resolved like any other prefix. The saving was an index seek; what it cost was an answer about a run that does not exist. `serve` is unaffected: it already keeps an unmatched id as-is so its handlers answer an unknown run the same way for a short id as for a long one, which is what a `None` for a full id now reaches. The CLI keeps a `resolve` that supplies the wording — the store answers `None` for "nothing matches", and someone who typed a prefix wants to know which of the two ways it failed — but the matching is the store's, once. Its four tests now drive the store rather than a hand-built list, and a fifth covers the full-length id that names no run.
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 #317.
ratatoskr-storeandratatoskr-clieach resolved a run-id prefix, independently. The copy in the CLI is whereratatoskr runs rm --force ""found a run to delete, and the dashboard was never exposed to the same bug because it resolves through the store. #315 fixed that copy. It did not remove the reason there were two — and as long as both existed, the next rule added to one was a rule the other silently lacked.Why the obvious dedupe was unsafe, and what changed
Store::resolve_runshort-circuited a full-length id straight back toSomewithout looking for it:Routing the CLI through that as-is would have been a regression, not a cleanup: the six subcommands that resolve a prefix include
rm, which deletes what it resolves, so an id nobody had ever stored would have resolved to itself and been reported deleted.A full-length id is now resolved like any other prefix. The saving was an index seek on the primary key; what it cost was the store answering about a run that does not exist. Everything
resolve_runreturns now exists.serveis unaffected. It already keeps an unmatched id as-is, deliberately, so its handlers answer an unknown run the same way for a short id as for a long one — which is exactly what aNonefor a full id now reaches:What is left in the CLI
A
resolvethat supplies the wording, and no matching of its own. The store answersNonefor "nothing matches", and someone who typed a prefix wants to know which of the two ways it failed; ambiguity arrives as the store's own error, which already says to use more of the id.The one message that changes is the ambiguous case:
`run-ab` matches 2 runsbecomes`run-ab` names more than one run — use more of the id. The count is not worth reinstating — the store'sLIMIT 2means it stops as soon as it knows the answer is "more than one", and counting the rest to phrase the message would be a second query for a word.Corrected while here
The issue's comparison table says the store returns
Ok(None)on ambiguity. It returnsErr(StoreError::AmbiguousRun). So "distinguish none from several" was already true of the store; only the wording differed.Verified
-D warningsclean, fmt clean.