fix(twitter): repair search and tweets readback#1512
Conversation
3b1b0e3 to
a751a0c
Compare
…ns empty
The bundle parser in resolveTwitterOperationMetadata locates the queryId via
`queryId:"..."` inside a ~2500-char snippet around the operationName marker,
then independently extracts `featureSwitches:[...]` and `fieldToggles:[...]`
via separate regexes. When minification rearranges the snippet (or the
snippet window truncates before the array), either regex can miss while
queryId still resolves; keysToFlags(undefined) then returns {}.
sanitizeTwitterOperationMetadata previously accepted any object as
features / fieldToggles, including {}. Twitter's GraphQL endpoint rejects
SearchTimeline / UserTweets requests with empty features (HTTP 400),
surfacing a misleading "queryId may have expired" error — the queryId is
fresh; only the feature flags are missing.
Guard against this by deferring to the baked fallback whenever the resolved
map is empty. Adds a JSDOM-free unit test that, reverse-validated, fails on
the un-fixed code with the exact silent-fallback shape.
Refs PR jackwener#1512
|
Maintainer-edit The bug
The fix Defer to the baked fallback whenever the resolved map is empty: features: value?.features
&& typeof value.features === 'object'
&& Object.keys(value.features).length > 0
? value.features
: normalizedFallback.features,Reverse-validation I stashed the production change and ran just the new test against unfixed code: Confirms the test would have caught the bug. Tests + audits
|
Summary\n- switch twitter/search to the current SearchTimeline POST GraphQL path instead of brittle SPA navigation\n- resolve current X operation metadata from loaded client bundles and normalize Browser Bridge GraphQL payload envelopes\n- repair twitter/tweets parsing for current UserTweets payloads and add post id/url readback columns\n\n## Verification\n- npx vitest run --project adapter clis/twitter/search.test.js clis/twitter/tweets.test.js clis/twitter/post.test.js clis/twitter/shared.test.js\n- npm run typecheck\n- npm run build\n- npm run check:silent-column-drop\n- live: node dist/src/main.js --profile 86v9bx9k twitter search "VibeShare agent publishing" --limit 1 -f json --trace retain-on-failure\n- live: node dist/src/main.js --profile 86v9bx9k twitter tweets darthjajaj6z --limit 1 -f json --trace retain-on-failure