Skip to content

feat(system builder 2b): one bank account per player per game system,… - #106

Merged
over2take merged 1 commit into
feature/system-builderfrom
sb/2b-backup-and-bank
Sep 29, 2026
Merged

over2take merged 1 commit into
feature/system-builderfrom
sb/2b-backup-and-bank

Conversation

@over2take

Copy link
Copy Markdown
Owner

… with a database copy first

bank_accounts replaces the one-bank-per-player player_banks, which is kept untouched as the record. Every bank read and write goes through bank/accounts.js, scoped to the running system (a sheet's cash field shows its own system's account), and waits for the one-time move to finish - browsers reconnect within milliseconds of a restart, and an empty account opened first would block a real balance from being copied in.

The move (startup/bankAccounts.js) copies the database first when the disk has room (startup/backup.js, VACUUM INTO), then copies each balance, debt and flag into every system the player has a sheet in plus the running one, in one transaction, with a marker so it runs once.

Tests: accounts kept apart, the move's rules (mutation-checked: marker, wait, systems, transaction), the copy and its space check, switching systems in play, and db.js opening a 1.14.4-shaped file. The 15 test files that seeded player_banks now use the running system's account. Verified on a read-only copy of the real database: 21 banks into 29 accounts, every value identical.

Summary

Test plan

  • Tested locally
  • Tests pass

Pre-merge checklist

Code quality:

  • Code follows project style
  • No breaking changes (or clearly documented)
  • No console errors or warnings

Version & Release:

  • Version bumped? If releasing to users, update:
    • frontend/package.json version
    • docker-compose.yml APP_VERSION
    • CHANGELOG.md with release notes
  • GitHub Actions will auto-tag Docker images with the new version

Before merging to main:

  • All tests passing
  • PR reviewed and approved
  • Branch is up to date with main
  • No merge conflicts

Related issues

… with a database copy first

bank_accounts replaces the one-bank-per-player player_banks, which is kept
untouched as the record. Every bank read and write goes through
bank/accounts.js, scoped to the running system (a sheet's cash field shows its
own system's account), and waits for the one-time move to finish - browsers
reconnect within milliseconds of a restart, and an empty account opened first
would block a real balance from being copied in.

The move (startup/bankAccounts.js) copies the database first when the disk has
room (startup/backup.js, VACUUM INTO), then copies each balance, debt and flag
into every system the player has a sheet in plus the running one, in one
transaction, with a marker so it runs once.

Tests: accounts kept apart, the move's rules (mutation-checked: marker, wait,
systems, transaction), the copy and its space check, switching systems in play,
and db.js opening a 1.14.4-shaped file. The 15 test files that seeded
player_banks now use the running system's account. Verified on a read-only copy
of the real database: 21 banks into 29 accounts, every value identical.
@over2take
over2take merged commit c3e6562 into feature/system-builder Sep 29, 2026
4 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