Repository navigation
[3446 by Claude Opus 5.5] Document after_create recipes for env files, generated artifacts and shared local resources - #3449
Conversation
…xamples for issue #3446. There's no runtime change. The docs site builds, the docs tests and both CLI init test files pass, and the CLI typecheck is clean. Docs: new "Fresh worktrees" subsection under lifecycle hooks in `docs/docs/features/repository-workflow.md`: - What's missing: each attempt starts from a fresh worktree in a new container, so git-ignored files are absent. Parallel runs collide on anything outside the container that has a fixed name. - Hook environment: a table of `PROPR_WORKSPACE`, `PROPR_CACHE_DIR` and `PROPR_AGENT_TYPE`. It states plainly that none of them identifies a run, so the recipe generates a run ID in `after_create` and keeps it in `PROPR_CACHE_DIR`, where `before_remove` can read it. - Cache directory: it's for package caches and passing state between hooks. It isn't committed and doesn't survive the container. Anything hooks write inside the worktree must be git-ignored, because ProPR commits the workspace. - Recipes: - copy `.env.example` to `.env`. - run install and codegen in an inline `after_create`. - give databases, ports, Compose project and SQLite path per-run names, written to `.env`. - clean up in `before_remove`, coping with runs that failed before creating anything, plus a note that cleanup is best effort. - Multi-line hooks: inline hooks run as one `bash -c` script, so only the last command's exit status counts. The snippets start with `set -euo pipefail`, and the docs say why. Without it, a failed `npm ci` would not fail the hook. Links: `repository-best-practices.md` links to the new subsection and gains a checklist item. `propr-cli.md` describes the new scaffold examples and links there too. Scaffold (`initCommands.ts`): - `SETUP_SH` gains commented examples for creating the env file and running codegen. - `WORKFLOW_YML` gains a comment linking to `#fresh-worktrees` and a commented inline `after_create` example. Tests: - `packages/cli/src/commands/initCommands.test.ts` checks that `init repo` writes the commented examples and leaves them commented out. - `test/cliInitCommand.test.ts` parses the generated `workflow.yml`, checks that uncommenting the inline `after_create` gives a valid policy, and checks the new `setup.sh` examples. Every YAML snippet in the new section passes `parseRepositoryWorkflow`, the same check ProPR applies to workflow files. The database and Compose recipes are examples, not something I ran here: they assume `createdb`, `dropdb` and `docker compose` exist, which the default agent image may not have. The docs present them as patterns to adapt. I didn't create visual previews because this is a documentation and scaffold-text change with no UI change.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds useful fresh-worktree guidance without changing runtime behavior, but needs minor changes before merge: two advertised recipes do not reliably prepare the resources they describe. ✅ Safe scaffold defaults — New commands remain commented out, and tests verify that scaffolding does not enable ✅ Schema coverage — The new test parses both the default workflow and the uncommented inline hook. ✅ Lifecycle clarity — The documentation correctly distinguishes explicit setup failures from implicit setup behavior and explains best-effort cleanup. The supplied checks show 36 passed, none failed, and one pending. The issue specification is truncated, so assessment of its acceptance criteria is limited to the visible requirements. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Restore the workspace before setup examples
F2: 🔴 Use the same database connection throughout
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Exercise enabled setup examplesA small behavioral test with a root ScoreThe documentation and schema tests are useful, but the scaffold directory error and inconsistent database connections undermine the copyable recipes. Both defects have localized corrections; current checks report no failures. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit a6f828f
Summary of ChangesI fixed both findings and added a test that runs the two recipes; it passes now and fails against the previous commit. F1: setup examples ran inside
F2: database recipe used three different connections (
Regression test:
Checks: the new tests, There are no previews, because this is a text-only docs and scaffold change. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…cipes; it passes now and fails against the previous commit. I fixed both findings and added a test that runs the two recipes; it passes now and fails against the previous commit. **F1: setup examples ran inside `.propr`** (`packages/cli/src/commands/initCommands.ts`) - The helper-package block in the scaffolded `setup.sh` now ends with `cd "$PROPR_WORKSPACE"`, plus a comment that the steps below run in the repository root. - With the examples uncommented, `.env` is now copied from the root `.env.example`, and `npm ci` / `npm run codegen` act on the root `package.json`. - I checked the related snippets. The docs' env-file recipe already starts with `cd "$PROPR_WORKSPACE"`, and the workflow.yml inline `after_create` example runs in the workspace. Neither had the bug. **F2: database recipe used three different connections** (`docs/docs/features/repository-workflow.md`) - The setup recipe now writes the connection settings once to `$PROPR_CACHE_DIR/pg.env` (`PGHOST=db.internal.example.com PGPORT=5432 PGUSER=app`) and loads them. Then `createdb` runs, and `DATABASE_URL` is built from the same values (`postgres://$PGUSER@$PGHOST:$PGPORT/$db`). - The `before_remove` recipe loads the same `pg.env` before `dropdb`, so cleanup targets the server where the database was created. - `pg.env` is written before `run-id`, so whenever cleanup finds a run ID it also finds the connection settings. - A new paragraph states what the user must provide: the `app` role must be allowed to create databases. Its password must reach the hooks and the app without a prompt, for example through `PGPASSWORD` or `~/.pgpass`, and must never go in `.env.example`. **Regression test: `test/freshWorktreeRecipes.test.ts`** (the suite runner picks it up automatically) - **Scaffold test:** it generates the scaffold, uncomments the env-file and codegen examples, and runs `setup.sh` with a fake `npm` that records where it runs. It checks that `.env` comes from the root example, that the helper install runs in `.propr`, and that `npm ci` and codegen run in the root. - **Database test:** it takes the setup recipe and the `before_remove` hook straight from the docs page, reading the hook through `parseRepositoryWorkflow`. It runs both with fake `createdb`, `dropdb` and `docker`, and with any `PG*` variables cleared. It checks that `createdb` and `dropdb` reach the same host, port and user, and that `DATABASE_URL` points to that same server and database. **Checks:** the new tests, `test/cliInitCommand.test.ts` and `packages/cli` `initCommands.test.ts` all pass, and the CLI typecheck is clean. There are no previews, because this is a text-only docs and scaffold change. PR: #3449 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds useful fresh-worktree recipes and scaffold guidance, with focused tests for working directories, schema parsing, and database connection consistency. It needs a small documentation correction before merge. ✅ Correct setup directory — The scaffold returns to ✅ Consistent database lifecycle — Creation and cleanup load the same saved PostgreSQL connection settings and use the same generated database name. ✅ Passing checks — The supplied current-head status reports 38 passed checks, with no failures or pending checks. The issue specification is explicitly truncated, so acceptance assessment is limited to its visible requirements. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F3: 🔴 Correct restricted-network database guidance
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe implementation is focused and well tested for its intended scaffold behavior, and all current checks pass. One localized documentation defect remains that would lead users to a failing setup configuration. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit d2ef770
Summary of ChangesI fixed F3. The PostgreSQL recipe no longer suggests that What changed in
Test: I added one case to I checked the other pages this PR changed (the best-practices page, the CLI page, and the One limit remains: the database test still replaces 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…network.allow` lets the database connection through in restricted mode. This was a docs-only change, so I didn't create a preview. I fixed F3. The PostgreSQL recipe no longer suggests that `network.allow` lets the database connection through in restricted mode. This was a docs-only change, so I didn't create a preview. **What changed in `docs/docs/features/repository-workflow.md` (Fresh worktrees):** - **New paragraph after the PostgreSQL recipe:** it says the recipe connects to PostgreSQL directly, so it needs ordinary outbound networking (`network.mode: open`, the default) and a database server the container can reach. It explains why it fails in a restricted run: there is no network interface, the only route out is an HTTP(S) proxy, so `createdb` can't connect and the failed `after_create` stops the attempt. It states that adding the database host to `network.allow` doesn't change that. As alternatives for restricted runs, it suggests a database server installed in the agent image and listening on loopback, or skipping database setup. I haven't tested the loopback option. - **Service-host guidance rewritten:** the old line "add any database or service host the hooks reach to `network.allow`" now says: - `network.allow` only admits HTTP(S) traffic that goes through the proxy, not direct database or other raw TCP connections. - An entry without a port allows only ports 80 and 443, so other ports need `host:port`. - Repository entries never reach private addresses. It links to the Restricted network mode section of `execution-safety.md`. **Test:** I added one case to `test/freshWorktreeRecipes.test.ts`. It checks that the Fresh worktrees section contains the new requirements and no longer contains the old allowlist sentence. All 3 tests in the file pass. Run against the previous version of the doc, the new case fails, so it catches this regression. I checked the other pages this PR changed (the best-practices page, the CLI page, and the `propr init` scaffold comments) for the same assumption. None of them mention `network.allow` or a database connection, so nothing else needed fixing. One limit remains: the database test still replaces `createdb` with a stub, so it checks connection settings, not that a real connection works. The new text describes what restricted mode does, as documented in `execution-safety.md`; I didn't run it against a restricted container. PR: #3449 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationReady to merge within the visible scope. The PR adds practical fresh-worktree guidance and commented scaffold examples without changing hook execution policy. ✅ Correct setup directory — The scaffold returns to ✅ Consistent resource lifecycle — Database creation and cleanup reuse persisted connection settings and a generated run ID. The documentation correctly distinguishes direct PostgreSQL access from restricted HTTP(S) proxy access. ✅ Focused coverage — Added tests check scaffold defaults, enabled YAML parsing, setup working directories, and matching database creation and cleanup arguments. This assessment uses static review of the supplied diff and context; no commands were run. No current-head checks were reported. The issue excerpt is truncated, so acceptance criteria beyond the visible excerpt could not be assessed. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Exercise partial setup cleanupThe new database recipe test covers successful creation and cleanup. An optional follow-up could exercise cleanup with no saved run ID and after a failed ScoreThe visible requirements are addressed with scoped changes and relevant tests. Static review found no merge blockers; test execution remains unverified in this review. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI Implementation Summary
Closes #3446
Branch:
3446/claude-opus-5-5-document-after_create-rec-20261111-2200-3q5Commits: ✅ Changes committed (c48a3ba)
AI Processing Completed
Execution Details:
Summary:
I've added the "Fresh worktrees" docs and the
propr initscaffold examples for issue #3446. There's no runtime change. The docs site builds, the docs tests and both CLI init test files pass, and the CLI typecheck is clean.Docs: new "Fresh worktrees" subsection under lifecycle hooks in
docs/docs/features/repository-workflow.md:PROPR_WORKSPACE,PROPR_CACHE_DIRandPROPR_AGENT_TYPE. It states plainly that none of them identifies a run, so the recipe generates a run ID inafter_createand keeps it inPROPR_CACHE_DIR, wherebefore_removecan read it..env.exampleto.env.after_create..env.before_remove, coping with runs that failed before creating anything, plus a note that cleanup is best effort.bash -cscript, so only the last command's exit status counts. The snippets start withset -euo pipefail, and the docs say why. Without it, a failednpm ciwould not fail the hook.Links:
repository-best-practices.mdlinks to the new subsection and gains a checklist item.propr-cli.mddescribes the new scaffold examples and links there too.Scaffold (
initCommands.ts):SETUP_SHgains commented examples for creating the env file and running codegen.WORKFLOW_YMLgains a comment linking to#fresh-worktreesand a commented inlineafter_createexample.Tests:
packages/cli/src/commands/initCommands.test.tschecks thatinit repowrites the commented examples and leaves them commented out.test/cliInitCommand.test.tsparses the generatedworkflow.yml, checks that uncommenting the inlineafter_creategives a valid policy, and checks the newsetup.shexamples.Every YAML snippet in the new section passes
parseRepositoryWorkflow, the same check ProPR applies to workflow files.The database and Compose recipes are examples, not something I ran here: they assume
createdb,dropdbanddocker composeexist, which the default agent image may not have. The docs present them as patterns to adapt.I didn't create visual previews because this is a documentation and scaffold-text change with no UI change.
Detailed Logs:
2c7d28d9-97d5-48c3-9a3e-b86fd18d1aabLog files stored at:
/usr/src/app/logs/executions/issue-3446-2026-11-11T22-10-49-371Z-conversation.json/usr/src/app/logs/executions/issue-3446-2026-11-11T22-10-49-371Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #3446.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!