Skip to content

Commit 71a854c

Browse files
authored
Switch duroxide-pg-opt → duroxide-pg (#158)
Drop the vendored duroxide-pg-opt submodule and depend on the published duroxide-pg crate from crates.io. Adopt the new ProviderConfig / MigrationPolicy API: backends use VerifyOnly (no DDL, no advisory locks) and the background worker uses ApplyAll. - Remove .gitmodules and the duroxide-pg-opt submodule - Add backend_provider_config / worker_provider_config helpers in types.rs and route all PostgresProvider::new_with_config call sites (worker, client, explain, monitoring, lib.rs test helpers) through them - Drop GH_PAT plumbing from CI and devcontainer (no longer needed) - Handle the provider-line upgrade test boundary - Update docs and prompts to reference duroxide-pg
1 parent 8cdaaa2 commit 71a854c

31 files changed

Lines changed: 585 additions & 432 deletions

.devcontainer/devcontainer.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
"rust-analyzer.check.command": "clippy",
2020
"rust-analyzer.check.extraArgs": ["--features", "pg17"]
2121
}
22-
},
23-
"codespaces": {
24-
"repositories": {
25-
"microsoft/duroxide-pg-opt": {
26-
"permissions": {
27-
"contents": "read"
28-
}
29-
}
30-
}
3122
}
3223
},
3324

.devcontainer/onCreateCommand.sh

Lines changed: 18 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -56,99 +56,30 @@ else
5656
cargo pgrx init --pg17 download
5757
fi
5858

59-
# ── Initialize private submodule (duroxide-pg-opt) ──────────────────
60-
# duroxide-pg-opt is a private repo. Two auth mechanisms:
61-
#
62-
# 1. Prebuild phase: GH_PAT Codespace secret provides access.
63-
# We use a temporary git insteadOf rewrite during submodule clone.
64-
# The secret remains available in the Codespace environment, so there
65-
# is no meaningful security benefit to trying to scrub local traces.
66-
#
67-
# 2. Interactive Codespace: devcontainer.json grants the built-in
68-
# GITHUB_TOKEN read access via customizations.codespaces.repositories.
69-
# The Codespace credential helper handles auth automatically.
70-
#
71-
# 3. Local Dev Container: user must have their own credentials.
72-
73-
SUBMODULE_INITIALIZED=0
74-
75-
if [ -n "$GH_PAT" ]; then
76-
echo "GH_PAT detected — initializing submodule with PAT..."
77-
78-
# Temporarily rewrite GitHub HTTPS URLs to include the token.
79-
PAT_REWRITE_URL="https://x-access-token:${GH_PAT}@github.com/"
80-
81-
cleanup_pat_rewrite() {
82-
local rc=$?
83-
# GH_PAT is still available in Codespace env vars; cleanup here ensures
84-
# subsequent user git operations prefer devcontainer.json repo permissions
85-
# and Codespaces credential helper instead of forcing PAT rewrite behavior.
86-
git config --global --remove-section "url.${PAT_REWRITE_URL}" 2>/dev/null || true
87-
return $rc
88-
}
89-
90-
trap cleanup_pat_rewrite EXIT
91-
git config --global url."${PAT_REWRITE_URL}".insteadOf "https://github.com/"
92-
93-
if [ "$SMOKE_MODE" = "1" ]; then
94-
echo "Smoke mode: skipping git submodule update"
95-
if [ -f "duroxide-pg-opt/Cargo.toml" ]; then
96-
SUBMODULE_INITIALIZED=1
97-
fi
98-
elif git submodule update --init --recursive; then
99-
echo "✅ Submodule initialized successfully (via PAT)"
100-
SUBMODULE_INITIALIZED=1
101-
else
102-
echo "⚠️ Submodule initialization failed with PAT"
103-
fi
104-
else
105-
echo "GH_PAT not set — trying submodule init with default credentials..."
106-
if [ "$SMOKE_MODE" = "1" ]; then
107-
echo "Smoke mode: skipping git submodule update"
108-
if [ -f "duroxide-pg-opt/Cargo.toml" ]; then
109-
SUBMODULE_INITIALIZED=1
110-
fi
111-
elif git submodule update --init --recursive; then
112-
echo "✅ Submodule initialized successfully"
113-
SUBMODULE_INITIALIZED=1
114-
else
115-
echo "⚠️ Submodule initialization failed — skipping"
116-
echo " Set GH_PAT secret or ensure credentials for microsoft/duroxide-pg-opt"
117-
fi
118-
fi
119-
12059
# ── Build pg_durable ────────────────────────────────────────────────
121-
# Only build if the submodule is present (needed for compilation)
122-
if [ "$SUBMODULE_INITIALIZED" = "1" ] && [ -f "duroxide-pg-opt/Cargo.toml" ]; then
123-
echo "Building pg_durable..."
124-
if [ "$SMOKE_MODE" = "1" ]; then
125-
echo "Smoke mode: skipping cargo build"
126-
else
127-
cargo build --features pg17,http-allow-test-domains
128-
echo "✅ pg_durable built successfully"
129-
fi
60+
# duroxide-pg is pulled as a crates.io dependency (see Cargo.toml).
61+
echo "Building pg_durable..."
62+
if [ "$SMOKE_MODE" = "1" ]; then
63+
echo "Smoke mode: skipping cargo build"
64+
else
65+
cargo build --features pg17,http-allow-test-domains
66+
echo "✅ pg_durable built successfully"
13067

13168
echo "Installing pg_durable into PostgreSQL ${PG_MAJOR}..."
132-
if [ "$SMOKE_MODE" = "1" ]; then
133-
echo "Smoke mode: skipping install/cluster bootstrap"
134-
else
135-
resolve_pgrx_environment "$PG_MAJOR"
136-
cargo pgrx install --release --pg-config "$PG_CONFIG"
69+
resolve_pgrx_environment "$PG_MAJOR"
70+
cargo pgrx install --release --pg-config "$PG_CONFIG"
13771

138-
echo "Preparing PostgreSQL ${PG_MAJOR} cluster..."
139-
recreate_local_cluster
140-
start_local_postgres
141-
ensure_compatible_roles
142-
ensure_pg_durable_extension
72+
echo "Preparing PostgreSQL ${PG_MAJOR} cluster..."
73+
recreate_local_cluster
74+
start_local_postgres
75+
ensure_compatible_roles
76+
ensure_pg_durable_extension
14377

144-
VERSION=$(pg_durable_version)
145-
echo "✅ pg_durable ${VERSION} installed and verified"
78+
VERSION=$(pg_durable_version)
79+
echo "✅ pg_durable ${VERSION} installed and verified"
14680

147-
echo "Stopping PostgreSQL ${PG_MAJOR} after prebuild verification..."
148-
stop_local_postgres
149-
fi
150-
else
151-
echo "⚠️ Submodule not available — skipping pg_durable build"
81+
echo "Stopping PostgreSQL ${PG_MAJOR} after prebuild verification..."
82+
stop_local_postgres
15283
fi
15384

15485
echo ""

.github/copilot-instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ The new `.so` must work against **all** previous versions' schemas (same major v
9494

9595
For Scenario A, treat the upgrade path as the contract for already-shipped versions: before release, fresh install for the new version should match what an existing customer gets by installing the previous version and applying the upgrade chain.
9696

97-
**Updating duroxide-pg-opt dependency**: Update the submodule (`cd duroxide-pg-opt && git fetch && git checkout <new-ref>`), then rebuild. The BGW's embedded migration files update automatically via `include_dir!`. No changes to extension SQL, upgrade scripts, or any checked-in SQL copies are needed.
97+
**Updating duroxide-pg dependency**: Treat `duroxide` and `duroxide-pg` as a compatible pair. Before changing `duroxide-pg`, check the `duroxide-pg` release notes or compatibility matrix to determine whether `duroxide` must also be updated. Update the crates.io version(s) in [`Cargo.toml`](../Cargo.toml), then run `cargo update -p duroxide-pg` or `cargo update -p duroxide -p duroxide-pg` as appropriate and rebuild. The BGW's embedded migration files update automatically via `include_dir!`. No changes to extension SQL, upgrade scripts, or any checked-in SQL copies are needed.
9898

9999
**Writing a spec or design doc:** Include an "Upgrade & Migration" section covering: backward compatibility impact (B1 — will the new `.so` work against all previous schemas?), upgrade script DDL needed, and any runtime schema detection required. See [docs/upgrade-testing.md](../docs/upgrade-testing.md) for the full upgrade testing strategy.
100100

101101
## Dependencies
102102

103103
- **pgrx 0.16.1**: PostgreSQL extension framework (pinned version)
104-
- **duroxide**: Durable execution runtime
105-
- **duroxide-pg-opt**: duroxide provider/stores engine state in PostgreSQL (git submodule)
104+
- **duroxide**: Durable execution runtime (crates.io dependency pinned in [`Cargo.toml`](../Cargo.toml))
105+
- **duroxide-pg**: duroxide provider/stores engine state in PostgreSQL (crates.io dependency pinned in [`Cargo.toml`](../Cargo.toml)); keep pinned with `duroxide` as a compatible pair
106106
- **sqlx**: Async PostgreSQL from background worker
107107
- **tokio**: Async runtime for background worker
108108

.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ on:
2121

2222
env:
2323
CARGO_TERM_COLOR: always
24-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
2524
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2625

2726
concurrency:
@@ -59,7 +58,6 @@ jobs:
5958
rustup default nightly
6059
6160
- name: Check formatting
62-
# --all includes path dependencies; limit to our package to skip submodules
6361
run: cargo fmt --package pg_durable -- --check
6462

6563
prepare:
@@ -96,9 +94,6 @@ jobs:
9694
continue-on-error: ${{ matrix.pg_version == 18 }}
9795
steps:
9896
- uses: actions/checkout@v4
99-
with:
100-
submodules: true
101-
token: ${{ secrets.GH_PAT }}
10297

10398
- name: Free disk space and show usage
10499
run: |

.github/workflows/copilot-setup-steps.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ jobs:
2424
steps:
2525
- name: Checkout code
2626
uses: actions/checkout@v5
27-
with:
28-
submodules: false
29-
30-
- name: Initialize private submodule duroxide-pg-opt
31-
run: |
32-
test -n "${{ secrets.DUROXIDE_PG_OPT_TOKEN }}"
33-
git -c url."https://x-access-token:${{ secrets.DUROXIDE_PG_OPT_TOKEN }}@github.com/".insteadOf="https://github.com/" \
34-
submodule update --init --recursive
3527

3628
- name: Install Rust toolchain (stable)
3729
uses: dtolnay/rust-toolchain@stable

.github/workflows/docker.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ jobs:
4343

4444
steps:
4545
- uses: actions/checkout@v4
46-
with:
47-
submodules: true
48-
token: ${{ secrets.GH_PAT }}
4946

5047
- name: Set up Docker Buildx
5148
uses: docker/setup-buildx-action@v3
@@ -101,7 +98,6 @@ jobs:
10198
10299
- name: Run E2E tests in Docker
103100
env:
104-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
105101
PG_DURABLE_LOG_DIR: /tmp/docker-logs
106102
run: ./scripts/test-e2e-docker.sh
107103

.github/workflows/prebuild.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,5 @@ jobs:
7676
# Exercise script entrypoints without running heavy setup.
7777
export SKIP_APT_UPDATE=1
7878
export PG_DURABLE_SMOKE=1
79-
export GH_PAT="smoke-test-token"
8079
8180
bash .devcontainer/onCreateCommand.sh

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)