Skip to content

perf: batch deployment pruning - #13980

Draft
HzaRashid wants to merge 6 commits into
release-1.11.0from
wxo-sync-batch
Draft

perf: batch deployment pruning#13980
HzaRashid wants to merge 6 commits into
release-1.11.0from
wxo-sync-batch

Conversation

@HzaRashid

Copy link
Copy Markdown
Collaborator

prune stale deployments in a single db call instead of per-round and per-owner

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a175e388-11ea-4dec-8830-c321d789481c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wxo-sync-batch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the performance Maintenance tasks and housekeeping label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Migration Validation Passed

All migrations follow the Expand-Contract pattern correctly.

@github-actions github-actions Bot added performance Maintenance tasks and housekeeping and removed performance Maintenance tasks and housekeeping labels Jul 8, 2026
@github-actions github-actions Bot added performance Maintenance tasks and housekeeping and removed performance Maintenance tasks and housekeeping labels Jul 10, 2026
…Lite

SQLite func.now() wrote whole-second strings that failed keyset equality
against SQLAlchemy DateTime binds; rewrite existing rows and switch
deployment-family models to Python utc_now defaults.
- Add provider-neutral deployment list sync settings for batch size and max refill rounds.
- Validate larger local deployment batches against the provider before shaping the response page.
- Use keyset refill reads after the first offset page to avoid offset races when stale rows are pruned concurrently.
- Prune stale deployments in O(1) DB calls instead of per-round and per-owner cleanup calls.
- Cover batch sizing, refill limits, keyset cursor behavior, owner-scoped stale cleanup, and settings composition in tests.
- Filter list/count and sync by deployment_type in SQL so type-scoped
  sync can prune provider-unknown rows without a Python type skip.
- Keep list sync alive on provider round failures; backfill remaining
  page slots from local rows after sync (may be stale; tune batch size /
  max rounds to reduce padding).
- Bind attachment cleanup/recount to provider-confirmed IDs only (no
  needless snapshot copy before backfill).
- Soften DELETE rowcount handling with UnknownDeleteCount when the
  driver does not report an int.
- Document that deployment_list_sync_batch_size should stay within the
  provider's ID-filtered list limit.
- Stop writing deployment-family timestamps with server_default=func.now();
  use Column default/onupdate=utc_now (Field stays default=None) so SQLite
  stores microsecond DateTime strings matching later query parameters.
- Add SQLite migration a8f3c2d1e4b5: rewrite existing second-level timestamp
  strings through DateTime binds, and drop CURRENT_TIMESTAMP server defaults
  on all dialects.
- Cover type filter, keyset after rewrite, ORM microsecond writes, sync
  backfill/failure paths, and the server_default drop in unit tests; extend
  integration coverage for the sync path.
@github-actions github-actions Bot added performance Maintenance tasks and housekeeping and removed performance Maintenance tasks and housekeeping ignore-for-release labels Jul 10, 2026
@erichare
erichare deleted the branch release-1.11.0 July 15, 2026 18:36
@erichare erichare closed this Jul 15, 2026
@erichare erichare reopened this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Maintenance tasks and housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants