Skip to content

Add ox_prune --queue, to match ox_health --queue - #40

Merged
PhiLily merged 3 commits into
oxpull:mainfrom
burakeyler:issue-37-prune-queue
Sep 14, 2026
Merged

PhiLily merged 3 commits into
oxpull:mainfrom
burakeyler:issue-37-prune-queue

Conversation

@burakeyler

Copy link
Copy Markdown
Contributor

Closes #37

What

ox_prune gains --queue, spelled and defaulted like ox_health --queue (default=None, "all queues"). When given, it adds queue_name=<queue> to the task queryset before the batched delete loop, so it only narrows which rows are eligible — --batch-size behaves exactly as before. The output label names the queue (Deleted 3 SUCCESSFUL/DISCARDED (queue emails) task row(s) ...); without --queue output is unchanged.

Schedule ticks: OxScheduleTick has no queue, so tick pruning is left as it is with or without --queue (anchors still kept). I documented that in the flag's row. If you'd rather --queue skip tick pruning entirely, that's a one-line change — happy to switch.

Out of scope, per the issue: several queues in one invocation.

Tests

Three new tests in tests/test_prune.py, each failing without the change:

  • only the named queue's old rows are deleted;
  • --dry-run counts only that queue;
  • --queue with --batch-size 2 still deletes every eligible row across batches.

Gates (run locally, Windows, SQLite)

  • pytest -q tests/test_prune.py: 29 passed. Full suite: 1010 passed, 35 skipped, 3 failed — the 3 are in tests/test_platform_signals.py and fail identically on unmodified main on Windows.
  • ruff check ., ruff format --check ., mypy --strict src/, tools/check_release.py: pass.
  • Not run: mkdocs build --strict, PostgreSQL/MySQL legs (this doesn't touch the claim path).

Docs: new row in the ox_prune table in docs/configuration.md; CHANGELOG entry under Unreleased → Added. I didn't touch the generated docs/llms-full.txt.

🤖 Generated with Claude Code

A deployment keeping two queues with different retention needs had no way
to prune them separately. `--queue` narrows which task rows are eligible,
with the same name and meaning as in `ox_health`; batching is unchanged.
Schedule tick rows belong to no queue and are pruned as before.

Closes oxpull#37

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@burakeyler

Copy link
Copy Markdown
Contributor Author

Same issue as #41: docs/llms-full.txt was stale after this PR's docs update, which failed test_llms_full_is_current on every matrix job. Pushed a follow-up commit regenerating it with python tools/build_llms_full.py.

Verified locally:

  • pytest tests/test_llms_full.py — 3 passed
  • ruff check . — clean
  • mypy --strict src/ — clean

…st it

The flag narrows task rows only. The tick log is pruned for every schedule
whatever --queue names, because deleting a task clears its ticks' link to
it and an anchor never had one. The docs said ticks "belong to no queue and
are pruned as usual", which hid that a run for one queue, or for a queue
name with no rows, still deletes old ticks at its own cutoff. The
configuration page and the changelog now say so, and a test pins it.

The README's ox_prune table gains the --queue row it was missing, and
test_queue_keeps_batching counts queries, so a single-statement delete no
longer passes it.
@PhiLily
PhiLily merged commit 62e7bbc into oxpull:main Sep 14, 2026
30 checks passed
@PhiLily

PhiLily commented Sep 14, 2026

Copy link
Copy Markdown
Member

Thanks @burakeyler , merged. I pushed a small commit on top: the README's ox_prune table now has the --queue row, the docs say plainly that a --queue run still prunes every schedule's old ticks, and there's a test for that.

A few things that'll save a round next time:

  • When you add or change a flag, update every table that lists it. For ox_prune that's the README and docs/configuration.md.
  • After any docs edit, run python tools/build_llms_full.py and commit the result.
  • If the docs describe a behaviour, add a test that pins it.

and nice work! looking forward seeing you here again:)

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.

ox_prune --queue, to match ox_health --queue

2 participants