Repository navigation
HTTP policy control (concurrency, etc) - #429
Open
Thom Chiovoloni (thomcc-work) wants to merge 10 commits into
Open
Thom Chiovoloni (thomcc-work) wants to merge 10 commits into
Thom Chiovoloni (thomcc-work) wants to merge 10 commits into
Conversation
Thom Chiovoloni (thomcc-work)
force-pushed
the
thomcc/policies
branch
2 times, most recently
from
October 29, 2026 14:33
d363447 to
ff6c0f8
Compare
Thom Chiovoloni (thomcc-work)
force-pushed
the
thomcc/policies
branch
from
October 29, 2026 20:58
ff6c0f8 to
21b6e00
Compare
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The runtime pin relies on an unmerged dependency and changes admission, shutdown, and replay behavior, requiring PostgreSQL shutdown, epoch-replacement, HTTP restart, and N-1 replay integration results beyond source inspection.
No open issues 🎉
What changed in this PR
Adds server-wide and workflow-scoped HTTP concurrency controls to pg_durable’s shared runtime, with durable queue deferral when capacity is unavailable. The PR depends on the admission support in microsoft/duroxide#74.
Changes:
- Adds configurable activity and HTTP limits, plus composable subtree policies through
df.with_policy(). - Integrates admission checks and shutdown-interruptible runtime initialization.
- Adds concurrency, cancellation, and restart tests, alongside API and operational documentation.
| File | Description |
|---|---|
USER_GUIDE.md |
Explains concurrency settings, workflow policies, and limitations. |
tests/e2e/sql/92_http_restart.sql |
Tests interrupted HTTP recovery and persisted policy enforcement. |
tests/e2e/sql/91_http_policies.sql |
Tests nested scopes, independent budgets, loops, and races. |
tests/e2e/sql/90_http_concurrency.sql |
Tests global limits, cancellation, SQL headroom, and permit lifetimes. |
tests/e2e/http_origin_server.py |
Adds gated responses and concurrency counters. |
src/worker.rs |
Configures runtime capacity and interruptible startup. |
src/types.rs |
Carries policies and materializes HTTP scope metadata. |
src/registry.rs |
Registers admission hooks for both HTTP activities. |
src/policies.rs |
Implements policy validation, scope accounting, and admission guards. |
src/lib.rs |
Registers concurrency settings and adds integration tests. |
src/explain.rs |
Displays HTTP scope limits in graph explanations. |
src/dsl.rs |
Adds the df.with_policy() graph helper. |
sql/pg_durable--0.2.9--0.2.10.sql |
Exposes the policy helper during extension upgrades. |
scripts/test-e2e-local.sh |
Runs HTTP concurrency scenarios and restart orchestration. |
scripts/test-e2e-docker.sh |
Skips tests requiring the local TLS fixture. |
docs/upgrade-testing.md |
Documents schema compatibility, replay behavior, and validation. |
docs/multi-database-installation.md |
Updates runtime shutdown guarantees and remaining limitations. |
docs/http-security.md |
Explains capacity enforcement and its security boundaries. |
docs/grammar.md |
Documents policy annotations in the DSL grammar. |
docs/E2E_TESTING.md |
Lists the new HTTP test scenarios. |
docs/api-reference.md |
Documents the policy API and concurrency settings. |
CHANGELOG.md |
Records HTTP limits, policies, and startup shutdown handling. |
Cargo.toml |
Updates Duroxide and pins the temporary admission revision. |
Cargo.lock |
Locks the updated runtime dependency graph. |
.agents/skills/pg-durable-sql/SKILL.md |
Adds workflow policy syntax and usage guidance. |
Review effort: Balanced
Thom Chiovoloni (thomcc-work)
marked this pull request as ready for review
November 3, 2026 15:37
Still pinned via git.
Pinned to 9ae067b, alongside the merged duroxide revision. Changes: - Updated the provider dependency and lockfile. - Advanced WORKER_SCHEMA_VERSION to 4 for the bundled migrations. - Added a 500-request backlog regression. - Updated migration, rollout, and behavior documentation.
Address review 429-1 using the documented disposable-database alternative. The current provider pin records migration 0029 without the pending 0027/0028 prefix; do not disguise this by changing readiness or migration ledger rows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review 429-3 with the supplied full-stack measurement, its workload and limits. Keep retry-delay policy unchanged as requested; tuning latency versus database load remains follow-up work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review 429-2: recover poisoned admission locks without resetting reservations, make counter cleanup non-panicking with saturating decrements, and log invariant faults. Add tests for poisoned admission/release and inconsistent counters. Validation: build and Clippy passed; 469 unit tests passed (16 ignored); all 91 E2E tests passed through the shared PostgreSQL lock-aware runners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review 429-4 by checking the submitting role against every required HTTP overload in the origin database. Share signature selection with activity-time checks, cache repeated checks per graph, and preserve SQLSTATE 42501 for independent starts. Retain execution-time authorization for revocation and historical work. Cover raw and nested graphs, all four overloads, both transaction modes, hostile search paths, inherited grants, definer identity, no persisted submission on denial, satellite isolation and post-submission revocation. Build, Clippy, unit and authorization regressions pass; the corrected satellite test and all 177 upgrade checks pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add administrator-enforced HTTP concurrency limits and workflow-local policies, with nonblocking admission so requests waiting for capacity remain durably queued rather than occupying activity slots.
Server-wide limits
Add two restart-only GUCs, both defaulting to
2:pg_durable.max_activity_concurrency: total concurrent activities, including SQL, HTTP, and metadata work.pg_durable.max_http_concurrency: combined HTTP and multipart HTTP capacity across all users, workflows, and origin databases.Defaults preserve the previous two-activity execution capacity. Administrators can set the HTTP ceiling below total activity capacity to leave room for non-HTTP work.
Workflow-local policies
Add
df.with_policy(fut, policy)to constrain HTTP concurrency within an entire workflow or a subtree:df.explain()displays applicable scope IDs and limits.Execution behavior
This does not add rate limits, timeout/deadline policies, per-tenant fairness, or exactly-once/remote-quiescence guarantees. Large backlogs still add latency.
Dependencies
Uses immutable Git pins for:
These pins allow combined testing and review before upstream releases; they are temporary integration dependencies.
Upgrade and compatibility
df.with_policy()requiresALTER EXTENSION pg_durable UPDATE TO '0.2.10'.4, published after the bundled provider migrations complete.