feat(notes): add --latest to notes get for ambiguous slugs#730
Merged
Conversation
A bare `--name` with hits from multiple authors errors out, since a slug isn't unique — notes are keyed by (kind, author, slug). That's the right default, but it blocks wiki-style "just give me the current one" reads. `--latest` opts into picking the most recently updated candidate instead of erroring. Default stays strict; `--latest` conflicts with `--author` and `--naddr` (both already pin a single note). The ambiguity error now also points at `--latest`. Flag validation is extracted to a pure `validate_get_args` helper so the full matrix is unit-tested without a relay. Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
This was referenced May 28, 2026
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.
What
Adds
--latesttosprout notes get. On a bare--namethat matches notes from multiple authors, the CLI errors out (a slug isn't globally unique — notes are keyed by(kind, author, slug)).--latestopts into picking the most recently updated candidate instead.Why
Enables wiki-style "just give me the current one" reads against a shared slug without forcing the caller to know an author pubkey. The strict-by-default behavior stays —
--latestis opt-in.Design
--latestconflicts with--authorand--naddr(both already pin a single note); rejected with a clear usage error.--latest.sort_snapshots_newest_firstthen takes the head — no new ranking logic.validate_get_args(naddr, name, author, latest)helper so the full combination matrix is unit-tested without a relay.Testing
cargo test -p sprout-cli— 107 passed (4 newvalidate_get_argscases).cargo clippy -p sprout-cli --all-targets— clean.--latestreturns the newestskills-index; bare--namestill errors (now mentioning--latest);--latest --authorand--latest --naddrboth rejected.