Skip to content

docs: canonical activity log design (event-log epic) - #798

Merged
darioAnongba merged 1 commit into
mainfrom
dario/774-canonical-activity-log-design
Jun 29, 2026
Merged

docs: canonical activity log design (event-log epic)#798
darioAnongba merged 1 commit into
mainfrom
dario/774-canonical-activity-log-design

Conversation

@darioAnongba

@darioAnongba darioAnongba commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Tracks #774 (C1), the foundational child of the event-log epic #776.

Design doc only — no code. Defines the persisted store that replaces the derive-on-read activity feed (swapwallet/history.go listActivity). After the review, the design uses two tables instead of one:

  • activity_entries — a current-state projection, one row per operation keyed by a stable canonical id, that backs List(ACTIVITY). Paged by an immutable key (created_at_unix), so a row that transitions in place keeps its position and pagination never skips or duplicates (folds in A5 / walletdk: ACTIVITY paging lacks has_more + a stable cursor and has a bounded merge window #781).
  • activity_events — an append-only log, one immutable row per lifecycle transition with its own monotonic event_seq, that backs SubscribeWallet. This faithfully mirrors the mailbox (Append/Pull over immutable rows) and is the only model that gives a reconnecting subscriber a gap-tolerant, no-missed-update cursor — the property C4 needs. (A single update-in-place table with a frozen seq cannot: a client past that seq never sees the row's later transitions, which is the silent drop the epic exists to fix.)

Stable canonical id (the crux, #610). Only payment_hash (SEND-invoice/RECV) and the OOR session_id are stable today. The doc is explicit that the EXIT/DEPOSIT/on-chain-send ids are net-new daemon work, not the reuse of an existing handle: the wallet send_intent_id is an in-memory map entry with a 5-minute TTL, deleted before dispatch, and the daemon PendingIntentID is derived from the consumed forfeit outpoints (the very handles #610 says vanish) and deleted at round adoption. C1 must mint a durable id at request acceptance, return it from LeaveVTXOs/SendOnChain, and emit the eventual settlement txid correlated to it — mirroring #587's reservation pattern.

Also folds in the inline review: money columns are BIGINT (a bare INTEGER overflows above ~21.47 BTC on the Postgres backend), event_seq is monotonic-but-not-contiguous (consumers treat any event_seq > cursor as new), and List pages by the immutable created_at rather than the mutable updated_at.

The §3.6 append-only-vs-update-in-place question is now resolved (two tables). The C3 balance bugs are explicitly out of scope: they are daemon-side missing-balance-bucket gaps in GetBalance that never touch listActivity, so a client activity log does not fix them.

Catalogued in docs/index.md. Seeking review on the schema, the stable-id contract, and the migration/backfill plan before any implementation lands.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a design document for a Canonical Activity Log, which proposes replacing the current derive-on-read activity feed with a persisted, sequence-numbered SQLite table. The review feedback highlights three critical design issues: SQLite's AUTOINCREMENT does not guarantee gap-free sequences, sorting pagination by updated_at_unix can lead to unstable cursors and duplicate/skipped entries when rows are updated in-place, and the update-in-place model conflicts with the resumable subscription mechanism (clients will miss updates to older rows since their sequence numbers do not change).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/canonical_activity_log_design.md Outdated
Comment thread docs/canonical_activity_log_design.md Outdated
Comment thread docs/canonical_activity_log_design.md Outdated
@darioAnongba darioAnongba changed the title docs: canonical activity log design (C1, event-log epic) docs: canonical activity log design (event-log epic) Jun 25, 2026
@darioAnongba darioAnongba self-assigned this Jun 29, 2026
@darioAnongba
darioAnongba force-pushed the dario/774-canonical-activity-log-design branch from 93f89ba to c061622 Compare June 29, 2026 16:27
@darioAnongba
darioAnongba marked this pull request as ready for review June 29, 2026 16:34

@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: c061622f54

ℹ️ 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 docs/canonical_activity_log_design.md Outdated
Comment thread docs/canonical_activity_log_design.md Outdated
Defines the C1 canonical store that replaces the derive-on-read
activity feed: a current-state activity_entries projection for List,
plus an append-only activity_events log with a monotonic event_seq for
a resumable SubscribeWallet, mirroring the mailbox. Documents the
stable-id contract for every entry kind and the additive migration.
Catalogued in docs/index.md.
@darioAnongba
darioAnongba force-pushed the dario/774-canonical-activity-log-design branch from c061622 to e1b3ec5 Compare June 29, 2026 16:58
@darioAnongba
darioAnongba merged commit 9cda848 into main Jun 29, 2026
17 of 18 checks passed
@darioAnongba
darioAnongba deleted the dario/774-canonical-activity-log-design branch June 29, 2026 19:41
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