Skip to content

feat(subscriptions): debounced coalesced autosave (closes #2266) - #2327

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2266-autosave
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2266-autosave

Conversation

@IVANLI2412

Copy link
Copy Markdown
Contributor

Closes #2266

Summary

Debounces mobile subscription edit autosaves and coalesces them into bounded, idempotent server writes.

  • mobile/src/features/subscriptions/autosave.ts (new): zero-dependency, pure debounce controller. Per-id last-write-wins coalescing with shallow patch merge, debounce reset on every same-id edit, a maxWaitMs hard cap that forces a flush under continuous typing, maxBatchSize batch splitting, injectable clock/timers, frozen snapshots/batches, typed AutosaveError codes, and queued/scheduled/flushed/cancelled/rejected/listenerFailed metrics + logger hooks. No React or network imports.
  • backend/src/routes/subscriptions.ts (new): framework-agnostic batch applier. Idempotent by (id, version) with optimistic version checks, per-item typed outcomes (applied/duplicate/conflict/error), frozen results, and injected store/clock/metrics/logger. Repeated batches produce no duplicate writes.

No unrelated files were modified.

Verification

  • Direct import harness against the real .ts sources (Node 26 native type stripping): 20/20 checks passed, 0 failed.
  • Jest-style suites executed via a no-node_modules shim runner:
    • mobile autosave: 20/20 tests passed, 0 failed (96 assertions)
    • backend subscriptions: 11/11 tests passed, 0 failed (58 assertions)
  • Covered: happy-path coalescing, debounce reset, max-wait forced flush, batch splitting, manual/empty flushes, cancel by id/all, dispose, subscribe/unsubscribe, listener failure isolation, invalid config/input/version/clock, idempotent replay, version conflicts, store failures, oversized/malformed batches, and observability hook emission.
  • python tools/check_secrets.py: [OK], exit 0.
  • No installs, no generated docs/JSON/binaries; only the four TypeScript files above were added.

Payouts

Base Mainnet (USDC/ETH): 0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868
Solana (USDC/SOL): DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5
PayPal: ivanzenteno3@gmail.com

@github-actions
github-actions Bot merged commit ebe62cc into Smartdevs17:main Nov 24, 2026
7 of 27 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.

Debounce mobile subscription edit autosaves with coalesced server writes

1 participant