Skip to content

feat: a fixture value is the shape its format declares - #101

Merged
ShocOne merged 1 commit into
mainfrom
feat/fixtures-respect-format
Aug 14, 2026
Merged

feat: a fixture value is the shape its format declares#101
ShocOne merged 1 commit into
mainfrom
feat/fixtures-respect-format

Conversation

@ShocOne

@ShocOne ShocOne commented Aug 14, 2026

Copy link
Copy Markdown
Member

Phase 3. Every synthesised string was the attribute path behind a prefix,
whatever the document said the string held:

parsing time "tfpfgen-test-created-at" as "2006-01-02T15:04:05Z07:00"
"tfpfgen-test-agent-id" is not a uuid: invalid UUID format

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.

ir.Attribute.Format has carried the answer since #91; internal/fixtures
never read it.

What is synthesised

format value
date-time 2026-01-02T03:04:05Z
date / time 2026-01-02 / 03:04:05Z
uuid 00000000-0000-4000-8000-000000000000
byte / base64 the prefixed name, base64-encoded
email tfpfgen-test-…@example.invalid
hostname tfpfgen-test-….example.invalid
uri / url https://example.invalid/tfpfgen-test-…
ipv4 / ipv6 192.0.2.1 / 2001:db8::1

A 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 cleanup can match
it 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.invalid exist for
exactly 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:

pilot before #99 after #99 after #100 now
github 23 23 20 0
jamfpro 39 39 5 0
thousandeyes 11 11 3 0

unsupported.json unchanged on all three (835 / 255 / 361) — this changes
fixture values, not what generates. provider verify reports 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:

Error: Value Conversion Error
mismatch between struct and object: Struct defines fields not found in object: org

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 — pass
  • go test ./... — pass
  • provider generate + provider verify on all three — no drift

New test TestUnit_Fixturespec_AFormatDecidesTheValueShape checks each shape
parses (time.Parse, netip.ParseAddr, a uuid shape match — the toolkit takes
no uuid dependency), that the prefix survives where it can, and that a second
derivation is identical.

🤖 Generated with Claude Code

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>
@ShocOne
ShocOne merged commit e2e3915 into main Aug 14, 2026
2 checks passed
@ShocOne
ShocOne deleted the feat/fixtures-respect-format branch August 14, 2026 20:04
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.

1 participant