Repository navigation
feat(analytics): onboarding moments are business events - #539
Conversation
|
Self-review ( Fixed in a7cfeca:
Kept as is:
|
|
Codex review (GPT 6.1 Sol, high), round 1: not safe to merge, 1 finding
Sol found no Standards issues and confirmed the rest: all events wired, principals right, refusals and rollback silent, docs in sync. |
|
Codex review (GPT 6.1 Sol, high), round 2: not safe to merge, 1 finding Sol confirmed the round-1 invitation fix is sound.
|
|
Codex review (GPT 6.1 Sol, high), round 3: not safe to merge, 1 finding Sol confirmed the round-2 fix restores cancellable lock waits.
|
|
Codex review (GPT 6.1 Sol, high), round 4: safe to merge, no findings. Sol verified the round-3 fix (commit, wakes and event protected together; advisory-lock wait still cancellable) and confirmed all ten events, privacy, docs and tests. The only remaining item is the accepted COMMIT-round-trip residual described in round 2. Nothing is outstanding. |
f689859 to
1d7d0c8
Compare
|
Codex review (GPT 6.1 Sol, high), round 5, after restacking onto #541: not safe to merge, 1 finding Sol confirmed the Patches/lifecycle combination is correct.
|
|
Codex review (GPT 6.1 Sol, high), round 6: safe to merge, no findings. Sol verified the round-5 fix: COMMIT and the report are protected together, the change stays cancellable including lock waits, refusals roll back cleanly with no event, |
6de716a to
0d4d6fa
Compare
Creating or joining a company, invitations, role changes, deactivation, reactivation and connections now each report one business event after their change commits. Joins belong to the new user's own id. Users.setRole reports whether it changed the role, so a stale form asking for the current role reports nothing. ConnectionStore.delete returns the connection it deleted, so its event can name the integration. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… their events Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An interrupted request could still commit (invitations deliver uninterruptibly), then lose its event before track ran. Each emitter now runs its change and its event in one uninterruptible region, so a commit always reports and a refusal or rollback never does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Holding a whole transaction uninterruptible meant a disconnected admin couldn't cancel a lock wait, so a slow invitation delivery could pin the company dependency lock. Database actions now run cancellably and only the step from a returned commit to its event is protected. Invitations, already uninterruptible, keep their single region. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…gether A disconnect while wakes published after the dependency-lock commit skipped the lifecycle event. Only the work inside the transaction is now cancellable; its commit, wakes and event run protected. The dependency lock's advisory wait is made explicitly cancellable so the protection doesn't extend to it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#541's lifecycle transaction already queues patch events, runs only the work interruptibly and reports them with the commit. Deactivation and reactivation now queue their user event there through Patches.reportOnCommit, replacing the page's own mask and flag and the explicit cancellable advisory wait, which its restore already covers. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…d change Join, role changes and connection connect/delete restored their whole service call, so an interrupt landing during COMMIT dropped the event of a change that committed. @patchy/sql's withReportedCommit opens the outermost transaction with only the change cancellable and runs the report with the commit. Connections pass their report to the store, which applies it around its own transaction so discovery's audit stays outside. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
844d5a4 to
08027db
Compare
…ease (#556) What's new for this deploy, plus the history since the first production deploy. The thin entries #555 seeded by hand are rewritten from what each deploy actually shipped. This is the first run of `AGENTS.md` › Deploying: a fresh subagent gathered and wrote these releases, and I checked them against the PRs. **Release 4 (this deploy, `4a928f7..8697463`)** - New: **See what's new in Patchy** (#555) **Release 3 (2026-10-06, `aed1454..4a928f7`)** - Fixed: **Creating a company explains a handle it can't use** (#553) **Release 2 (2026-10-05, `48153dc..aed1454`)** - Behind the scenes: key moments are recorded, identifying people by id, never by name or email address (#538, #539, #541) - Behind the scenes: the patchy command reports its version, command and coding agent (#540) **Release 1 (2026-10-05, first production deploy, `48153dc`)** - Behind the scenes: Patchy Cloud's first release went live Made by Claude Opus 5.5 via Claude Code in T3 Code. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
The product dashboard can't see onboarding. Creating or joining a company, invitations, role changes, deactivation and connections sent no business event. The only trace of
POST /joinwas an anonymous request event that couldn't tell creating a company from accepting an invitation.Each of those actions now reports one business event from the catalogue, after its change commits. A refused or rolled-back action reports nothing.
company.created,user.joined(via,role,inviteIdfor invitations)Join.ts(Companies)invite.sent(role,emailed),invite.resent(emailed),invite.revokedCompanyPage.ts(Companies)user.role_changed(userId,role)CompanyPage.tsuser.deactivated,user.reactivated(userId)UserLifecyclePage.ts(Portal), queued with #541's patch events and reported when thewithDependencyLocktransaction commitsconnection.connected,connection.deleted(connectionId,integration)ConnectionPage.ts(Integrations)Companies.create,consumeInviteandInvitations.*each commit their own transaction before returning, so the page emits after commit. The only dependency change is@patchy/companies → @patchy/analytics. A browser disconnect can't drop the event of a change that committed, even one that lands during COMMIT. Invitations already deliver uninterruptibly, so each one and its event share one uninterruptible region. Join, role changes and connection connect/delete use a newwithReportedCommitin@patchy/sql. It opens the outermost transaction with only the change cancellable, lock waits included, and runs the report with the commit. Connections pass their report toConnectionStore.connect/delete, which apply it around their own transaction, so discovery's audit rows stay outside it. Deactivation and reactivation use feat(patches): every patch lifecycle change is a business event, from every path #541's mechanism instead.withLifecycleTransactionqueues lifecycle events, runs only the work interruptibly, and reports the events with its commit. The page queues its user event in the same batch through a newPatches.reportOnCommit, so a committed deactivation reportsuser.deactivatedand eachpatch.retiredonce, and a rolled-back or cancelled one reports none of them. The dependency lock serializes these commits, so a repeated action is refused and reports nothing.Users.setRolenow returns{ user, changed }. A stale form asking for a role the user already has changes nothing and reports nothing.ConnectionStore.deletenow returns the connection it deleted, read under its row lock, so the event can name the integration.postgres).emailedis false whenever no email went out. That includes a resend where Clerk wouldn't revoke the old link, so the invitation is unchanged; the event then reads as a resend attempt that didn't email. A revoke whose Clerk link couldn't be revoked still reportsinvite.revoked, because Patchy revoked it.user.deactivatedand thepatch.retiredeach follow once. A Patches test coversreportOnCommit: rolled back reports nothing, committed reports once, outside the lock dies. SQL tests coverwithReportedCommit: a deferred trigger makes COMMIT slow, an interrupt during it still reports, a change cancelled before commit reports nothing, and inside a caller's transaction it leaves reporting to that caller.Hit every surface: vocabulary applied.
packages/sql/CONTEXT.mdgains Reported commit.CONTEXT-MAP.md's Analytics relationship now names Companies and Integrations, and says Portal's lifecycle events report through Patches; anddocs/OPERATIONS.mdlists the new events. I also made one minimal edit outside this ticket's files: the intro line ofpackages/analytics/CONTEXT.md(owned by #534) listed only Patches and Auth as the contexts that decide business moments, so I added the three new ones. In #536's area I added one method to the Patches service,reportOnCommit, which pushes onto #541's pending-events queue. The wire contract, CLI, dev loop, migrations, company resources, served pages and repo layout are untouched.Privacy page (#537): the new events carry company, user, invitation and connection ids, roles, whether an invitation email went out, and the integration kind. They never carry names, email addresses or connection strings.
Closes #535
Made by Claude Opus 5.5 via Claude Code in T3 Code.