Skip to content

refactor(coverage-floor): split seed into post-merge follow-up PR#55

Merged
topcoder1 merged 2 commits into
mainfrom
ci/coverage-floor-post-merge-seed
May 13, 2026
Merged

refactor(coverage-floor): split seed into post-merge follow-up PR#55
topcoder1 merged 2 commits into
mainfrom
ci/coverage-floor-post-merge-seed

Conversation

@topcoder1
Copy link
Copy Markdown
Owner

Problem

The seed-mode design self-committed the seeded value back to the install PR's branch via GITHUB_TOKEN. This hits a documented GitHub limitation: GITHUB_TOKEN pushes do NOT re-trigger pull_request workflows. The self-commit creates a new HEAD SHA with no check runs reported on it — the PR is permanently "blocked" without manual gh pr close + reopen and an empty user-attributed push.

Caught on the first real-world install (whois-api-llc/wxa-jake-ai#389) — required close+reopen + an empty user push to unblock. Doesn't scale to 6+ remaining repos.

New design

Two-PR flow:

  1. Install PR ships .coverage-floor with current=0 (seed marker) + caller workflow.
  2. On pull_request with current=0: PASS. Post comment naming proposed floor. No self-commit.
  3. Install PR auto-merges naturally (one HEAD SHA, one check set).
  4. After merge, push:main with current=0 measures coverage and opens a follow-up PR chore(coverage): seed floor at X.X% with the seeded .coverage-floor.
  5. Follow-up PR is 1-file-change, labeled coverage-floor-seed, safe-paths-automerge eligible — auto-merges.
  6. After follow-up merges, future PRs run in enforce mode.

Properties

Self-test (this repo)

ci-workflows itself stays in enforce mode — .coverage-floor here has current=99.0 against ~100% selftest coverage. The new seed path only fires when current==0, so no behavior change on this PR's self-test.

Companion changes (next PRs)

  • dotclaude installer (install-coverage-floor.sh): docs update — install PR is now passive, expect a follow-up seed PR.

Auto-merge rationale

Workflow file change in ci-workflows — risk:blocked, manual click required (same as #50#54).

🤖 Generated with Claude Code

topcoder1 and others added 2 commits May 12, 2026 17:09
The previous seed-mode design self-committed the seeded value back to
the install PR's branch via GITHUB_TOKEN. This worked in isolation but
hit a documented GitHub limitation: GITHUB_TOKEN pushes do NOT re-trigger
pull_request workflows. The self-commit created a new HEAD SHA with no
check runs reported on it — the PR was permanently "blocked" without
manual `gh pr close + reopen` and an empty user-attributed push to
re-spawn workflows.

This caught us on the first real-world install
(whois-api-llc/wxa-jake-ai#389), where it took close+reopen + an empty
user push to get the seed-commit's SHA past required-status-checks.
Doesn't scale to 6+ remaining repos.

New design:
- Install PR ships `.coverage-floor` with current=0.
- On `pull_request` with current=0: PASS, post a comment naming the
  would-be floor. NO self-commit.
- Install PR auto-merges naturally (one HEAD SHA, one set of checks).
- After merge, `push:main` with current=0 measures coverage in CI and
  opens a follow-up PR `chore(coverage): seed floor at X.X%` containing
  the seeded `.coverage-floor`.
- The follow-up PR is 1-file-change, labeled `coverage-floor-seed`,
  safe-paths-automerge eligible — lands automatically.
- After follow-up merges, future PRs run in enforce mode.

Properties:
- No GITHUB_TOKEN re-trigger problem (each push gets its own workflow
  run; seed-PR is a normal PR with its own checks)
- Two-PR flow (install + seed) keeps each PR minimal and reviewable
- Loop-prevention guard preserved: refuse to seed below seed_minimum
  (default 1.0%) — caught when test infra is broken
- Idempotent: skip if a seed PR is already open

Self-test on this repo (ci-workflows) unaffected: this repo's
.coverage-floor stays at current=99.0 (enforce mode against 100%
selftest coverage); the new seed path only fires when current==0.

Companion: dotclaude installer (install-coverage-floor.sh) will be
updated to no longer expect a self-commit; the install PR is now
just the caller workflow + .coverage-floor with current=0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The multi-line PR body string was breaking the YAML 'run: |' block literal
because continuation lines at column 1 terminate the block. Use printf
to construct the body with explicit \n escapes — single line in the YAML
sense, multi-line in the rendered PR body sense.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Coverage Floor — mode: enforce

metric value
measured 100.0%
floor (current) 99.0%
target 100.0%
last bumped 2026-05-12

@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

No critical bugs found. Two minor observations below the inline-comment threshold: (1) date +%s branch naming has second-level granularity — two simultaneous push:main runs within the same second would collide on branch name and one would fail; $GITHUB_RUN_ID would be safer entropy. (2) gh label create 2>/dev/null || true silently swallows non-idempotency errors (e.g. permission denied), which would surface later as a confusing 'label not found' error from gh pr create. Neither is a data-correctness issue. Overall the two-PR design is sound and the TOCTOU fix is the right call.

@topcoder1 topcoder1 merged commit 7672fb7 into main May 13, 2026
11 checks passed
@topcoder1 topcoder1 deleted the ci/coverage-floor-post-merge-seed branch May 13, 2026 00:15
topcoder1 added a commit that referenced this pull request May 13, 2026
…naturally) (#56)

## Problem

#55 split the seed self-commit into a post-merge follow-up PR, expecting
that to bypass the GITHUB_TOKEN recursion-prevention. **It didn't.** The
seed PR is also opened via GITHUB_TOKEN, which has the same problem —
pull_request workflows don't spawn on GITHUB_TOKEN-opened PRs.

Caught on whois-api-llc/wxa_vpn#361 (seed PR opened cleanly at 80.2%,
zero check runs, merge=BLOCKED). Required manual empty-commit unblock,
same friction as the original.

## Fix

Forward `AUTOMERGE_PAT` (already deployed fleet-wide for
`claude-author-automerge.yml`'s same recursion-prevention workaround)
into the reusable. Use it to:
- Push the seed branch (`git push -u $PUSH_URL $BRANCH` with
PAT-embedded URL)
- Open the seed PR (`gh pr create` with `GH_TOKEN=$AUTOMERGE_PAT`)

PAT-attributed pushes/opens DO spawn pull_request workflows. No manual
unblock needed.

## Fallback

If caller doesn't forward `AUTOMERGE_PAT`, falls back to `GITHUB_TOKEN`
with a clear `::warning::` that manual unblock will be needed. Install
remains functional, just less smooth.

## Caller-side change required

Each fleet repo's caller workflow must forward the secret:

\`\`\`yaml
jobs:
  coverage-floor:
uses: topcoder1/ci-workflows/.github/workflows/coverage-floor.yml@main
    secrets:
      AUTOMERGE_PAT: \${{ secrets.AUTOMERGE_PAT }}
\`\`\`

Will update the dotclaude caller template in a companion PR.

## Auto-merge rationale

Workflow file change in ci-workflows — risk:blocked, manual click
required.

## Plan reference

\`~/.claude/plans/dotclaude-2026-05-12-install-test-ratchet.md\` — Phase
3 debug iteration v2.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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