8000 fix(minimal,sessions): resolve sessions by unique id prefix and refuse uuid-shaped names by norrietaylor · Pull Request #1986 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal,sessions): resolve sessions by unique id prefix and refuse uuid-shaped names - #1986

Merged
norrietaylor merged 1 commit into
mainfrom
fix/session-id-prefix-and-uuid-names
Oct 6, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
fix/session-id-prefix-and-uuid-names

Conversation

@norrietaylor
Copy link
Copy Markdown
Member

Problem

  • The CLI shows sessions by their 8-character short id (min ls, and announcements such as qa-h (01a0fe9d)), but no command accepts it: min session exec 01a0fe9d -- true fails with No session found matching '01a0fe9d'. SessionLookup::parse sends anything that is not a full UUID as a name lookup, and the resolver has no fallback.
  • A session can be named with another session's full UUID. Lookups try the UUID first, so min session destroy --force <uuid> destroys the other session, and the session carrying the UUID-shaped name answers to that id from then on. validate_session_name refused empty, padded, control-character, reserved and non-DNS-label names, but accepted a UUID.

Fix

  • validate_session_name (crates/sessions/src/store.rs) refuses a name that parses as a session UUID, in hyphenated or simple form: invalid session name: must not be a session id. The gate is shared by create and the rename save, so activate --name and rename are both covered.
  • get_session_record (crates/minimal/src/cmd/mod.rs), which resolve_session and resolve_session_version_gated share, falls back to an id-prefix match when a name lookup finds no record and the input is 4 to 32 hex digits (dashes allowed). It lists the sessions and compares the input against each id without dashes, ignoring case:
    • one match resolves to that session's record;
    • several matches fail with '<p>' matches sessions a1b2c3d4…, a1b29e8f…; use more characters;
    • no match keeps the existing No session found matching '<p>' error;
    • an exact name always wins, because the name is asked first.
  • min session policy (text and -o json) now sends its follow-up lookups by the resolved id, so a prefix reaches the same session as the record lookup. In JSON mode an ambiguous prefix reports as session-not-found rather than daemon-unreachable.
  • The session argument help and docs/reference/cli-min.md now say "UUID, unique id prefix, or session name".

Tests

New tests:

  • sessions: store::tests::create_and_rename_refuse_a_uuid_shaped_name.
  • minimal: a_unique_id_prefix_resolves_to_its_session, an_ambiguous_id_prefix_names_the_candidates, a_non_hex_or_short_input_is_not_an_id_prefix, an_exact_name_wins_over_an_id_prefix.

Commands run on macOS arm64:

  • just test (sessions + minvmd): 985 passed, 0 failed, 19 skipped
  • just clippy (sessions + minvmd, -D warnings): clean
  • CROSS_CONTAINER_OPTS="--env HOME=/tmp" cross test -p minimal --target aarch64-unknown-linux-musl --locked -- prefix exact_name duplicate_session: lib test result: ok. 14 passed; 0 failed, including the 4 new tests
  • CROSS_CONTAINER_OPTS="--env HOME=/tmp" cross test -p minimal --target aarch64-unknown-linux-musl --locked --no-fail-fast: lib 345 passed, 6 failed; every integration target passed. All 6 failures also fail on main in this container: 3 resolver::advisory_* (sudo: not found), legacy_network_spellings_parse_with_hint, and the timing-bound a_stopped_vm_does_not_hold_a_box_name_resolution / a_stopped_vm_does_not_hold_a_listing
  • CROSS_CONTAINER_OPTS="--env HOME=/tmp" cross clippy -p minimal --target aarch64-unknown-linux-musl --locked --all-targets -- -D warnings: clean
  • cargo fmt --check: clean
  • just minimal-cli: builds; min session exec --help shows the new argument help
  • just lint-prose docs/reference/cli-min.md: no new alerts (same count as on main; the edited lines carry none)

Refs gominimal/inbox#911

…e uuid-shaped names

A name lookup that finds no record now falls back to matching the input
as an id prefix when it is 4 to 32 hex digits (dashes allowed), so the
short id the CLI prints resolves. One match resolves, several are an
error naming the candidates, and an exact name always wins.

validate_session_name refuses a name that parses as a session UUID, so
a session can no longer be named with another session's id.
@norrietaylor
norrietaylor requested a review from a team as a code owner October 5, 2026 15:46
@coderabbitai
coderabbitai Bot commented Oct 5, 2026
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 6 billable files and costs up to $1.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 20 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 53d10ab4-4c5d-4ece-9bef-50e2073863ac
📥 Commits

Reviewing files that changed from the base of the PR and between 03f2cf1 and 33fef1a.

📒 Files selected for processing (6)
  • crates/minimal/src/cli.rs
  • crates/minimal/src/cmd/mod.rs
  • crates/minimal/src/cmd/session.rs
  • crates/minimal/src/tests.rs
  • crates/sessions/src/store.rs
  • docs/reference/cli-min.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@minimal-foundry
minimal-foundry Bot commented Oct 5, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 33fef1ae8ea0.

Nothing to do.

Clobber: none: git log on cmd/mod.rs and store.rs shows only this commit and prior deliberate name-validation work (63830eec, 900f4576); nothing is reverted.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 5, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 5, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 057ce0c Oct 6, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the fix/session-id-prefix-and-uuid-names branch October 6, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0