Repository navigation
Conversation
X API exports can attach referenced tweets without author_id when the author expansion is missing. Rejecting the whole document dropped valid primary data rows. Strict validation remains on data tweets; unusable includes.tweets entries are skipped, counted in skipped, and reported via warnings so x-json-issues imports still close when errors is empty. Co-authored-by: Vitor Cepeda Lopes <vitor@vitorcepedalopes.com>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Always return warnings and skippedIncludes on x-json import results, preserve empty includes objects when the key is present, and expand tests for mixed includes, structural rejections, and include omission. Verification (bun canary + Node 26.10.0): check/build pass; 190 test files / 2570 tests pass. Co-authored-by: Vitor Cepeda Lopes <vitor@vitorcepedalopes.com>
|
Codex review: ready, awaiting a maintainer decision. What this changesThis PR skips invalid included tweet objects with warnings and separate counts while retaining strict primary-tweet validation. Example: Import primary tweet 880012 alongside included tweet 880013 without author_id and valid included tweet 880017.
Review scores
ProductKind: Preference · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⏳ Ready, awaiting maintainer decision This PR has useful, demonstrated behavior and no actionable correctness findings; an owner still needs to approve changing included-tweet validation failures into successful partial imports. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe offline x-json CLI validates saved X API responses before passing normalized tweets to shared transactional SQLite ingestion and search indexing. flowchart LR
A[Saved JSON or JSONL] --> B[x-json CLI]
B --> C[Validate primary tweets]
C --> D[Filter included tweets]
D --> E[Shared transactional ingestion]
D --> F[Counts and warnings]
E --> G[SQLite and search index]
Technical reviewBest possible solution: Keep filtering at the existing importer boundary, with an owner-approved policy for which included-tweet failures permit partial success. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically rejects the supplied missing-author include, and contributor-provided CLI output demonstrates that failure; no target code was run during this read-only review. Is this the best way to solve the issue? Filtering auxiliary records before shared ingestion preserves storage invariants and solves the demonstrated case, subject to approval of the broader acceptance policy. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against 17b14dfb486c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 18, 2026, 4:19 AM ET / 09:19 UTC (Revision 2). |
|
Added real behavior proof to the PR body (shipped CLI, synthetic fixture, before on 17b14df vs after on 37d62ad, bun canary + node 26.10.0). @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Extended the fix to null, scalar, and array entries in Verified failing-first with four synthetic cases, then all 71 import tests passed. Format/lint/typecheck and the production build passed on Linux through Crabbox. Independent Codex review found no remaining actionable P0–P2 findings. No paid X requests were made. Waiting for CI at the updated head before landing. |
|
Merged as 29eae2c after the updated head passed Bun primary, Node 26 compatibility, installed npm-package smoke, Playwright production-server checks, and GitGuardian: https://github.com/steipete/birdclaw/actions/runs/44852044558 The Linux gate also passed all 71 focused import tests, format/lint/typecheck, and production build. Synthetic regressions cover null, scalar, and array include rows as well as missing/invalid author IDs. Primary validation and malformed-container errors remain strict; no paid X requests were used. |
Summary
import x-jsonno longer rejects a whole document whenincludes.tweetscarries a referenced post without a usableauthor_id. Primarydatatweets still go through strictvalidateTweetRecord; invalid include rows are dropped and counted in a newskippedIncludesfield (skippedkeeps meaning "primary already imported"), andwarnings(always an array) explains which id was skipped and why. Structural problems (includesnot an object,includes.tweetsnot an array) still reject the document.Why skip instead of persisting with null author
Birdclaw tweet rows assume a numeric X user id for profiles and edges. Storing an include without
author_idwould either violate existing invariants iningestTweetPayloador invent placeholder authors. X often omits author expansion on unavailable or partial referenced tweets, so the include is auxiliary context. Dropping it preserves the primary import while leavingreferenced_tweetsids on the parent tweet intact.Verification
Verified against head
37d62ad4e1b488b31d71c38deba1a5bc0fc25eb4(on top of upstream/main17b14dfb486c18c4e3eb860875ffcfb66087f48f) with bun 1.4.0-canary.1 (./scripts/bun-canary.sh) and Node v26.10.0 (repo engine floor is>=26.5.1 <27).check(format + lint + typecheck)./scripts/bun-canary.sh run checkpassnpm run typecheckpassbuild./scripts/bun-canary.sh run buildpassnpm run build:nodepass./scripts/bun-canary.sh --no-env-file ./scripts/run-vitest.mjs run— 190 files, 2570 tests passnpm run test:node— 190 files, 2570 tests passAdded failing-first coverage with synthetic fixtures only: primary ok + include missing or non-numeric
author_id, mixed valid + invalid includes (valid include still ingested), and structural include errors still rejecting the document.Changelog
CHANGELOG.mdunder 0.17.2 – Unreleased.Real behavior proof
Synthetic X API v2 JSON only (
900001/synth_lab, tweet ids880012–880017). Each run uses a fresh isolated data root (BIRDCLAW_HOME=$TMP/birdclaw-xjson-proof-<label>, never~/.birdclaw) andBIRDCLAW_BACKUP_AUTO_SYNC=0. Fixture path:$TMP/synthetic-x-json.json.Fixture (
$TMP/synthetic-x-json.json){ "data": { "id": "880012", "author_id": "900001", "text": "synth quote parent proof", "created_at": "2026-03-01T12:00:00.000Z", "referenced_tweets": [ { "type": "quoted", "id": "880013" }, { "type": "quoted", "id": "880017" } ] }, "includes": { "users": [ { "id": "900001", "username": "synth_lab", "name": "Synth Lab" } ], "tweets": [ { "id": "880013", "text": "quoted include without author_id", "created_at": "2026-03-01T11:00:00.000Z" }, { "id": "880017", "author_id": "900001", "text": "valid quoted include still stored", "created_at": "2026-03-01T10:30:00.000Z" } ] } }Shared setup
(a) Before —
upstream/mainat17b14df(document rejected)import x-jsonoutput:{ "imported": 0, "skipped": 0, "errors": [ { "line": 1, "message": "Line 1: tweet.author_id must be a non-empty string" } ] }search tweetsoutput:(No rows in
tweets; primary880012was not ingested.)(b) After —
37d62advia shipped CLI (bin/birdclaw.mjs)Bun canary (primary lane):
Output:
{ "imported": 1, "skipped": 0, "skippedIncludes": 1, "errors": [], "warnings": [ "Skipped includes.tweets 880013: tweet.author_id must be a non-empty string" ] }Node ≥26.5.1 (same commit,
build:node+bin/birdclaw.mjs):Output (Node v26.10.0): identical JSON to Bun run above (
imported1,skippedIncludes1, warning names880013,errors[]).(c) After — lookup: primary stored, quote id retained, valid include ingested
From the Bun after run (
BIRDCLAW_HOME=$TMP/birdclaw-xjson-proof-after-bun):./scripts/bun-canary.sh bin/birdclaw.mjs search tweets "synth quote parent proof" --limit 5 --jsonOutput (trimmed):
[ { "id": "880012", "text": "synth quote parent proof", "accountId": "public", "kind": "home" } ]Output (trimmed): tweet
880012is present (text matches fixture);quotedTweetis null in this read path when the quoted body was skipped.Quote reference on disk (same DB, synthetic ids only):
Output:
[ { "id": "880012", "quoted_tweet_id": "880013" }, { "id": "880017", "quoted_tweet_id": null } ]Interpretation: primary 880012 imported;
quoted_tweet_idstill points at 880013; valid include 880017 ingested; 880013 skipped (no row).