Skip to content

fix(ci): upstream-assessment pushes its report straight to main, which the #1109 ruleset rejects #1153

Closed

Description

@admarble

What happens

.github/workflows/upstream-assessment.yml has failed on every scheduled run since 08-31 (08-31, 09-07, 09-14, 09-21), in the step Run upstream assessment. The first cause was the missing assessment label, which src/lib/upstream/issues.ts:296 applies. That label was created on 2026-09-25.

A second failure sits behind it. The Commit report and baseline step (upstream-assessment.yml:131-146) runs git commit and then a bare git push to main. Since #1109 (2026-09-20), main rejects direct pushes (ruleset CC, GH013), so a run that gets past the label still fails at the push. The next scheduled run is Monday 2026-09-28 09:00 UTC.

Expected

The report and baseline under .sequant/upstream/ land through a PR, as every other commit to main does (#1109, #1131). The owner decided on 2026-09-25 to keep committing reports, via a PR.

Acceptance criteria

Tier: mechanical · Graph: 2026-09-w3 (docs/internal/graph-2026-09-w3/issue-graph.md)

Owner decision (2026-09-25): the report lands through a PR opened with a GitHub App token. QA on PR #1155 showed the plain-GITHUB_TOKEN route can't work: Actions isn't allowed to create PRs here (403), and a PR opened by GITHUB_TOKEN never starts the required test/canary checks. The rejected alternatives were enabling that setting (report PRs stay unmergeable without a manual nudge), not committing reports (loses history), and a ruleset bypass for github-actions (reopens direct pushes to main).

  • AC-1: the workflow never pushes to main; it commits the report to upstream/<version> and opens a PR — Evidence: grep -n "git push" .github/workflows/upstream-assessment.yml shows only git push origin "$BRANCH"
  • AC-2: the push and gh pr create authenticate as a GitHub App (actions/create-github-app-token, repo variable UPSTREAM_APP_CLIENT_ID, secret UPSTREAM_APP_PRIVATE_KEY), and GITHUB_TOKEN is reduced to contents: read + issues: write — Evidence: grep -nE "create-github-app-token|steps.app.outputs.token|contents: read" .github/workflows/upstream-assessment.yml matches all three
  • AC-3: without the App configured, the run still succeeds: the report is uploaded as the upstream-assessment artifact with a ::warning::, and no push is attempted — Evidence: grep -n "upload-artifact\|::warning::" .github/workflows/upstream-assessment.yml matches both
  • AC-4: a new report is actually staged despite **/.sequant/ in .gitignore — Evidence: grep -n "git add -f .sequant/upstream/" .github/workflows/upstream-assessment.yml matches
  • AC-5: when nothing under .sequant/upstream/ changed, no branch or PR is created — Evidence: the git status --porcelain .sequant/upstream/ guard wraps the push and gh pr create (read the step)
  • AC-6: owner step, after merge: with the App installed and UPSTREAM_APP_CLIENT_ID / UPSTREAM_APP_PRIVATE_KEY set, a dispatched run completes green and opens a report PR on which test and canary run — Evidence: gh run list --workflow upstream-assessment.yml --limit 1 --json conclusion --jq '.[0].conclusion' prints success, and gh pr checks <report PR> lists test and canary

Non-Goals

Related

#1109 (main ruleset) · #1131 (/release lands via PR)

Activity

  1. added
    bug
    upstream
    on Sep 25, 2026
  2. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    Runner context (graph 2026-09-w3, docs/internal/graph-2026-09-w3/issue-graph.md, PR #1154) — these rules apply to the spec, exec AND qa phases:

    • qa phase: do not run the full npm test. Verify each AC with its own verify command and run only the named test files. The runner runs the full suite once per PR, serially — three phase agents share this machine and a full-suite call inside a phase can hit the 30-minute no-progress wall.
    • exec phase: commit WIP before any long command; run the full suite at most once, in the foreground, with a timeout; never run_in_background.
    • Gate-test ACs: the PR body's <!-- SEQUANT_MUTATION: {...} --> marker needs failedTest to start with the test file path (src/.../x.test.ts > describe > case), or /qa §6i floors it to AC_NOT_MET.
    • CHANGELOG: add exactly one [Unreleased] line.
    • Stop at the PR — do not merge.
  3. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (4 ACs, 1 directory)

    AC Quality Check

    Clean. Every AC has a verify command. AC-4 can only be checked after merge and needs a live run.

    Scope Assessment

    Non-Goals: ⚠️ Not stated. Implied: the label fix already landed, and the assessment logic in scripts/upstream/assess.ts is untouched.

    Metric Value Status
    Feature count 1 ✅
    AC items 4 ✅
    Directory spread 1 (.github/workflows/) ✅

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: the workflow pushes only an upstream/<version> branch, never main

    Verification: Manual Test (read the step and run the grep)
    Scenario: Given the workflow file → When grep -n "git push" runs → Then the only match pushes upstream/$VERSION.

    AC-2: the job has pull-requests: write

    Verification: Manual Test (grep)
    Scenario: Given the assess job → When grepped → Then pull-requests: write is present.

    AC-3: no changes under .sequant/upstream/ means no branch and no PR

    Verification: Manual Test (read the step)
    Scenario: Given a run that changes nothing → Then the guard skips both git push and gh pr create.

    AC-4: a post-merge workflow_dispatch run with the latest version is green and opens a PR

    Verification: Manual Test (gh workflow run then gh run list). This is post-merge and needs a human.

    Implementation Plan

    Phase 1: Rewrite the Commit report and baseline step (upstream-assessment.yml:131-146)

    1. Add pull-requests: write under permissions: (line ~28).
    2. Add GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} to the step env. gh pr create needs it.
    3. Inside the changes guard, run git switch -c "upstream/$VERSION", git add, git commit, then git push origin "upstream/$VERSION".
    4. Run gh pr create --base main --head "upstream/$VERSION" --title "docs: Upstream assessment for $VERSION" --body ....
    5. Make the rerun path idempotent: if upstream/$VERSION already exists on origin, skip or update instead of failing. A failed first attempt or a second dispatch for the same version would otherwise fail on the push.
    6. Change the guard from git diff --quiet to [ -z "$(git status --porcelain .sequant/upstream/)" ]. git diff --quiet ignores untracked files, and a new ${VERSION}.md report is untracked. It only works today because baseline.json is modified too. This is a small robustness fix inside the same guard, and AC-3 still holds.

    Design Review

    1. Where does this logic belong? In the workflow step. Keep the shell inline, matching the existing steps.
    2. Simplest correct approach? Branch, commit, push, gh pr create. Rejected: a bot PAT or GitHub App token (more secrets), and a ruleset bypass for the bot (weakens gate(owner): apply the main ruleset — target ~DEFAULT_BRANCH, require the test check, strict up-to-date #1109).
    3. Existing pattern? /release Step 6 (bug(release): /release Step 6 pushes to main, which the #1109 ruleset now rejects (GH013) — land the release commit through a PR #1131) also lands through a PR.
    4. What would a senior reviewer challenge? See Open Question 1: PRs opened with GITHUB_TOKEN do not trigger push or pull_request workflows. The required test and canary checks would never start, and the PR would sit unmergeable.

    Feature Quality Planning

    • Repo setting: "Allow GitHub Actions to create and approve pull requests" must be on, or gh pr create fails with a 403 even with pull-requests: write. Add a check in AC-4 verification.
    • Untrusted input: VERSION comes from inputs.version. Keep it in env: as the step does today, never inline ${{ }}. Validate it against ^v?[0-9]+\.[0-9]+\.[0-9]+$ before using it as a branch name.
    • Test coverage: No test file covers this workflow (grep over src/, tests/ and scripts/ found none). Verification is grep plus the dispatch run. Adding a gate test is optional. If one is added, it needs mutation verification per CLAUDE.md.

    Derived ACs

    Source Derived AC Priority
    Error handling AC-5: rerunning for a version whose upstream/<version> branch or PR already exists does not fail the job Medium
    Security AC-6: VERSION is validated before it is used in a branch name Medium

    Open Questions

    1. Will the required checks run on the bot's PR? GITHUB_TOKEN PRs do not trigger workflows, so test and canary never report and the strict ruleset blocks the merge. Recommendation: accept a manual step (the owner closes and reopens the PR, or pushes an empty commit, to trigger CI). This is a documented GitHub limitation, and a PAT or App token would add a secret. Impact if wrong: the PR is created but cannot merge without that step.
    2. Repo setting for Actions PRs enabled? Check gh api repos/admarble/sequant/actions/permissions/workflow --jq .can_approve_pull_request_reviews. Recommendation: enable it if it is off. Impact if wrong: AC-4 fails with a 403.
    3. Should the derived ACs 5 and 6 be added? Recommendation: yes, both are small.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: A single-file CI workflow edit with manual and grep verification. No Unit or Integration Test ACs, so testgen is skipped. The test and security-review phases are not needed.

    Label Review

    Current: bug, upstream
    Recommended: bug, upstream (add planned)
    Quality Loop: Won't auto-enable

    Runner context (graph 2026-09-w3): qa does not run the full npm test. It runs each AC's verify command. exec commits WIP first and stops at the PR without merging. CHANGELOG gets one [Unreleased] line.

  4. added
    planned
    on Sep 25, 2026
  5. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_NOT_MET

    AC coverage: 0/3 met

    Gaps:

    • The commit step still fails: exits 1 on an ignored path, aborting before and leaving the report file uncommitted
    • under will return 403 because 'Allow GitHub Actions to create and approve pull requests' is disabled on this repository
    • A PR opened by GITHUB_TOKEN never triggers the / checks the main ruleset requires, so the report PR cannot merge and the report does not land on main
    • The comment justifying the git diff to git status --porcelain swap states an effect the code does not have in this repo
    • AC-3's prescribed guard mechanism was substituted; the requirement (no changes implies no branch or PR) still holds but the literal Verify command no longer applies

    Suggestions:

    • A PAT / GitHub App token in GH_TOKEN (for the push and gh pr create) resolves Issues 2 and 4 together and is the conventional fix for both. That is an owner decision (secret provisioning) rather than something QA should pick.
  6. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    Runner verification of the QA findings (PR #1155): all three blockers reproduce.

    1. git check-ignore -v --no-index .sequant/upstream/v9.9.9.md → .gitignore:52:**/.sequant/. The later **/.sequant/ rule overrides the !.sequant/upstream/ negation on line 50, so git add .sequant/upstream/ rejects a new report. This bug predates the PR. Fixable in scope, with git add -f or by reordering .gitignore.
    2. gh api repos/sequant-io/sequant/actions/permissions/workflow → {"default_workflow_permissions":"read","can_approve_pull_request_reviews":false}. The job-level pull-requests: write can't override the repo policy, so gh pr create returns 403.
    3. A PR opened with GITHUB_TOKEN starts no workflow runs, so the ruleset's required test and canary checks never report, and the report PR can't merge.

    Items 2 and 3 need an owner decision (a token secret, a repo setting, or dropping the committed report). The runner is holding this node until that decision is made.

  7. added 4 commits that reference this issue on Sep 25, 2026
  8. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    Runner, qa phase: the ACs were rewritten on 09-25 for the owner's GitHub App decision. Verify AC-1 to AC-5 with their literal commands. AC-6 is owner/post-merge. Workflow dispatch is blocked by the hook here, so don't try it. No full npm test is needed (YAML and CHANGELOG only; CI at the head SHA is green).

  9. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    QA Verdict: NEEDS_VERIFICATION

    AC coverage: 0/2 met

    Gaps:

    • AC-6 requires an owner to install a GitHub App and dispatch the workflow after merge; it is unverifiable now
    • The change-detection guard cannot see a new ignored report and works only through an undocumented dependency on baseline.json changing, so a no-op baseline write would silently drop the report on a green run
    • release.yml still pushes directly to main, the same gate(owner): apply the main ruleset — target ~DEFAULT_BRANCH, require the test check, strict up-to-date #1109 GH013 rejection this issue fixes for upstream-assessment; no open issue covers it
    • .github/workflows/upstream-assessment.yml:165-167 — the comment states the opposite of what the code does. It says "porcelain, not git diff: a new report is untracked, and git diff only sees the modified baseline.json." But the new report is ignored, not merely untracked, so git status --porcelain does not see it either. Measured, not reasoned: with .sequant/upstream/v9.9.9.md present, git status --porcelain .sequant/upstream/ returns empty; --ignored returns !! .sequant/upstream/v9.9.9.md. The guard opens only because tracked baseline.json is rewritten by updateBaseline() on every non-dry run (src/lib/upstream/assessment.ts:284-287) — i.e. via exactly the signal the comment attributes to git diff. It works, but the coupling is undocumented and load-bearing: if updateBaseline ever writes identical bytes, the report is dropped under "No changes to commit" with a green run. git status --porcelain --ignored .sequant/upstream/ (or testing the report path directly) would make the guard mean what the comment claims.

    Suggestions:

  10. added 2 commits that reference this issue on Sep 25, 2026
  11. admarble commented on Sep 25, 2026

    @admarble
    ContributorAuthor

    Merged in #1155 (ed79d880). Reopened for AC-6 only. The owner still needs to create the App, set UPSTREAM_APP_CLIENT_ID and UPSTREAM_APP_PRIVATE_KEY, dispatch once, and confirm the report PR runs test and canary. Until then, runs pass and upload the report as an artifact with a warning. Sibling found by QA: release.yml direct push → #1162.

  12. admarble commented on Sep 26, 2026

    @admarble
    ContributorAuthor

    AC-6 met (2026-09-26). The sequant-upstream-bot App is installed on sequant-io, with UPSTREAM_APP_CLIENT_ID and UPSTREAM_APP_PRIVATE_KEY set. Dispatch run 36210408001 (version=v2.1.283) succeeded through the App path, filing assessment #1171 and findings #1172–#1177. The bot opened report PR #1178, where test and canary both ran and passed; it merged as the next commit on main, and the baseline is now v2.1.283. Two setup fixes along the way: the App needed installing on the org (the first run returned a 404 from the installation lookup), and the needs-triage and priority:high labels were missing (the partial issue #1170 was closed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplannedupstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions