Skip to content

feat: offline read-only SQLite copy of events (#257) - #259

Merged
KalebCole merged 2 commits into
mainfrom
codex/issue-257-sqlite
Nov 21, 2026
Merged

KalebCole merged 2 commits into
mainfrom
codex/issue-257-sqlite

Conversation

@KalebCole

Copy link
Copy Markdown
Owner

🤖 Kaleb's Grok Bot:

Summary

Cache the user's Partiful event summaries and RSVP statuses in SQLite, then query them offline.

events sync --when past|upcoming
  one reviewed homepage list call
  safe summary projection
  atomic SQLite upsert by event_id
events offline
  read-only SQLite query, no auth or network

Spec operations used: getMyPastEventsForHomePage and getMyUpcomingEventsForHomePage, selected individually by --when. Both return HomePageEvent.guest.status using GuestStatus, including GOING. Neither list exposes confirmed attendance. Past GOING remains an RSVP, not a claim that the user attended. No per-event follow-up calls, spec changes, or Partiful writes.

Commands and flags:

  • events sync --when past|upcoming [--db PATH] [--limit 1..1000]: defaults to 1000; returns synced/available counts and hasMore. It stores all returned RSVP states so later changes can replace GOING. Repeating sync upserts without duplicates. Cached rows absent from a later list are retained.
  • events offline [--db PATH] [--limit 1..1000] [--status STATUS|all] [--since RFC3339] [--until RFC3339]: defaults to 50 and going; inclusive start bounds, deterministic ordering, unknown starts excluded by date filters. No credentials required.
  • Default DB: the user config directory's partiful/events.sqlite. Separate DB per account. SQLite files and sidecars are gitignored.

Tables:

  • events: event_id TEXT PRIMARY KEY, nullable TEXT title, start, end, timezone, state, user_role, my_rsvp; synced_at TEXT NOT NULL. UTC canonical start/end strings; index on (my_rsvp, start).
  • metadata: key TEXT PRIMARY KEY, value TEXT NOT NULL; account fingerprint prevents combining accounts. Raw user IDs and raw API payloads are never stored.

Dependency: modernc.org/sqlite v1.34.5, plus its transitive dependencies. This pure-Go database/sql driver preserves CGO-free native builds and the existing Go 1.22 module requirement. No Node or npm release step.

Deliberate golden/schema changes: register both commands, flags, inputs, success results, failures and local/read-only safety; bump product revision to 2026-11-20.1; update schema golden, executable catalog expectations and native smoke catalog. Error golden adds OFFLINE_OPTIONS_INVALID and OFFLINE_STORE_UNAVAILABLE. Inline envelope fixtures receive the revision update. README and AGENTS command catalog updated. The PII allowlist narrowly covers two public Go pseudo-versions whose timestamps trigger the phone/card scanner.

Evidence

  • Before: no local event store or offline command.
  • After: temp-DB tests cover upsert idempotency, updates, status/date filters, limits, rollback, account isolation and read-only access. Fake API tests cover one list call per sync, both list operations, safe stored projections, offline queries without network/auth, invalid options, and protocol failure before writing even outside the requested limit.
  • Passed: go mod verify, go test ./..., go test -race ./..., go vet ./..., go build ./..., and ./scripts/verify-native-release.sh. All six CGO-free native archives built, checksums verified, and safe smoke checks passed. No live Partiful calls or credentials used.
  • Local execution used Go 1.26.5 because macOS rejects Go 1.22.12 test binaries with missing LC_UUID; the module remains Go 1.22 and dependencies were resolved with Go 1.22.12.

Merge Danger

Door: two-way

Blast Radius: local

Only the local SQLite database is persisted by these commands. Authentication refresh uses the existing non-persisting path. Local cached snapshots can become stale; no confirmed attendance inference is made. Held for Kaleb's review; do not auto-merge.

Refs #257

@KalebCole KalebCole added the held Waiting on Kaleb's decision. Do not merge. label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9d313268-53dc-4904-8c1c-5b33c944c29f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T16:05:20.568398Z 77d2611 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-21 18:42 UTC

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77d2611757

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/app/app.go Outdated
Comment on lines +1539 to +1540
case eventsSyncCommand, eventsOfflineCommand:
return executeOfflineEvents(ctx, definition, argv, dependencies, pretty)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor or reject dry-run before writing the offline database

With valid credentials, events sync --when past --dry-run still creates or updates the SQLite database: Execute consumes --dry-run globally, but this dispatch drops execution, and executeOfflineEvents unconditionally opens the writable store and calls Upsert. A caller attempting a safe preview therefore changes persisted event data without warning. Pass the dry-run state through and avoid writing during previews, or explicitly reject the unsupported flag instead of silently performing the sync.

AGENTS.md reference: AGENTS.md:L74-L74

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kaleb's Grok Bot: Fixed in 6388f28. events sync --dry-run now returns a redacted preview and does not create or update the SQLite database, matching the AGENTS.md dry-run preview rule.

Copy link
Copy Markdown
Owner Author

🤖 Kaleb's Grok Bot: Kaleb approved merging this PR. Removing the held label and squash-merging.

@KalebCole KalebCole removed the held Waiting on Kaleb's decision. Do not merge. label Nov 21, 2026 — with Cursor
@KalebCole
KalebCole merged commit df14cb8 into main Nov 21, 2026
3 checks passed
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