Repository navigation
Capture how X behaves today, and promote it into fixtures - #714
Merged
Merged
Conversation
#709 establishes how X behaves today, through a human-driven proxy session against seeded test accounts. X's anti-automation measures mean the walk itself cannot be automated, but the work around it can be: seeding an account by hand is roughly two hundred actions, and turning a HAR export into fixtures by hand is error-prone. So this adds the tooling and the written record the walk needs, and nothing that pretends to replace the human. - `scripts/x-capture/lib/har.ts` decodes a DevTools HAR into per-operation records: operation names, the rotating GraphQL identifiers, the referrers X's own client sends with mutations, rate limits reported inside an otherwise-successful response, explicit empty-state signals, and timeline entry counts. Only the referrer is kept from the request headers, so no cookies or authorization tokens reach the decoded output. - `scripts/x-capture/decode-har.ts` writes that out, per operation, with a summary of what a capture session did and did not answer. - `scripts/x-capture/promote-fixture.ts` copies the few responses the tests need into `testdata/x/`, using the existing dated filename convention. - `scripts/x-capture/seed.ts` drives a real Chromium to seed a test account: three pages each of posts, likes, and bookmarks, plus the content shapes that have historically broken parsing. It is resumable, paced, and stops rather than pushes whenever X shows it something unexpected. A selector it cannot find is evidence, so it is screenshotted and logged. - `docs/x-capture/element-inventory-20260914.md` records every route, GraphQL identifier, and element the automation waits for or clicks, marking which are anchored on a stable test identifier and which are reached positionally. This is the half of the problem no HTTP capture can answer. - `docs/x-capture/capture-walk-20260914.md` is the ordered walk: every non-destructive flow to completion first, because deleting destroys the data the read captures need. Two findings already fall out of reading the automation: the posts index job passes no empty-state selector at all, while likes and bookmarks both pass one, and the unfollow flow is driven entirely by position through `div[data-testid="cellInnerDiv"] button button`. Raw HARs, browser profiles, and seed media stay under the ignored `capture/` directory and are never committed. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The walk needs a capture account, a source account, and an empty account, and which is which decides what survives it: the capture account is destroyed by the delete walk, while the source account's content is what makes re-seeding cheap next time. Also point likes and bookmarks at the source account's profile rather than the home timeline, which on a fresh account is thin and algorithmic, and reuse each account's seeding profile for its own leg of the walk so three logins stay apart. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X's poll editor opens with two choice fields and a control to add more, so `input[name="Choice3"]` does not exist until that control has been clicked. Seeding a three-choice poll failed on the third field. The control carries no test identifier, so it is reached by its accessible name. If it cannot be found, the poll is posted with the choices that do exist rather than abandoned: two choices is still a poll, and the poll is the shape being seeded. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X disables the repost control outright on posts nobody is allowed to repost, which a protected account's posts are. Playwright waited the full thirty seconds for a button that was never going to enable, and reported a timeout on a selector that was in fact present and correct. Check for the disabled state first and say what is wrong, since the fix is to pick a different target rather than to fix a selector. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X disables reposting for protected accounts, so the repost control is greyed out on every post the account sees, public ones included, and the retweet, quote, and orphaned-retweet shapes cannot be seeded at all. The walk locks the account at the end anyway, as the tombstone step, so starting unprotected is the correct order rather than a concession. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Unprotecting the acting account did not re-enable the repost control, so the earlier explanation was wrong: the restriction belongs to the post, which X badges with a slashed-repost glyph in its header, not to the account doing the reposting. Say that instead, and tell the reader to check a target post before using it rather than to go looking for a setting that will not help. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X keeps a mask in its #layers subtree while a composer is open as a modal, and it intercepts pointer events aimed at the text field underneath. Playwright correctly reported the field as visible, enabled, and stable, then spent thirty seconds retrying a click that could never land. Typing does not need the pointer: focus the field directly and send the keys. The post button still sees the input events it waits for. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X carries these in `limitedActionResults.limited_actions[]`, naming actions such as Retweet and QuoteTweet alongside the prompt it shows the user. It is the server-side reason a control is greyed out, found while working out why one test account's posts could not be reposted. Worth surfacing beyond that diagnosis: it is a response shape the save work has to parse, and a delete or unretweet aimed at such a post is a mutation X will refuse, so the delete work needs to recognise it rather than read the refusal as a failure of its own. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Seeding an account takes hours, and every prompt in the run is a prompt nobody is there to answer: a background run would hang on the first hiccup rather than carry on. Unattended, a step that fails is retried three times and then skipped, and the run ends without waiting to be dismissed. X interrupting the session still stops the run, because clearing that needs a person and grinding against it is how an account gets locked. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The seeder clicked post, waited three seconds, and recorded success without checking anything. When X refused the posts — the account hit its daily post cap — the seeder recorded forty-two posts that do not exist, and the progress log said the work was done. The composer closing is the only evidence a post was accepted, so wait for that. A refusal leaves the composer open with the text still in it, and X names the daily limit in a banner: that stops the run outright, because everything after it would be refused the same way and the limit lasts about a day. Adds `check-seeded.ts`, which reads the profile timeline back and reports which filler posts actually exist, repairing the progress log so a later run makes the ones that do not. Also clear a stuck composer before retrying or moving on: an open composer swallows pointer events, which is why every like after the refusal failed too. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two independent breakages produce #710's one symptom, both seen today against a seeded test account. X's profile timeline now issues `UserOriginalsTimeline`. Cyd recognises a timeline response by matching its URL against `/UserTweetsAndReplies?`, `/Likes?`, or `/Bookmarks?`, so every page of posts is captured by the proxy and then discarded unparsed. And `/with_replies`, the route Cyd loads to save and to delete posts, now returns replies only: four items for an account whose profile timeline held about seventy-four posts. Even with the parsing fixed, that route no longer holds the posts. Refs #709, #710 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Clearing a stuck composer navigates to the home timeline, and the next like or bookmark then acted on whatever was there rather than on the feed it was told to use. Seen at the tail of a bookmarks run, where three steps failed looking for a bookmark control on the home timeline instead of the source account's profile. Resetting the reload counter sends the next feed action back to the right feed. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The orphaned retweet was seeded as #709 asks, and afterwards the repost was not on the reposting account's timeline at all: no tombstone, no placeholder, nothing to open. So the shape cannot be produced by reading a timeline. It arises only in data already saved and orphaned since, or on the delete side when a repost whose original is gone is undone — which is a different fixture from the one the ticket assumed. The decoder now counts every GraphQL type in a response, which settles by evidence whether X returns a tombstone that simply is not rendered, and describes response shapes generally. Adds `list-permalinks.ts`, which reads the seeded shapes' permalinks back off the timeline: nothing recorded them at posting time, and deleting makes them unrecoverable. Refs #709, #710 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two problems with capturing by hand. DevTools cannot export an hour of X: "Copy all as HAR" fails silently at that size, the export arrow takes one request at a time, and there is no save-all. And Playwright's own `recordHar` writes only when the context closes, writing nothing at all if the browser window is closed first — an entire walk lost to a misplaced click. So capture responses as they arrive and rewrite the file as it goes, and walk the read flows from a script: every timeline scrolled until X stops fetching, every seeded shape's permalink opened. Scrolling until the requests stop is the only reliable end, since X recycles the rows it has rendered rather than growing the page. On each surface, every selector the automation depends on is counted. A selector matching nothing on the surface that needs it is precisely the silent breakage this exercise is for, and counting it is evidence where reading the code was inference. The destructive flows stay hand-driven, and `record-walk.ts` remains for them. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`UserTweetsAndReplies`, the operation Cyd matches on for posts, was not issued once in a full read walk. X has split it in two and renamed both halves: `UserOriginalsTimeline` for the profile timeline and `UserRepliesTimeline` for the replies route. Likes and bookmarks kept their names, so those still match. Posts match nothing at all, on either route. The user object has also lost its `legacy` sub-object entirely — the author fields are in `core` now — so a guard requiring `legacy.screen_name` rejects every entry. #707 described fields moving; what is there is a sub-object that no longer exists. The end of a timeline is a response carrying cursors and no posts. Likes redirect into the `/i/` namespace, which is both the URL-changed error and the referrer the unfavourite mutation should be sending. And the markup is not what broke: every selector the automation depends on was counted on every surface that uses it, and they all match. A stable `-unfollow` identifier now exists alongside the positional selector #711 wants to replace. Refs #709, #710, #711 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
X answers every timeline query with a 404 when the session is not logged in, which from the outside looks like a walk that found nothing: the empty-state capture appeared to succeed and recorded three 404s. That is the same failure as recording a post that was never made. Check the session before walking, and say which command logs it in. Refs #709 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Captured from an account with nothing in it. X gives no explicit empty-state signal at all: no noResults, no alert entry, nothing. An empty timeline is simply a page with no post entries — the profile timeline returns a who-to-follow module and two cursors, the others return cursors alone. In the page, `emptyState` is present on empty likes, bookmarks, and following, and absent on the empty profile timeline. So the asymmetry #710 describes is real and worse than it looked: the marker Cyd would check for does not exist on that page, and no selector would have helped. What tells empty from broken is not a marker but whether a timeline response was recognised at all. A recognised response with no posts means the account is empty and the run should finish quietly; no recognised response means something is wrong and the run should say so. That is exactly today's failure, and it needs nothing from X to detect. Refs #709, #710 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Driven through X's own interface rather than by issuing mutations directly, because what the delete work needs is what X's client actually sends: which operations, with which identifiers, and with which referrers — the part Cyd currently gets wrong, since two of its referrers point at routes that redirect. The order is #709's: least destructive first, the account locked only at the end and unlocked again after, so a failure early costs as little as possible. One step repeats a delete that already succeeded, replaying the request X's own client sent. That is the response to a mutation aimed at something no longer there — the case an orphaned retweet would have produced, which no timeline read can supply. The replay reuses the captured authorization rather than a token copied into this repository. Refs #709, #711 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
All three delete referrers Cyd sends are wrong, not two as #711 assumed. X sends the profile route for DeleteTweet, `/i/history/likes` for UnfavoriteTweet, and `/i/history` for DeleteBookmark — which is not the bookmarks route at all. Of the identifiers, only DeleteTweet has rotated; unfavourite and delete-bookmark are still the values in the code. Unfollowing, changing the bio, and locking the account are not GraphQL at all but single REST calls. Deleting a post that is already deleted returns HTTP 200 with an empty body, so a job checking only the status reads it as success. The replay omitted the per-request transaction header X's client sends, so that is recorded with the caveat it deserves. And reposts are not on the profile timeline. `UserOriginalsTimeline` is named for what it returns: no repost entry appeared anywhere in the capture, and the undo-repost control was never present. Cyd's retweet deletion loads that route expecting to find them, so #711 needs to establish where they live now. Refs #709, #711 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reposts are at /<username>/reposts, served by `UserRepostsTimeline`. Undoing one is `DeleteRetweet`, a different operation from the one Cyd sends, with a different variable: `source_tweet_id`, naming the original post rather than the repost. So the delete work needs a third route, a fourth operation, and an identifier the saved data has to carry. A rate limit is an HTTP 429 with the plain-text body "Rate limit exceeded" and x-rate-limit-limit, -remaining, and -reset headers. It bit peripheral calls first while the timeline operations kept answering. The disguised form #707 assumes — a successful status carrying an errors array — was not seen once across four captures totalling some two and a half thousand calls. Anything built for it should be defensive rather than written against a fixture nobody has. Refs #709, #710, #711 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three things were missing, and one thing I claimed was not true. The `Viewer` operation is never issued by X's own client, so it was asked directly. It still answers 200 and still returns `legacy`, with every field Cyd reads. The `legacy` removal applies to the timeline operations' user objects, not to this one, so Cyd's account lookup is not broken and the same parsing cannot serve both shapes. Changing the banner — the tombstone job that was never implemented — is a single POST to /1.1/account/update_profile_banner.json, behind a crop step at `applyButton`. Both clicks have to go through the element's own click(), because the settings dialog keeps a mask that swallows pointer events, which is also why the first two attempts timed out. An empty reposts timeline returns cursors and shows the page marker, so it behaves like likes and bookmarks rather than like the profile timeline. The correction: an earlier commit said the delete replay used the captured authorization rather than a token copied into this repository. That edit had silently failed to apply and the hardcoded token was still there. It is gone now, and the replay reads its authorization from the captured request. Refs #709, #710, #711 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Twenty-four decoded responses from the 2026-09-14 capture, chosen for what #710 and #711 have to be built against and no more: three populated pages and the cursor-only end page for posts, likes, and bookmarks; one page each of replies and reposts; every timeline as an empty account returns it; the four delete mutations; and the Viewer response. The accessors say what each fixture shows, and test_fixtures.test.ts asserts it, so the findings cannot quietly drift away from the files. Two shapes are deliberately absent. The rate limit has no JSON body to promote — X answers 429 with plain text — so the status and headers live in GraphQLResponses.rateLimitError instead, which until now claimed an errors array that the capture never saw. The long-form post and the rate limit disguised as a success were never observed at all, and inventing either would assert a shape nothing vouches for. TESTDATA_DIR walked one directory too many, so every accessor in this file has always thrown. Nothing called them, so nothing noticed until now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two findings came out of promoting the fixtures, both from running a parser over them rather than from looking at them. Replies are not top-level entries. UserRepliesTimeline returns no `tweet-` entries at all: each reply is a TimelineTimelineModule keyed `profile-conversation-<id>`, holding the parent post and the reply as items, whose content sits under `item.itemContent` rather than `content.itemContent`. A parser walking top-level entries finds nothing there even once it is aimed at the right operation. And an empty profile timeline is not an empty response — it still carries a who-to-follow module and two cursors, while the other timelines return cursors or nothing. So "zero entries" is not the emptiness test; "zero post entries" is, which sharpens finding 7 rather than contradicting it. promote-fixture printed the same accessor key for every page of a multi-page promotion. The accessor has to be numbered the way the filename is, so the two rules now sit together in lib/har.ts with a test holding them in step. 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.
Closes #709. Part of the epic in #707; unblocks #710 and #711.
Establishes ground truth for how X behaves today, so the repair work in #710 and
#711 is driven by observation rather than inference. Everything here was
observed in a real browser session against seeded test accounts on 2026-09-14.
The full write-up is on the issue.
The detail lives in
docs/x-capture/findings-20260914.md(every finding,numbered, with its impact) and
docs/x-capture/element-inventory-20260914.md(routes, operations, identifiers, referrers, and every selector with its
observed match count).
What this changes
Nothing in the shipping app. This is tooling, documentation, and fixtures — the
scripts/x-capture/code is not imported by Cyd and the rootpackage.jsondoes not depend on it.
scripts/x-capture/— seeds a test account through a real browser,records a walk to a HAR, decodes it per-operation, and promotes chosen
responses into
testdata/x/.README.mdcovers how to run it.docs/x-capture/— the findings, the element inventory, and the walk.testdata/x/— 24 fixtures (~2.7 MB) from the capture, with accessors andtests in
src/renderer/src/view_models/XViewModel/.The headline
UserTweetsAndReplies— the operation Cyd matches timeline responses on — wasnot issued once in a full read walk. X has split it, renamed both halves, and
moved reposts to a third route. Posts now match nothing at all, on either route:
the pages are captured by the proxy and discarded unparsed. That is the silent
zero-posts failure in #710.
Three further shape problems sit behind the same failure: timeline user objects
have no
legacyat all (author fields are incore, thoughViewerstillreturns
legacy, so the two cannot share a parser); replies arrive nestedinside
profile-conversation-*modules rather than as top-level entries; andreposts are on their own route, undone by their own operation taking the
original post's id.
All three delete referrers Cyd sends are wrong — not two, as #711 assumed — and
one identifier has rotated.
Two things the ticket assumed turned out not to exist: there is no explicit
empty-state signal on any timeline, and a rate limit reported inside a
successful response was never seen across ~2,500 calls. X answers 429 with the
plain text
Rate limit exceeded.Fixtures
Only what the tests need, following the existing dated convention: three
populated pages plus the cursor-only end page for posts, likes, and bookmarks;
one page each of replies and reposts; every timeline as an empty account returns
it; the four delete mutations; and the
Vieweraccount lookup.test_fixtures.test.tsasserts what each fixture shows, not just that itloads, so the findings cannot quietly drift away from the files. That caught
three things worth calling out in review:
TESTDATA_DIRwalked one directory too many, so every accessor in that filehad always thrown, including the pre-existing ones. Nothing called them, so
nothing noticed.
GraphQLResponses.rateLimitErrorclaimed a JSONerrorsarray that X doesnot send. Corrected to the observed 429 plus its
x-rate-limit-*headers.the nested replies above, and that an empty profile timeline is not an empty
response (it still carries a who-to-follow module), so the test is "zero
post entries", not "zero entries".
Deliberately not promoted: the rate limit, because a plain-text body is not
a JSON fixture; and the long-form post and the disguised rate limit, because
neither was ever observed and inventing them would assert shapes nothing
vouches for.
Review notes
capture/is git-ignored in full — 2.0 GB ofHARs and Chromium profiles holding live session cookies for three test
accounts. Verified with
git check-ignore, and nocapture/path or.harfile appears anywhere in this branch's history.
posts, captured from a seeded test account's likes and bookmarks, including
one account's business email in its public bio. This follows the precedent of
the existing fixtures in
testdata/x/, but it is a fresh publication ratherthan an inherited one, and is worth a deliberate look.
human at a physical machine. Seeding is automated as a deliberate trade; the
README says why and what the risk is.
Testing
npm test— 115 files, 1498 tests, no type errors.npm run lintclean.Follow-ups
exists. That is where the orphaned-retweet case in Save X data again: posts, likes, and bookmarks #710 actually lives, and
this capture could not reach it — a repost does not survive its original being
deleted, leaving no timeline entry to capture.
post, promoted fixture) belongs in
CONTEXT.md, which is currentlyBluesky-only.
🤖 Generated with Claude Code