feat: a fixture value is the shape its format declares - #101
Merged
Conversation
Every synthesised string was the attribute path behind a prefix, whatever the document said the string held. A generated SDK parses these on the way in — a timestamp becomes time.Time, an identifier becomes uuid.UUID — so the value was refused before any assertion in a generated test ran, and the failure named the parse rather than the field. The format now decides the shape. One that leaves room keeps the prefix, so a value left behind on a live API is still recognisable as debris; a timestamp and a uuid have no room and are fixed instead, which keeps them deterministic. An address is TEST-NET-1 and a host is under example.invalid, so a value that escapes into a request reaches nothing real. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Phase 3. Every synthesised string was the attribute path behind a prefix,
whatever the document said the string held:
A generated SDK parses these on the way in — a timestamp becomes
time.Time,an identifier becomes
uuid.UUID— so the value was refused before anyassertion in a generated test ran, and the failure named the parse rather than
the field.
ir.Attribute.Formathas carried the answer since #91;internal/fixturesnever read it.
What is synthesised
date-time2026-01-02T03:04:05Zdate/time2026-01-02/03:04:05Zuuid00000000-0000-4000-8000-000000000000byte/base64emailtfpfgen-test-…@example.invalidhostnametfpfgen-test-….example.invaliduri/urlhttps://example.invalid/tfpfgen-test-…ipv4/ipv6192.0.2.1/2001:db8::1A format with room keeps the prefix, so a value a test leaves behind on a
live API is still recognisable as toolkit debris and
audit cleanupcan matchit by name. A timestamp and a uuid have no room; they are fixed instead, which
keeps them deterministic — the whole scheme rests on a regenerated fixture being
byte-identical.
The reserved ranges are deliberate: TEST-NET-1 and
example.invalidexist forexactly this, so a value that escapes into a request reaches nothing real.
Measured effect
Every generated list-resource test now passes, on all three pilots:
unsupported.jsonunchanged on all three (835 / 255 / 361) — this changesfixture values, not what generates.
provider verifyreports no drift(4384 / 3895 / 1798 files).
What this uncovers
With the parse failures gone, the datasource suites show their own next family —
167 occurrences of:
Masked until now behind the schema-load failure #99 fixed. That is Phase 4 and
is not attempted here.
Gates
gofmt,repo_hygiene_gate.sh,golangci-lint(0 issues),go build/go vet— passgo test ./...— passprovider generate+provider verifyon all three — no driftNew test
TestUnit_Fixturespec_AFormatDecidesTheValueShapechecks each shapeparses (
time.Parse,netip.ParseAddr, a uuid shape match — the toolkit takesno uuid dependency), that the prefix survives where it can, and that a second
derivation is identical.
🤖 Generated with Claude Code