Skip to content

Add PostgreSQL snapshot and regrade recipe - #31

Open
rezacr588 wants to merge 1 commit into
harbor-framework:mainfrom
rezacr588:codex/postgres-snapshot-regrade
Open

rezacr588 wants to merge 1 commit into
harbor-framework:mainfrom
rezacr588:codex/postgres-snapshot-regrade

Conversation

@rezacr588

Copy link
Copy Markdown

The Cookbook has a multi-container example, but no end-to-end recipe showing how to grade database state after the original environment is gone.

Add a small PostgreSQL order-total repair task that captures a deterministic JSON snapshot from a database sidecar, grades it in a separate verifier, and regrades the saved trial without rerunning the agent or database. The README includes commands pinned to released Harbor 0.24.0, an Oracle solution, and a Nop control. Register the recipe and link it from the root README.

The agent can read the tables and update only orders.total_cents. A sidecar collect hook runs after the main container stops, captures all grading inputs in one SQL statement, and publishes the snapshot atomically. Remote superuser access is rejected; the verifier only reads JSON.

Validation on Docker/Linux ARM64 from macOS with Harbor 0.24.0 and Python 3.13.17:

Case Result
Oracle repair reward 1; 7 tests pass
Nop control reward 0; the 3 incorrect totals fail
Regrade Oracle after original containers are removed reward 1
Regrade Nop after original containers are removed reward 0
Regrade a copy with an incorrect total reward 0
Regrade a copy with the snapshot removed explicit RegradeError, no reward

Both original snapshot hashes remain unchanged after regrading. Ten additional checks cover database permissions, remote superuser rejection, and deterministic capture. Repository-wide Ruff lint/format, shell syntax, registry validation, and the new recipe's structure checks pass.

The existing structure-check failure on main is reproducible unchanged at e093c9a: the multi-step recipe keeps instructions and test entrypoints under steps/, while CI requires root instruction.md and tests/test.sh. Main's CI run also fails validate-recipes. This PR leaves that existing recipe and validator unchanged.

AI assistance was used for implementation and validation.

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.

1 participant