Skip to content

release: cut v0.2.19 (PRP-34 batch parallel execution)#292

Merged
w7-mgfcode merged 9 commits into
mainfrom
dev
May 25, 2026
Merged

release: cut v0.2.19 (PRP-34 batch parallel execution)#292
w7-mgfcode merged 9 commits into
mainfrom
dev

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

@w7-mgfcode w7-mgfcode commented May 25, 2026

Summary

Pre-1.0 SemVer (feat: → PATCH per release-please-config.json) — release-please will open a Release PR on main bumping to v0.2.19.

Test plan

  • All five validation gates green on tip 36fff6e (CI + Schema Validation both success)
  • 1466 unit + 15 batch integration tests passing locally
  • Frontend 121 vitest cases passing
  • Merge via GitHub web UI (NOT gh pr merge --merge — see docs/_base/RUNBOOKS.md → "release-please skipped the bump after a dev → main merge")
  • Verify release-please opens a chore(main): release 0.2.19 PR on main
  • Merge the Release PR → tag v0.2.19
  • Back-merge main → dev with --merge (not squash)

Summary by CodeRabbit

Release Notes

  • New Features

    • Added configurable concurrency limit for batch execution via a "Max parallel" slider in the batch submission form
    • Added "Cancel batch" button with confirmation dialog to stop in-flight batch jobs
    • Batch cards now display execution status with running/completion counts and effective parallelism
  • Improvements

    • Enhanced batch UI with better status visibility and progress tracking
    • Batch cancellation requests now include timeout protection to prevent indefinite waits

Review Change Stack

dependabot Bot and others added 9 commits May 25, 2026 11:15
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.5 to 4.36.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@9e0d7b8...7211b7c)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
chore(repo): back-merge main into dev after v0.2.18 release (#287)
…hub/codeql-action-4.36.0

ci: bump github/codeql-action from 4.35.5 to 4.36.0
Activate the three forward-compat columns PRP-33 shipped on `batch_job`
(`max_parallel`, `running_items`, `cancelled_items`) by routing
`BatchService.submit` through a new `app/features/batch/runner.py` — a
single `asyncio.Semaphore(effective_parallel)` inside an
`asyncio.TaskGroup` with per-child `AsyncSession`s and cooperative
cancellation via a per-batch `asyncio.Event` + tracked `Task` refs. No
new Alembic migration (the three columns already exist).

`DELETE /batch/{batch_id}` cancels what hasn't started and bounds the
drain of what has — 200 settled / 404 missing / 409 terminal / 504
drain-timeout (RFC 7807 via the new `GatewayTimeoutError`). The frontend
`visualize/batch.tsx` gains a max-parallel `Slider`, live `running_items`
+ `parallel` chips, and a "Cancel batch" `AlertDialog`. The settings
defaults are `BATCH_GLOBAL_MAX_PARALLEL=4`,
`BATCH_CANCEL_DRAIN_TIMEOUT_SECONDS=30`.

`BatchSubmitResponse.effective_max_parallel` is a `@computed_field`
resolved from `result_summary["effective_max_parallel"]` (legacy rows
return 0) — JSONB-only, no schema migration.
Six review-driven cleanups, behaviour preserved:

- runner.py: helpers now accept the per-child AsyncSession instead of the
  session_maker; one session opened at the top of _child, reused for every
  state-transition write (each helper still commits its own UPDATE so the
  running_items counter is observable to concurrent DELETE handlers).
- runner.py: clarifying comment on the `except TimeoutError:` branch in
  await_drain — `asyncio.TimeoutError` has been aliased to the built-in
  since Python 3.11 (PEP 678 / asyncio docs); the project pins >= 3.12.
- frontend/src/components/ui/slider.tsx: switched from the bundled
  `radix-ui` package to per-component `@radix-ui/react-slider` to match
  the project's existing shadcn primitives (alert-dialog, dialog, etc.).
- app/features/batch/models.py + routes.py: TERMINAL_BATCH_STATES is now
  derived from VALID_BATCH_TRANSITIONS (a status with no out-edges is
  terminal) and exported from the models module — routes.py imports it
  instead of redeclaring the set.
- frontend/src/types/api.ts: exports TERMINAL_BATCH_STATES so batch.tsx
  (and any future consumer) reads from the single source of truth.
- test_routes_cancel.py: added test_delete_200_clean_drain covering the
  documented 200 happy-path.
- Typo: test_cancel_running_child_propagates_cancellederror →
  test_cancel_running_child_propagates_cancelled_error (PRP doc updated).
feat(batch,ui): activate max_parallel + cooperative cancellation (PRP-34)
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR implements PRP-34 — Batch Parallel Execution, transitioning from serial batch execution to bounded-concurrency async processing with cooperative cancellation. The implementation adds a new app/features/batch/runner.py using asyncio.Semaphore and asyncio.TaskGroup, a DELETE /batch/{batch_id} cancellation endpoint with configurable drain timeout, frontend max-parallel slider and cancel-button UI, and comprehensive unit, integration, and chaos tests.

Changes

Batch Parallel Execution (PRP-34)

Layer / File(s) Summary
PRP-34 Specification & Documentation
PRPs/PRP-34-batch-parallel-execution.md, PRPs/ai_docs/asyncio-taskgroup-cancellation.md
Design documents for bounded-concurrency batch execution with asyncio semantics verification, error handling, and implementation blueprint.
Configuration & Error Infrastructure
.env.example, app/core/config.py, app/core/exceptions.py, app/core/problem_details.py
New batch settings (batch_global_max_parallel=4, batch_cancel_drain_timeout_seconds=30), GatewayTimeoutError exception, and RFC 7807 error type URI for drain timeout.
Domain Model & State Transitions
app/features/batch/models.py, app/features/batch/tests/test_models.py
Batch item state machine now allows RUNNING → CANCELLED transition; new TERMINAL_BATCH_STATES constant for cancel endpoint validation.
Asyncio Batch Runner
app/features/batch/runner.py
Core module: asyncio.Semaphore(effective_parallel) inside asyncio.TaskGroup, per-item AsyncSession, cooperative cancellation via asyncio.Event, in-memory registry, cancel/drain/completion helpers, and DB state transitions.
Runner Unit & Orchestration Tests
app/features/batch/tests/test_runner.py
Nine tests validating semaphore concurrency cap, global-cap clamping, sibling failure isolation, pending-child cancellation, running-child cancellation, and drain/registry coordination.
Service Integration & Response Schema
app/features/batch/service.py, app/features/batch/schemas.py
Rewire BatchService.submit to call runner.run_batch instead of picker loop; add per-child session maker; persist effective_max_parallel to result_summary; add computed response field.
DELETE Cancellation Endpoint & Tests
app/features/batch/routes.py, app/features/batch/tests/test_routes_cancel.py
New DELETE /batch/{batch_id} route: validates existence/non-terminal status (404/409 RFC 7807), fires cooperative cancellation, awaits bounded drain (504 on timeout), returns settled parent. Four integration tests: 404 unknown, 409 terminal, 200 clean drain, 504 timeout.
Chaos & Regression Tests
app/features/batch/tests/test_runner_chaos.py
Integration tests: mid-flight cancellation with no orphaned RUNNING items, end-to-end batch completion via HTTP with effective_max_parallel verification.
Frontend Infrastructure
frontend/package.json, frontend/src/components/ui/slider.tsx, frontend/src/types/api.ts, frontend/src/hooks/use-batches.ts, frontend/src/hooks/use-batches.test.ts
Radix UI slider dependency and component wrapper; API type updates (TERMINAL_BATCH_STATES, effective_max_parallel); useCancelBatch mutation hook with RFC 7807 error handling.
Batch Page UI
frontend/src/pages/visualize/batch.tsx
Max-parallel slider input, cancel button with AlertDialog confirmation, running/completion/effective-parallel badges, and improved numeric safety checks.
CI Maintenance
.github/workflows/dependency-check.yml
CodeQL Action upgraded to v4.36.0.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • #280: Extends the batch-runner vertical from PRP-33 MVP with full parallel execution and cancellation orchestration.

Suggested reviewers

  • w7-learn

Poem

🐰 Bounded rabbits now fan out with care,
A semaphore guards the pool we share,
Cooperative waves say "cancel please,"
And drain waits gentle, never with squeeze.
Slider and button make chaos serene,
The finest batch pipeline I've seen!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'release: cut v0.2.19 (PRP-34 batch parallel execution)' clearly reflects the main change: a version bump release cut for v0.2.19 that implements PRP-34 batch parallel execution.
Linked Issues check ✅ Passed The PR implements all core acceptance criteria from issue #290: runner.py with bounded asyncio.Semaphore, DELETE endpoint with RFC 7807 responses, effective_max_parallel computed field, frontend Slider and AlertDialog, default settings, tests, and no new migrations.
Out of Scope Changes check ✅ Passed All changes are within scope: batch runner implementation, delete endpoint, configuration, frontend updates, tests, and documentation all directly support PRP-34. GitHub Actions version bump and dependency updates are maintenance-related and necessary.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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 and usage tips.

@w7-mgfcode w7-mgfcode merged commit 427c7d4 into main May 25, 2026
13 of 14 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.

feat(batch): activate max_parallel + cooperative cancellation (PRP-34)

1 participant