Skip to content

Add golden and live tests, and fix a profile timeline that borrowed other people's tweets - #51

Merged
tamnd merged 3 commits into
mainfrom
test/goldens-and-live
Jul 28, 2026
Merged

tamnd merged 3 commits into
mainfrom
test/goldens-and-live

Conversation

@tamnd

@tamnd tamnd commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Closes the three testing items left open on #20: goldens (doc 06 section 5.2), live tests behind a build tag (5.5), and the anonymous baseline matrix (5.6).

Goldens

Every fixture goes through the decoder that reads it and the whole record it produced is committed under x/testdata/golden/. The rest of the suite checks the fields somebody thought to check. This one checks everything, which is how a field that quietly stopped being filled shows up.

The surface-8 cases golden the records rather than the Page, because a Page still holds the Relay store it was parsed out of, and pinning that would commit a second, larger copy of a fixture already in the tree.

go test ./x/ -update rewrites them, and it is the same -update that rewrites fields_gen.go. A second test asserts the directory holds exactly the files the cases produce, so a golden nothing compares against cannot sit there looking like coverage.

Live tests

go test -tags live ./... talks to X. Off by default and not in CI. Shapes rather than values, except for tweet 20 and @jack's join date, which are not going to change.

X_LIVE_TIER is the ceiling, default 0, so the plain run is anonymous and the guest and session tests skip. Every tier gets its own temp data dir, so a tier-0 test cannot quietly succeed on the developer's own session.

The baseline matrix builds the binary and runs it with an empty HOME, because the criterion is about what a person gets when they type the command. stdout and stderr are checked apart: X hands out rate-limit warnings often enough that reading them as one blob would have hidden a warning landing on stdout.

The bug the live run found

x timeline jack --tier 0 listed tweets by @callebtc and @wesbillman. The profile page renders a reply with the tweet it answers, its JSON-LD carries both, and TimelineFromWeb passed both through. Wrong twice over: the account did not post them, and each one spent one of the caller's -n.

Postings still returns them, since on a status page the other authors are the replies and they are the answer. The filter belongs to the timeline read.

A repost is the case this cannot get right. The page shows it under the original author and says nothing about the repost, so it looks exactly like a reply parent. Dropping one is the smaller error.

The committed profile_jack.html.gz had four of these in it the whole time.

Checks

  • gofmt -l ., go vet ./..., go test ./... clean
  • golangci-lint run and golangci-lint run --build-tags live both 0 issues
  • go test -tags live ./x/ passes at tier 0, and at tier 1 with X_LIVE_TIER=1
  • go test -tags live ./cli/ passes all four baseline cases live

tamnd added 3 commits July 29, 2026 06:01
Each fixture goes through the decoder that reads it and the whole record
it produced is committed as JSON. The rest of the suite checks the fields
somebody thought to check; this one checks everything, which is how a
field that quietly stopped being filled shows up.

The surface-8 cases golden the records rather than the Page, because a
Page still holds the Relay store it came out of and pinning that would
commit a second copy of a fixture already in the tree.

go test ./x/ -update rewrites them, alongside fields_gen.go.
The x.com profile page renders a reply with the tweet it answers, so its
JSON-LD carries both, and TimelineFromWeb was passing both through. Live
at tier 0, two of the first six rows of @jack were by @callebtc and
@wesbillman. Wrong twice over: the account did not post them, and each
one spent one of the caller's -n.

Postings still returns them, because on a status page the other authors
are the replies and they are the answer. The filter belongs to the
timeline read.

A repost is the case this cannot get right. The page shows it under the
original author and says nothing about the repost, so it looks exactly
like a reply parent and goes with it. Dropping one is the smaller error.

The committed profile_jack capture already had four of these in it.
go test -tags live ./... talks to X. Off by default and not in CI,
because a suite that goes red when somebody else's website has a bad
afternoon is a suite people stop reading.

Shapes rather than values, since favorite_count moves every minute and
the presence of favorite_count does not. Tweet 20 is the exception: it
was posted in 2006 and is not going to change its mind.

X_LIVE_TIER picks the ceiling, default 0, so the plain run is anonymous
and the guest and session tests skip.

The baseline matrix drives the built binary with an empty HOME, which is
the isolation that caught the data-dir defect. --data-dir would have
passed against that bug.
@tamnd
tamnd merged commit ea8f154 into main Jul 28, 2026
7 checks passed
@tamnd
tamnd deleted the test/goldens-and-live branch July 28, 2026 23:02
@tamnd tamnd mentioned this pull request Jul 28, 2026
84 tasks
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