Skip to content

Phase 2: Connection, schema migrate, lock/leader helpers - #3

Merged
evantahler merged 1 commit into
mainfrom
cursor/phase-2-connection-3475
Aug 27, 2026
Merged

Phase 2: Connection, schema migrate, lock/leader helpers#3
evantahler merged 1 commit into
mainfrom
cursor/phase-2-connection-3475

Conversation

@evantahler

Copy link
Copy Markdown
Member

Implements docs/plans/02-connection-and-schema.md.

What this ships

  • Connection (connect / end / migrate) over pg-boss with migrate: false, supervise: false, schedule: false
  • Metadata tables pgrq_leader, pgrq_workers, pgrq_locks, pgrq_stats plus lock, stat, and leader helpers
  • Connection tests in CI (connection.test.ts, connectionError.test.ts); specHelper.cleanup() truncates leftover rows
  • Node still imports compiled dist/ via node scripts/assert-node-package.mjs

Notes

Workers do not migrate. automigrate remains a scheduler-leader concern for a later phase.

Open in Web Open in Cursor 

Add pg-boss-backed Connection with migrate/lock/leader/stat APIs,
port connection tests for bun:test, fill specHelper cleanup, and bump
to 0.1.0. Update living phase plans with lessons learned.

Co-authored-by: Evan Tahler <evan@evantahler.com>
@evantahler
evantahler marked this pull request as ready for review August 26, 2026 20:21

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 458a374. Configure here.

Comment thread src/core/connection.ts
WHERE key = $1`,
[key, ttlSeconds],
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expire lock revives expired lock rows

Medium Severity

expireLock updates any pgrq_locks row by key, including expired ones and rows owned by someone else. That revives a lock getLock treats as absent and can block or extend a setLockNx takeover after TTL expiry.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 458a374. Configure here.

@evantahler
evantahler merged commit 59a91dd into main Aug 27, 2026
6 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.

2 participants