Commit Graph
8 Commits
Author SHA1 Message Date
Keith Solomon 4339958b5e Normalize line endings in vault balance plan doc
Deploy website via FTP / Deploy (push) Skipped
The plan was committed with LF endings; the editor normalized to CRLF on
save. Restore LF for consistency with the rest of the repo's plan docs.
2026-08-10 20:40:55 -05:00
Keith Solomon a9a635e172 Add plan: async backfill with meta-refresh loading page
- 2 tasks: index.php loading-page bootstrap, smoke check
- Heavy sync deferred to meta-refresh loops so PHP never times out
- Each refresh walks one API page; ON CONFLICT DO UPDATE makes
- resume safe after browser close
2026-08-10 20:01:14 -05:00
Keith Solomon a19058c6e9 Add plan: walk prev chain on backfill for full vault history
- 2 tasks: update fetchAndStoreLogPage pagination loop, smoke check
- Loop prefers prev (older pages) over next (newer pages) so a single
  fetchAndStoreLogPage call captures the full history
- INSERT uses ON CONFLICT DO UPDATE for running_balance and amount
  so re-runs refresh data
2026-08-07 19:08:01 -05:00
Keith Solomon 3c798cee88 Add plan: revert to per-user balance via /log + per-entry re-fetch
- 5 tasks: revert vaultLoop to SQL, replace broadcast backfill with
  per-entry re-fetch, wire into entry points, delete unused helper
  and its test, smoke check
- refetchRunningBalances walks /log pagination and UPDATEs each row
  from its own data.balance
- Drops the fetchLiveVaultBalance helper (queried /money which is
  total-vault not per-user)
- The previous fix's broadcast backfill was clobbering per-entry
  historical balances with a single value
2026-08-07 17:30:33 -05:00
Keith Solomon 0613d00fbb Add plan: live vault balance from /money endpoint
- 4 tasks: failing test, helper implementation, vaultLoop switch, smoke check
- New helper fetchLiveVaultBalance(string $user): ?int in includes/utilities.php
- vaultLoop prefers the live value, falls back to MAX(running_balance)
- Per-request cache to avoid N HTTP calls
- Test hook via $GLOBALS['liveBalanceTestHook'] for unit testing
- Falls back gracefully on API failure
2026-08-05 09:23:15 -05:00
Keith Solomon 908e2c50ab Add plan: vault balance from per-entry API value
- 9 tasks: schema migration, capture data.balance, fetchVaultRecords
  column list, vaultLoop switch to MAX, backfill helper, wire backfill,
  buildTable column, index.php header, end-to-end smoke check
- TDD: failing test in Task 2 before rewriting processLogEntries
- Idempotent schema migration via PRAGMA table_info check
- One-shot live-read backfill broadcasts latest balance to NULL rows
2026-08-03 21:41:33 -05:00
Keith Solomon e7ec343be1 Add implementation plan: Torn API v1 to v2 migration
- 8 tasks: exception class, API call rewrite, validation tightening,
  fetchAndStoreLogPage helper, processLogEntries rewrite with golden-file
  test, backfillUserLogs/syncUserLogs entry points, index.php call swap,
  end-to-end smoke check
- TDD: write the failing test before rewriting processLogEntries
- Each task is a self-contained commit
2026-08-03 12:47:59 -05:00
Keith Solomon c2b138d687 Add spec: Torn API v1 to v2 migration design
- Compares old (api-sample.json) and new (api-sample-new.json) shapes
- Specifies Authorization: ApiKey header instead of ?key= query param
- Specifies following _metadata.links.next for pagination
- Specifies entry.id (string) as PRIMARY KEY with INSERT ... ON CONFLICT DO NOTHING
- Adds backfillUserLogs (replaces firstRun) and syncUserLogs (renamed from getLog)
- Adds shared fetchAndStoreLogPage helper
- Adds golden-file unit test (no live API)
2026-08-03 12:42:19 -05:00