Skip to content

Orchestrate managed local Forge migrations - #321

Merged
Joncallim merged 5 commits into
mainfrom
agent/installer-managed-migrations
Aug 3, 2026
Merged

Orchestrate managed local Forge migrations#321
Joncallim merged 5 commits into
mainfrom
agent/installer-managed-migrations

Conversation

@Joncallim

Copy link
Copy Markdown
Owner

Summary

The native installer-managed local database path now runs the existing versioned migration sequence: release-role bootstrap, migrations through 0025, S3 bootstrap and 0026, S4 bootstrap and 0027, the S5 cleanup wrapper, then the ordinary latest migrator. Custom DATABASE_URL and Docker paths retain ordinary operator-managed migration behavior.

Root cause

A local database at migration 0025 has the release-owner boundary but not the administrator-installed 0026 S3 bootstrap helper. The installer previously invoked ordinary db:migrate directly, which failed on the missing helper.

Security boundary

Administrator access is process-only through the existing passwordless local peer/socket path. The installer sets postgresql:///forge with PGHOST/PGUSER; it does not persist or log an admin credential, change the Forge application role, or alter the existing bootstrap/migration SQL.

Validation

  • bash -n scripts/install.sh
  • bash -n scripts/test-install-managed-migrations.sh
  • scripts/test-install-managed-migrations.sh
  • git diff --check
  • cd web && npx tsc --noEmit
  • cd web && npm run lint
  • cd web && npm test -- --run __tests__/epic-172-s3-release.test.ts __tests__/epic-172-s4-context.test.ts (36 tests)

The focused harness covers sequencing, mocked current/sudo/runuser peer selection, custom/Docker bypass, dry-run, unavailable admin, S5 failure cleanup intent, idempotent orchestration reruns, and a non-leaking test sentinel. It is wired into Web CI. No live Forge database or installer was run.

@gitguardian

gitguardian Bot commented Aug 3, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
35664395 Triggered Generic Password 0fd9208 scripts/ci/prove-installer-managed-migrations.sh View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Joncallim
Joncallim marked this pull request as ready for review August 3, 2026 03:53
@Joncallim
Joncallim merged commit 8e4eebf into main Aug 3, 2026
4 checks passed
@Joncallim
Joncallim deleted the agent/installer-managed-migrations branch August 3, 2026 03:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a6221c10c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/install.sh
done
PATH="$controlled_path"
export PATH
run "$description" "$runuser_bin" -u postgres --preserve-environment -- "$MANAGED_LOCAL_BASH" -c 'cd "$1"; case "$2" in

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep migrations accessible from private home directories

On native Linux installs that fall back to runuser or sudo, this command changes to $REPO_ROOT/web after switching to the postgres account. If Forge is checked out beneath a typical 0700 or 0750 home directory, postgres cannot traverse the path, so the first managed migration fails even though PostgreSQL administration was resolved successfully. The mirrored sudo path at line 1601 has the same problem; run the repository code as the invoking user or stage it in a protected, readable location before switching identities.

Useful? React with 👍 / 👎.

Comment thread scripts/install.sh
Comment on lines +1545 to +1547
MANAGED_LOCAL_NODE="$(trusted_linux_tool node)" || die "Could not find a root-owned non-writable node for elevated managed migrations."
MANAGED_LOCAL_NPM="$(trusted_linux_tool npm)" || die "Could not find a root-owned non-writable npm for elevated managed migrations."
MANAGED_LOCAL_NPX="$(trusted_linux_tool npx)" || die "Could not find a root-owned non-writable npx for elevated managed migrations."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reuse the Node 22 toolchain already validated

On Linux systems where the accepted Node 22 installation comes from nvm, asdf, or another user-managed path, this fixed-path resolver either reports that Node/npm/npx are missing or silently selects an older system Node. ensure_node explicitly accepts the caller's PATH runtime, and --upgrade skips dependency installation, so managed migrations can fail after the installer has already declared the runtime ready. Resolve a compatible protected toolchain from the validated runtime or explicitly verify that the elevated Node is version 22 or newer.

Useful? React with 👍 / 👎.

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