Skip to content

APP-15248 Update transforms to accept arbitrary IDs#399

Open
DTCurrie wants to merge 7 commits intomainfrom
APP-15248-update-transforms-to-use-arbitrary-ids
Open

APP-15248 Update transforms to accept arbitrary IDs#399
DTCurrie wants to merge 7 commits intomainfrom
APP-15248-update-transforms-to-use-arbitrary-ids

Conversation

@DTCurrie
Copy link
Collaborator

  • Updates NewTransform to accept an arbitrary ID value that it will use to generate a UUID in the transform namespace
  • If no ID is provided we generate based on the name and parent
  • If a UUID string is passed we use that
  • This removes the erroring on this function so includes some cleanup around that, more to come as features are added

Testing

I haven't really exposed this in any external API yet so should just be checking things work as expected.

@DTCurrie DTCurrie self-assigned this Feb 13, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

🦋 Changeset detected

Latest commit: cae5779

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@viamrobotics/motion-tools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

idBytes = parsedId[:]
} else {
// If the id is not a UUID, use it to generate a new UUID
newId := uuid.NewSHA1(transformNamespace, []byte(id))
Copy link
Member

@mattmacf98 mattmacf98 Feb 13, 2026

Choose a reason for hiding this comment

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

open for discussion, but I am not a huge fan of silently fixing the uuid, I think that will probably lead to people providing bad ids, this succeeding but then not being able to query for the transform since they thought the bad Id they gave was the one used

I think we should either return the error to the user if they give a bad uuid or better just don't take in the id param at all and generate one in the draw api that the user can extract from the returned transform if they want

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I thought about that. My reasoning here is more of a UX/ergonomics one, and not one I am married to, or maybe we should move up to the client level.

My thinking, as someone who was using these APIs to write the client code and tests, is that it adds a lot of boilerplate and annoyance to import a UUID library, create a UUID, then convert it to a string every time I want to draw something with updates/persistence. It was equally as annoying to accept an empty byte array when a standard uuid wasn't used. I might also have some other case where I want to assign some level of persistent ID but can't easily pass them down through, say, drawing geometries in a frame, where I may want to update those geometries after manipulating the frame instead of redrawing them.

The other option I was thinking of was to use the same optional-parameter pattern we have: the default is that id is an empty string, then have WithUUID, which expects an actual UUID, and WithID, which accepts an arbitrary ID string.

Copy link
Collaborator Author

@DTCurrie DTCurrie Feb 13, 2026

Choose a reason for hiding this comment

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

Thinking about it, I like that better since we are passing empty strings in a lot of places and that is annoying DX. Check out the updates.

@DTCurrie DTCurrie requested a review from mattmacf98 February 13, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants