Skip to content

fix(timeline,dms,lists): restore cached home timeline rows and validate DM/List CLI inputs - #261

Closed
saariuslystoned wants to merge 3 commits into
steipete:mainfrom
saariuslystoned:fix/timeline-dms-lists-and-http-query-contracts
Closed

saariuslystoned wants to merge 3 commits into
steipete:mainfrom
saariuslystoned:fix/timeline-dms-lists-and-http-query-contracts

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Restore cached home timeline rows, account edges, and FTS entries on sync timeline cache hits via persistCached in runCachedLiveSyncEffect, while preserving newer stored tweet metrics (preserveExisting: true), checking options.preserveExisting before calling reconcileCanonicalXProfileIdentity (and disabling handle-collision reassignment during cache hydration so older cached handles never displace an existing canonical profile or rename a current owner to birdclaw_stale_*), and skipping persistCached writes when BIRDCLAW_DEPLOYMENT_READ_ONLY=1 so read-only cached archives remain readable without database writes.
  • Enforce parseLivePageSize(limit, { min: 1, max: 100 }) inside fetchViaXurl during dms sync --mode auto so limit > 100 falls back to bird when available instead of sending an out-of-range max_results request to Xurl.
  • Validate mutually exclusive --replied / --unreplied flags and --sort (recent | followers) in dms list, and validate --limit >= 1 in lists members before database lookup.
  • Keep /api/query and web route-search unchanged on main (9895445ba0a24134cc6e07c327502134e18a58ea).

Real Behavior Proof (dist/cli/birdclaw.js — Base v0.17.0 @ 9895445ba0a2 vs Head @ 69928a5c563e)

1. Home Timeline Cache Restoration, Handle-Ownership Preservation (user 42: @sam -> @alice, user 43: @sam), & Read-Only Cache Access (BIRDCLAW_DEPLOYMENT_READ_ONLY=1)

=== 2. HOME TIMELINE CACHE RESTORATION + HANDLE-OWNERSHIP PRESERVATION (user 42: @sam -> @alice, user 43: @sam) ===
Base sync timeline cache hit (fails to restore home edge 910):
{
  "source": "cache",
  "count": 1
}
0
Head sync timeline cache hit (restores home edge 910 while preserving like_count=99, user 42 as @alice, and user 43 as @sam):
{
  "source": "cache",
  "count": 1
}
acct_primary|910|home
910|99
profile_user_42|alice|New Sam|250
profile_user_43|sam|Current Sam|500
Head read-only cached sync timeline (BIRDCLAW_DEPLOYMENT_READ_ONLY=1):
{
  "source": "cache",
  "count": 1
}

2. Auto DM Xurl Limit & CLI Input Validation (dms sync --mode auto --limit 101, dms list, lists members)

=== 3. AUTO DM XURL LIMIT & CLI INPUT VALIDATION (BASE vs HEAD) ===
--- Base vs Head: dms sync --mode auto --limit 101 --refresh ---
{
  "ok": true,
  "source": "xurl",
  "accountId": "acct_primary",
  "conversations": 0,
  "messages": 0
}
{"error":"xurl: --limit must be between 1 and 100\nbird: Command failed: ... bird whoami\nbirdclaw-bird: line 0: exec: bird: not found\n"}
--- Base vs Head: dms list --replied --unreplied ---
{
  "count": 2
}
{"error":"Cannot combine --replied and --unreplied"}
--- Base vs Head: dms list --sort bogus ---
{
  "count": 4
}
{"error":"--sort must be recent or followers"}
--- Base vs Head: lists members builders --limit 0 ---
{"error":"No cached List matches name builders; run birdclaw sync lists"}
{"error":"--limit must be at least 1"}

3. v0.17.0 Archive Upgrade & backup export / backup validate Compatibility

{
  "ok": true,
  "repoPath": "/private/tmp/bc-export-261",
  "counts": {
    "accounts": 2,
    "collections_bookmarks": 2,
    "collections_likes": 3,
    "dm_messages": 8,
    "dm_conversations": 4,
    "link_occurrences": 3,
    "url_expansions": 3,
    "profile_snapshots": 4,
    "profiles": 8,
    "timeline_edges_home": 6,
    "timeline_edges_mention": 2,
    "tweet_revisions": 2,
    "tweets": 8
  },
  "backupHash": "25fff134ee8d5a3f5c1d942704382d3b4c561ae4c3317dbd6c927a95806b6e74",
  "errors": []
}

Verification

  • ./node_modules/.bin/oxfmt --check src/cli/register-dms.ts src/cli/register-lists.ts src/lib/dms-live.ts src/lib/live-sync-engine.ts src/lib/timeline-live.ts src/lib/tweet-repository.ts src/lib/x-profile.ts src/cli/local-commands.test.ts src/lib/dms-live.test.ts src/lib/timeline-live.test.ts
  • ./node_modules/.bin/oxlint --deny-warnings src/cli/register-dms.ts src/cli/register-lists.ts src/lib/dms-live.ts src/lib/live-sync-engine.ts src/lib/timeline-live.ts src/lib/tweet-repository.ts src/lib/x-profile.ts src/cli/local-commands.test.ts src/lib/dms-live.test.ts src/lib/timeline-live.test.ts
  • ./node_modules/.bin/tsc --noEmit
  • node ./scripts/run-vitest.mjs run src/lib/timeline-live.test.ts src/lib/dms-live.test.ts src/cli/local-commands.test.ts (69/69 passed)

Known gaps

GitHub Actions CI has not run on this head. The workflow is waiting for a maintainer to approve it. The verification above is local: unit tests and the shipped CLI against a local archive, not a live X account.

☁️

@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR restores cached home timeline data while preserving newer records and rejects invalid DM and List CLI inputs.

Example: Run sync timeline with a fresh cache containing tweet 910 after its home membership was removed.

  • Before: The command reports one cached result but leaves the home membership missing.
  • After: The command restores acct_primary's home membership for tweet 910 while retaining its newer like_count of 99.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused repairs with shipped-CLI and existing-archive evidence; no actionable introduced defect found.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Supplied terminal output exercises the built CLI at the reviewed head against a v0.17.0 archive: home membership restoration preserves newer metrics and reassigned handles, read-only cache access succeeds, and invalid DM/List inputs are rejected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Cached timeline sync can report success without restoring local results, and invalid DM/List inputs can reach reads or inappropriate transports.
Reason: These repairs enforce existing archive and CLI contracts while retaining valid aliases, transport fallbacks, and stored values.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes current cache-restoration and CLI-validation bugs, with no actionable introduced defect found.

Priority: P2
Reviewed head: 69928a5c563ecf66e57b2b59568f7cde49edd1c9

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied automated-test report does not demonstrate base-fail/head-pass results for the newly added regression tests.
Agent review details

How this fits together

CLI commands select an account and read cached or live transport payloads; shared ingestion stores profiles, tweets, account memberships, and searchable text in SQLite.

flowchart TD
 A[CLI input validation] --> B[Account and transport selection]
 B --> C[Bird and Xurl]
 B --> D[Response cache]
 C --> E[Shared tweet ingestion]
 D --> E
 E --> F[SQLite archive and search index]
Loading

Technical review

Best possible solution:

Restore cached timeline data through existing ingestion owners while preserving newer stored values, numeric identity, and read-only access.

Do we have a high-confidence way to reproduce the issue?

Current-main source shows the missing home-cache persistence hook and auto-DM Xurl limit check, corroborated by contributor-supplied base/head CLI output.

Is this the best way to solve the issue?

The patch uses existing cache, ingestion, identity, and numeric-validation owners and resolves the previous preservation findings without a new user-facing setting.

AGENTS.md: not found in the target repository.

Codex review notes: model internal, reasoning medium; reviewed against 9895445ba0a2.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 131f6a1 adds src/lib/x-profile.ts:201 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 131f6a1a7074; files: src/lib/x-profile.ts)
  • Travis Fischer: Raw commit b22ced0 adds src/lib/dms-live.ts:804 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b22ced0110ce; files: src/lib/dms-live.ts)

Preflight source

Source 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

Metric Value Why it matters
Production and test changes Production +119/-29; tests +445/-0 lines Most growth covers CLI rejection boundaries, transport limits, SQLite restoration, and preservation without introducing another production subsystem.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The PR repairs bounded cache-restoration and command-validation bugs without evidence of an urgent widespread regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-08T21:49:54.617Z sha 179e26c :: needs real behavior proof before merge. :: [P2] Preserve newer stored values when replaying the home cache | [P3] Tell callers how to correct rejected query filters
  • reviewed 2026-11-09T00:41:02.871Z sha 3e36a68 :: needs real behavior proof before merge. :: [P2] Preserve handle ownership before reconciling cached profiles
  • reviewed 2026-11-09T01:33:26.805Z sha 69928a5 :: needs maintainer review before merge. :: none

Reviewed November 8, 2026, 8:38 PM ET / November 9, 2026, 01:38 UTC (Revision 4).

@saariuslystoned saariuslystoned changed the title fix(live,cli,api): restore cached home timeline, guard auto DM xurl limit, and validate CLI/HTTP filters fix(live,cli): restore cached home timeline, guard auto DM xurl limit, and validate CLI filters Nov 9, 2026
@saariuslystoned

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 9, 2026
@saariuslystoned
saariuslystoned force-pushed the fix/timeline-dms-lists-and-http-query-contracts branch from 3e36a68 to 1cab905 Compare November 9, 2026 01:15
@saariuslystoned
saariuslystoned force-pushed the fix/timeline-dms-lists-and-http-query-contracts branch from 1cab905 to 69928a5 Compare November 9, 2026 01:28
@saariuslystoned saariuslystoned changed the title fix(live,cli): restore cached home timeline, guard auto DM xurl limit, and validate CLI filters fix(timeline,dms,lists): restore cached home timeline rows and validate DM/List CLI inputs Nov 9, 2026
@saariuslystoned

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Nov 9, 2026
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 9, 2026
steipete added a commit that referenced this pull request Nov 14, 2026
Consolidate verified fixes from #257, #258, #259, #260, #261, #262, #263, #264, and #265. Repair account selection, cache restoration, search bounds, input validation, and read-only analysis while preserving existing account and data-safety contracts. Also reject unsafe Git indexes before backup publication and keep recovery snapshots private.

Co-authored-by: Bobby Bones <saariuscrypto@gmail.com>
Co-authored-by: sm0ky <smokyproductcompany@gmail.com>
@steipete

Copy link
Copy Markdown
Owner

Thanks for the fixes. I reproduced the reported defects against v0.17.0 and consolidated safe home-timeline cache restoration, transport-specific DM limits, and DM/List CLI validation into #266, now landed. The overlapping cache ingestion changes from #257 and #261 are included once.

The consolidation preserves contributor credit in the changelog and squash commit. Synthetic regressions, independent P0–P2 review, and exact-head CI cover the result; no paid X requests were used. Closing this PR as superseded by the landed consolidation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants