-
Notifications
You must be signed in to change notification settings - Fork 0
feat(cmdutil): accept a bare node id wherever a node ref is taken (#336) #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For nodes whose primary key uses the still-supported legacy CUID format, such as the documented
clr8x2k9p0000example ininternal/cmd/node/revision.go, this regex makesIsNodeIDreturn false, so bothResolveNodeURNandBatchNodeRefreject an ID copied from JSON as an invalid URN instead of sending it to the server. The committed API schema explicitly defines node selectors as accepting “CUID / 32-char hex” (schema/schema.graphql:5582), so limiting the new bare-ID support to hex leaves the reported round-trip failure unfixed for existing CUID-backed nodes.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that the schema names CUID —
schema/schema.graphql:5582saysPK (CUID / 32-char hex)— but I'm not widening the gate, and I think the evidence is fairly decisive. Recorded inIsNodeID's doc and pinned by a test rather than left implicit.A CUID-shaped rule cannot be told apart from an ordinary loc. CUIDs are letter-led lowercase alphanumeric, and so are plenty of locs. Across the 907 nodes in four memories, a
^[a-z][a-z0-9]{7,31}$rule captures 16 real locs:So
hadron node get preflightwould stop reporting "pass -m" and start reporting "not found" — trading a working, helpful path for a theoretical one. That's a strictly worse outcome than the gap it closes.And the gap is theoretical on this server. Every id I could sample is 32-hex — 907 nodes, 45 memories, 10 revisions, zero CUIDs. The identical
CUID / 32-char hexwording appears on the Memory and Agent ref descriptions too, which reads like a description of the PK column type rather than a live guarantee for node ids specifically.Nothing is lost. The narrow gate doesn't remove any capability: a CUID-backed node is still addressable by its URN exactly as before, and the round-trip failure #336 reports — an id the CLI printed not being accepted back — is fully fixed, because the ids it prints are 32-hex.
I did consider a server probe (try
node(ref:)for a colon-free non-hex ref, fall back to the usage error) which would handle CUIDs without the collision. I rejected it because it turns a pure client-side usage error into a network round-trip:TestNodeGetBareLocStillRejectedruns against an unreachablehttp://127.0.0.1:1today and gets clean guidance, and with a probe that becomes a transport error. Degrading the common typo case to fix an absent one isn't a good trade.If CUID-backed deployments turn out to be real, I'd rather add an explicit
--idflag than guess from shape — happy to file that.