Tags API (2017-03-31 family) - #38
Merged
Merged
Conversation
TagResource, UntagResource and ListTags on the classic Lambda tags routes
at /2017-03-31/tags/{Resource} — a third path prefix on the same listener,
belonging to neither MicroVM URI family. Resource is a whole ARN in one
path segment, which works because every taggable MicroVM-family ARN is
colon-separated with no slash in it.
Both mutations answer 204 with an empty body. The recorded fixtures for
those two steps are zero-byte files, which is what no content looks like on
disk and is easy to mistake for a failed recording. ListTags answers 200
with a Tags map, and an untagged resource gets an empty object rather than
null so a client can index it without a nil check.
Tags live with the package that owns the resource, not in a map here. A tag
set belongs to the thing it is on: an image's tags have to appear in the
image's own responses, and a copy kept in the tags package would be a
second truth that drifts the first time anything reads the wrong one. The
package routes an ARN to its owner and does nothing else, which is why
images.Image already had a dormant Tags field waiting for this.
VM and connector ARNs are taggable too, per the issue, and store tags that
never reach the wire. No recorded response for either carries a tags
member, and inventing one to show them would be a divergence on every read.
Tagging merges rather than replaces — it adds and overwrites the keys it
names and leaves the rest alone, which is what untag is for — and untag is
idempotent, which is what a reconciler converging on a desired tag set
needs. Neither was recorded; both are how the classic Lambda tags API
behaves and the alternative would make a reconcile loop non-converging.
Conformance: 71 pass, 0 fail, 0 unimplemented, 0 skipped, 29 of 29
operations exercised. /_m80/health reports 29/29 implemented with an empty
pending list. Every operation in the inventory now has both an
implementation and a fixture-backed case behind it.
Closes #14
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X6T4MeDN1RBiWaNtud6x77
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.
The three tagging operations on the classic Lambda tags routes at
/2017-03-31/tags/{Resource}— a third path prefix on the same listener, belonging to neither MicroVM URI family.Resourceis a whole ARN in one path segment, which works because every taggable MicroVM-family ARN is colon-separated with no slash in it. Based on main.Coverage is now complete
/_m80/healthreports 29/29 implemented with an empty pending list. Every operation in the inventory now has both an implementation and a fixture-backed case behind it — the first time the suite has run with nothing skipped and nothing unimplemented.Where tags live
Not in this package. A tag set belongs to the thing it is on: an image's tags have to appear in the image's own responses, and a copy kept centrally would be a second truth that drifts the first time anything reads the wrong one.
tagsdeclares aResourceinterface, routes an ARN to whichever package owns it, and does nothing else.images.Imagealready had a dormantTagsfield, initialised empty at create and never written — this is what it was waiting for.VM and connector ARNs are taggable too, per the issue's task list, and store tags that never reach the wire. No recorded response for either carries a
tagsmember, and inventing one to show them would be a divergence on every read.Recorded, and one thing worth a second look
Both mutations answer
204with an empty body. The fixtures for those two steps are zero-byte files — which is what no content looks like on disk, and is easy to mistake for a failed recording.ListTagsanswers200with aTagsmap, and an untagged resource gets an empty object rather thannull.Two behaviors are not recorded and I chose them deliberately: tagging merges rather than replaces (it adds and overwrites the keys it names, leaves the rest alone — which is what untag exists for), and untag is idempotent (removing an absent key is not an error). Both are how the classic Lambda tags API behaves, and the alternative in each case would make a reconciler converging on a desired tag set fail to converge — the same non-converging-loop failure mode
docs/floci.mdflags as the one that actually matters.TagKeysrides the query string astagKeys; the SDK repeats the parameter and m80 also accepts it comma-separated, since a human with curl will write it that way and neither costs anything.go build,go vet,gofmt,go test -raceclean.Closes #14