Skip to content

test: verify plan-to-git push#418

Closed
skulidropek wants to merge 1 commit into
ProverCoderAI:mainfrom
skulidropek:issue-4
Closed

test: verify plan-to-git push#418
skulidropek wants to merge 1 commit into
ProverCoderAI:mainfrom
skulidropek:issue-4

Conversation

@skulidropek

Copy link
Copy Markdown
Member

No description provided.

@skulidropek

Copy link
Copy Markdown
Member Author

Agent Plan Update

Branch: issue-4 at d053d8c.

1. Plan

Source: claude - Captured: 2026-06-17T14:10:22Z

Plan: No-Op Verification for plan-to-git git push

Context

The git wrapper at packages/container/src/core/templates-entrypoint/git-post-push-wrapper.ts
intercepts git push and runs a three-stage post-push pipeline:

  1. Ensure open PR (post-push-pr.ts) — creates a PR if none exists
  2. Plan importplan-to-git import-codex --no-sync + plan-to-git import-claude --no-sync
  3. Plan syncplan-to-git sync --pr <N> or branch discovery fallback
  4. Session backupdocker-git-session-sync backup …

The wrapper exposes two opt-out env vars:

  • DOCKER_GIT_SKIP_PLAN_TO_GIT=1 — skips steps 2–3 only (PR + session backup still run)
  • DOCKER_GIT_SKIP_POST_PUSH_ACTION=1 — skips the entire post-push pipeline (true no-op)

The test file
packages/container/tests/core/git-post-push-wrapper.test.ts
already covers eleven scenarios — including the DOCKER_GIT_SKIP_PLAN_TO_GIT=1 partial skip —
but has no test for DOCKER_GIT_SKIP_POST_PUSH_ACTION=1.

Gap

docker_git_post_push_action() in the wrapper (line 133):

if [[ "${DOCKER_GIT_SKIP_POST_PUSH_ACTION:-}" == "1" ]]; then
  return 0
fi

This guard is the only mechanism that makes a successful push a complete no-op.
Without a test, a future refactor could silently remove it.

Implementation

Add one it.effect block to the existing describe block in
packages/container/tests/core/git-post-push-wrapper.test.ts (after line 635, before the closing }):

it.effect("skips all post-push actions when DOCKER_GIT_SKIP_POST_PUSH_ACTION is set", () =>
  withHarness((harness) =>
    Effect.gen(function*(_) {
      yield* _(
        runWrapper(harness, harness.repoDir, ["push", "origin", "HEAD"], {
          env: { DOCKER_GIT_SKIP_POST_PUSH_ACTION: "1" }
        })
      )

      const nodeScript = yield* _(readLogLines(harness.nodeScriptLogPath))
      const planToGit = yield* _(readLogLines(harness.planToGitLogPath))
      const gh       = yield* _(readLogLines(harness.ghLogPath))

      // Invariant: DOCKER_GIT_SKIP_POST_PUSH_ACTION=1 is a complete no-op —
      // no PR creation, no plan import/sync, no session backup.
      expect(nodeScript).toEqual([])
      expect(planToGit).toEqual([])
      expect(gh).toEqual([])
    })
  ).pipe(Effect.provide(NodeContext.layer)))

No new files, no new helpers, no new dependencies. The test reuses:

  • withHarness (line 305) — temp-dir scaffolding with fake binaries
  • runWrapper (line 288) — executes the generated wrapper script
  • readLogLines (line 225) — reads fake-binary call logs

Verification

# Run only this test file
npm test -- --filter "git post-push wrapper"

# Or run the full suite
npm test

Expected: new test passes; all existing 11 tests continue to pass.

Invariant proven:
∀ push: DOCKER_GIT_SKIP_POST_PUSH_ACTION=1 → gh_calls=∅ ∧ plan_to_git_calls=∅ ∧ session_sync_calls=∅

@skulidropek

skulidropek commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

AI Session Backup

Commit: d053d8c
Status: skipped
Message: No session directories found.

git status

On branch issue-4
Your branch is up to date with 'origin/issue-4'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   packages/container/tests/core/git-post-push-wrapper.test.ts

no changes added to commit (use "git add" and/or "git commit -a")

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