Skip to content
This repository was archived by the owner on Nov 20, 2026. It is now read-only.

[AI] ci(autofix): replace autofix.ci app with native fix-or-fail gate (CHE-835) [squash] - #137

Open
congvc-bot-x99[bot] wants to merge 3 commits into
masterfrom
author/CHE-835/native-autofix-19cf248c
Open

congvc-bot-x99[bot] wants to merge 3 commits into
masterfrom
author/CHE-835/native-autofix-19cf248c

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🤖 Status: Ready — CHE-3439, 2026-11-04 ICT. Independent OpenAI review PASS at 60708217ded11df8e8aebe6caa6fd87c47816536 against ab8810f030144bf8043491077e73b5725b8c13f1: signed verdict. Current checks are success or intentionally skipped. The patch artifact omits staged deletions and binary payloads; lint enforcement still fails correctly. No source changes, merge, enqueue, settings or deploy action.

Refs CHE-835

Description

Related issue(s)

Testing

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I have read every line of this diff and can explain what each change does and why it is needed

🤖 Agent notes (CHE-835; outside the template, which is left unmodified per .github/agents/pr-and-commit-rules.md)

Tool disclosure: written by Claude (Opus) as an AI author. Independent cross-lab PASS is recorded below; human review and merge remain separate.

What

autofix.ci (job autofix) used autofix-ci/action, which needs the autofix.ci GitHub App. It is not installed on this fork, so the job fails on every PR (500 autofix.ci app is not installed for this repository, e.g. run 37377321992 / job 111989751767 on #135). Installing the app is not approved, so this replaces it with a native check. Workflow autofix.ci / job autofix keep their names, so the check name does not change.

  • yarn lint:fix (oxfmt . && oxlint --fix --type-aware --quiet) runs; the job FAILS if the tree changed (git status --porcelain non-empty, so untracked files count too).
  • The patch is collected after yarn lint:fix succeeds OR fails (if: !cancelled() && (steps.fix.conclusion == 'success' || steps.fix.conclusion == 'failure')), so a mixed change (fixable formatting + a non-autofixable type-aware error) still yields a patch. Cancellation and setup/checkout failure leave steps.fix.conclusion as cancelled/skipped, so collection and the gate are skipped. The fix step is not continue-on-error: a lint error always fails the job.
  • A final gate step exits 1 on an unfixable lint error (Unfixable lint error message), on a dirty tree (Format/lint fixes needed), or both. The patch (git diff with --intent-to-add) uploads as artifact autofix-patch when present (actions/upload-artifact pinned to the SHA used in other workflows).
  • permissions: contents: read unchanged; no write token, no commit to PRs, persist-credentials: false kept. Nothing auto-commits any more.
  • yarn generate:news-feed is not run in this gate. It reads the committed packages/docs/blog files (no network, no drift from outside the repo); it stays in the path-filtered news-feed-check.yml, which validates news.json but does NOT regenerate-and-commit it: authors run yarn generate:news-feed and commit the result. Comments/error text in autofix.yml, news-feed-check.yml and the generator's intro comment were corrected (text only; validation behaviour unchanged).
  • check.yml is untouched: job lint (yarn lint = oxfmt --check . && oxlint --type-aware --quiet) still enforces format and type-aware lint.
  • Files changed: .github/workflows/autofix.yml; comments/message text only in .github/workflows/news-feed-check.yml and packages/ci-actions/bin/generate-news-feed.ts. No release-notes file added (CI-only change). packages/ci-actions/bin/release-notes-generate.mjs has a similar stale autofix.ci comment; left untouched (out of this correction's scope).

Validation, correction round 2 (local, committed tree 060f14820, tree 909715a49; step shell run in sequence modelling GitHub scheduling)

Control Result
Clean tree fix 0, no patch, gate 0
Misformatted tracked file yarn lint 1; fix 0; 624-byte patch, git apply --check PASS; gate 1
Untracked file with a space in its name fix 0; 226-byte patch contains it; apply PASS; gate 1
Mixed: fixable formatting + typescript/no-floating-promises (committed scratch file) yarn lint 1; fix 1; patch STILL produced (329 bytes, apply PASS); gate 1 with Unfixable lint error + Format/lint fixes needed
Type-aware error only (committed) yarn lint 1; fix 1; no patch; gate 1 Unfixable lint error
Cancelled / setup failed steps.fix.conclusion is cancelled/skipped: collect, upload and gate skipped (by construction, no CI run)
News validation (same commands as news-feed-check.yml) exit 0 before and after the text edit; generator non-comment code identical; run with network available (isolation was not permitted)
check.yml, package.json git diff origin/master empty
js-yaml parse; oxfmt --check on changed files OK; actionlint / zizmor NOT-RUN (not installed; run in CI)

Validation, round 1 (local, committed tree 7d9488aa4, tree 6fb70fc93, base master ab8810f03)

Check Result
yarn lint on clean master base (inherited glossary repair is on master) PASS, exit 0
yarn lint:fix + the gate script on clean tree PASS, exit 0, tree clean
Negative control: misformatted tracked file yarn lint exit 1; yarn lint:fix + gate exit 1; 398-byte patch; patch applies cleanly (git apply --check)
Negative control: misformatted untracked file gate exit 1; 281-byte patch with new file
Restore after controls git status empty
YAML parse (js-yaml, all workflows) OK; SHA pins and persist-credentials: false match check.yml
actionlint / zizmor NOT-RUN locally (not installed; no installs allowed); check-gh-actions / zizmor run in CI

Locally run with node 22.23.1, yarn 4.17.1, oxfmt 0.59.0, oxlint 1.74.0 (CI uses node 24). Logs: X99 .../workdir/evidence/native-autofix/.

Limits

  • The autofix.ci app is still not installed; this check does not auto-commit fixes (a human/agent applies the patch or runs yarn lint:fix).
  • The workflow runs on pull_request only and stays PR-only after merge: there is no autofix check-run on master, and none is needed for the context to exist (see the required-status plan).
  • This PR does not change settings, branch protection, rulesets, or any other workflow/PR/branch.

Required-status configuration plan (read-only discovery; nothing applied)

Observed 2026-10-06 with the X99 GitHub App token (congvc-bot-x99[bot]):

  • GET repos/cheese-work/actual/branches/master/protection -> 403 {"message":"Resource not accessible by integration","status":"403"}
  • GET repos/cheese-work/actual/rulesets -> 200 []; GET repos/cheese-work/actual/rules/branches/master -> 200 []
  • GET repos/cheese-work/actual/branches/master -> "protected": false, "protection": {"enabled": false, "required_status_checks": {"enforcement_level": "off", "contexts": [], "checks": []}}
  • GET repos/cheese-work/actual -> {"default_branch":"master","permissions":{"admin":false,"maintain":false,"pull":false,"push":false,"triage":false},"private":false,"visibility":"public"}
  • Result: master has NO required status checks and no rulesets in these readbacks. This author app token (403 Resource not accessible by integration, permissions.admin=false) cannot read protection settings. A separate reviewer runtime reported admin:true and 404 Branch not protected on the same endpoint: these are different runtimes/credentials, so the 403 is not a universal blocker. Capability is NOT authorization: no settings were changed and none is authorized by this PR.
  • Check-run names on PR [AI] CHE-1197: Cover report browser values, exports and Monte Carlo pots across two clients #135 (gh pr checks): autofix fail, lint fail, plus pass: constraints, knip, test, typecheck, api, cli, crdt, mobile, server, web, validate-cli, build (ubuntu-24.04, ubuntu-latest), Build web bundle, compare, Functional (shard 1/3..3/3), Functional Desktop App, Visual regression (shard 1/3..3/3), Merge VRT Reports, migrations, check-gh-actions, zizmor, Analyze, CodeQL, setup (x2).
  • Check-runs on master ab8810f03 (non-skipped): lint, typecheck, test, constraints, knip, api, cli, crdt, mobile, server, web, validate-cli, build, check-gh-actions, Analyze, promote-master-aliases, setup, comment. No autofix, no Functional/VRT/compare/migrations (PR-only workflows).

(a) Which checks to require on master PRs

  • Phase 1 (required): lint, typecheck, test, constraints, knip, autofix (native, once on master).
  • Add vietnamese-coverage (displayed as Vietnamese coverage / vietnamese-coverage) only after its workflow is on master; confirm the exact context string from a PR's checks list.
  • Phase 2 (optional, after stability review): Functional (shard N/3), Visual regression (shard N/3), check-gh-actions.
  • Do NOT require: compare (needs the base branch build; unsuitable for stacked PR bases), duplicate-named setup, comment, skipped/conditional jobs (migrations is PR-only and conditional).
  • Stacked PRs target non-master bases, so a master-only ruleset does NOT enforce these checks on them.

(b) How to apply (repo admin; not done here). Settings -> Rules -> Rulesets -> New branch ruleset, or the API (PROPOSAL; integration_id 15368 = GitHub Actions):

{
  "name": "master-required-checks",
  "target": "branch",
  "enforcement": "active",
  "conditions": { "ref_name": { "include": ["refs/heads/master"], "exclude": [] } },
  "rules": [
    {
      "type": "required_status_checks",
      "parameters": {
        "strict_required_status_checks_policy": false,
        "do_not_enforce_on_create": false,
        "required_status_checks": [
          { "context": "lint", "integration_id": 15368 },
          { "context": "typecheck", "integration_id": 15368 },
          { "context": "test", "integration_id": 15368 },
          { "context": "constraints", "integration_id": 15368 },
          { "context": "knip", "integration_id": 15368 },
          { "context": "autofix", "integration_id": 15368 }
        ]
      }
    }
  ]
}

gh api -X POST repos/cheese-work/actual/rulesets --input ruleset.json (needs admin). Suggest enforcement: "evaluate" first if the plan allows it, then flip to active. Classic protection alternative: gh api -X PUT repos/cheese-work/actual/branches/master/protection with required_status_checks.checks.

(c) Prerequisites and observed blockers

  1. Authorization: the settings change is a separate post-merge admin action owned by Cheese (not an agent action). The author app token is not admin; another runtime reported admin access, but capability does not authorize a settings write.
  2. Context availability: lint, typecheck, test, constraints, knip and autofix already report on PR heads with GitHub Actions integration id 15368. autofix stays PR-only, so no master-push run is needed or produced; merging this PR only distributes the replacement workflow to future PRs. Requiring contexts BEFORE merge could expose the existing app-based failing autofix on other PRs. A workflow skipped by path filters can leave a required context missing (blocking PRs indefinitely); a job that reports a skipped conclusion is a different case. Before the admin action, recheck exact job names, integration binding, target branch and reporting conditions.
  3. Selectable names come from check history; master has no autofix check-run, so it may need to be typed manually or chosen from a PR run's history.
  4. Name stability: contexts are job names, not workflow-prefixed. Renaming a job breaks the rule.
  5. lint currently fails on [AI] CHE-1197: Cover report browser values, exports and Monte Carlo pots across two clients #135 (stacked base author/CHE-1163/91229474); not investigated here, outside this PR's scope. Check it before making lint required.
  6. Merge itself stays the human gate.

(d) Recovery owners: repo admin (Cheese) for rulesets/branch protection and any autofix.ci app decision; the dev team for workflow/job-name changes and for the Vietnamese coverage workflow reaching master.

(e) Explicitly NOT changed by this PR: repo/org settings, branch protection, rulesets, GitHub Apps (no autofix.ci install), secrets, check.yml/lint job, any other workflow, #134-#136 or any other PR/branch, news feed generation (only removed from this gate), merges, deployments, reruns.

… (CHE-835)

autofix-ci/action needs the autofix.ci GitHub App, which is not installed on this fork, so the job failed on every PR. Run yarn lint:fix natively, fail when it changes the tree, and upload the patch. Drop the network-dependent news feed regeneration from the gate.
@github-actions github-actions Bot added the AI generated PR authored with AI assistance label Oct 6, 2026
congvc-bot[bot] added 2 commits October 6, 2026 07:34
…comments (CHE-835)

R1: collect the autofix patch when the fix step succeeds or fails (not on cancel/setup failure) and keep the job red on an unfixable lint error or dirty tree. R2: news-feed text only; generate:news-feed reads committed blog files and is validated, not committed, by news-feed-check.
@congvc-dev
congvc-dev marked this pull request as ready for review October 6, 2026 01:15
@congvc-dev

Copy link
Copy Markdown
Collaborator

OCR receipt — #137 @ 60708217ded11df8e8aebe6caa6fd87c47816536 (base ab8810f030144bf8043491077e73b5725b8c13f1)

Lane: keyed (ocr review --from <base> --to <head>), ocr v1.12.12, model claude-opus-5-5 via sub2api, 3/3 files reviewed, 0 excluded. Rule file: none in repo (system built-in).

Findings (candidate defects; I checked each against the head source and both reproduce):

  • P0: none
  • P1: none
  • P2 .github/workflows/autofix.yml:48-50 — autofix job has no timeout-minutes and the workflow has no concurrency group; yarn lint:fix can run to the 6h default and superseded pushes keep running. Suggest job timeout + concurrency with cancel-in-progress keyed on PR number.
  • P2 .github/workflows/autofix.yml:66 — git diff > "$PATCH_PATH" omits binary content, so the artifact patch won't git apply for fixer-touched binaries. Suggest git diff --binary.

Instrument output — the reviewer seat must confirm or reject each finding in its verdict. Low recall: a short list is not evidence the change is correct.

@congvc-dev
congvc-dev marked this pull request as draft October 6, 2026 01:45
@congvc-dev
congvc-dev marked this pull request as ready for review October 6, 2026 01:55
@congvc-bot-x99 congvc-bot-x99 Bot changed the title [AI] ci(autofix): replace autofix.ci app with native fix-or-fail gate (CHE-835) [AI] ci(autofix): replace autofix.ci app with native fix-or-fail gate (CHE-835) [squash] Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

AI generated PR authored with AI assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant