diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9bd2596a..49d5369a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,6 +12,10 @@ updates: development-tooling: dependency-type: development patterns: ["*"] + runtime-maintenance: + applies-to: version-updates + dependency-type: production + update-types: [minor, patch] labels: [dependencies, python] commit-message: prefix: deps diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc5d6ab2..b23de81f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: timeout-minutes: 5 outputs: docs_only: ${{ steps.paths.outputs.docs_only }} + skip_macos: ${{ steps.paths.outputs.skip_macos }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -30,17 +31,36 @@ jobs: env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }} + BASE_REF: ${{ github.event.pull_request.base.ref }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }} run: | result=docs_only=false + skip_macos=false trusted_script="$RUNNER_TEMP/docs_only.py" if git show "${BASE}:scripts/docs_only.py" > "$trusted_script"; then if output=$(env -u GITHUB_OUTPUT python "$trusted_script" --base "$BASE" --head "$HEAD"); then case "$output" in - docs_only=true|docs_only=false) result="$output" ;; + docs_only=true|docs_only=false) + result="$output" + if [ -n "$HEAD_REPO" ] && [ "$HEAD_REPO" = "$GITHUB_REPOSITORY" ]; then + if [ "$result" = docs_only=true ]; then + skip_macos=true + elif [ "$BASE_REF" = main ] && [ "$HEAD_REF" = dev ]; then + # Only exit 1 proves a nonempty delta for this direct promotion. + if git --no-replace-objects diff --quiet --no-ext-diff --no-textconv "$BASE" "$HEAD" --; then + : + elif [ "$?" -eq 1 ]; then + skip_macos=true + fi + fi + fi + ;; esac fi fi echo "$result" >> "$GITHUB_OUTPUT" + echo "skip_macos=$skip_macos" >> "$GITHUB_OUTPUT" test-python312: name: >- @@ -82,18 +102,21 @@ jobs: ${{ github.event_name != 'pull_request' && format('manual-test-{0}-py{1}', matrix.os, matrix.python) || github.event.pull_request.draft && 'draft-deferred-test-matrix' || format('test-{0}-py{1}', matrix.os, matrix.python) }} if: ${{ !cancelled() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }} - continue-on-error: ${{ matrix.advisory }} + continue-on-error: ${{ matrix.os == 'macos-latest' }} env: UV_PYTHON: ${{ matrix.python }} strategy: fail-fast: false matrix: - include: - - { os: ubuntu-latest, python: "3.13", coverage: false, advisory: false } - - { os: ubuntu-latest, python: "3.14", coverage: true, advisory: false } - - { os: ubuntu-latest, python: "3.15", coverage: false, advisory: false } - - { os: macos-latest, python: "3.12", coverage: false, advisory: true } - - { os: macos-latest, python: "3.14", coverage: false, advisory: true } + os: >- + ${{ fromJSON(github.event_name == 'pull_request' && needs.classify.result == 'success' && + needs.classify.outputs.skip_macos == 'true' && '["ubuntu-latest"]' || + '["ubuntu-latest","macos-latest"]') }} + python: ["3.12", "3.13", "3.14", "3.15"] + exclude: + - { os: ubuntu-latest, python: "3.12" } + - { os: macos-latest, python: "3.13" } + - { os: macos-latest, python: "3.15" } runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: @@ -104,7 +127,7 @@ jobs: persist-credentials: false - name: Install qualified OCR for native coverage id: native-ocr - if: ${{ needs.classify.outputs.docs_only != 'true' && matrix.coverage }} + if: ${{ needs.classify.outputs.docs_only != 'true' && matrix.os == 'ubuntu-latest' && matrix.python == '3.14' }} env: PR_BASE: ${{ github.event.pull_request.base.sha }} shell: bash @@ -173,10 +196,10 @@ jobs: - if: needs.classify.outputs.docs_only != 'true' run: uv sync --locked --python "${{ matrix.python }}" - name: Test - if: ${{ needs.classify.outputs.docs_only != 'true' && !matrix.coverage }} + if: ${{ needs.classify.outputs.docs_only != 'true' && (matrix.os != 'ubuntu-latest' || matrix.python != '3.14') }} run: uv run --no-sync pytest -q --ignore=tests/test_installed_policy_e2e.py - name: Test with boundary coverage gates - if: ${{ needs.classify.outputs.docs_only != 'true' && matrix.coverage }} + if: ${{ needs.classify.outputs.docs_only != 'true' && matrix.os == 'ubuntu-latest' && matrix.python == '3.14' }} env: OCR_FEDERATION_QUALIFY_BINARY: ${{ steps.native-ocr.outputs.binary }} OCR_GITLINK_QUALIFY_BINARY: ${{ steps.native-ocr.outputs.binary }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cb9f5bb..0be89cd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,6 @@ name: Release on: - pull_request: - types: [closed] - branches: [main] workflow_dispatch: inputs: pull-request-number: @@ -31,39 +28,23 @@ permissions: contents: read concurrency: - group: production-release + # Match authorize.if so skipped dispatches cannot replace a pending release. + group: >- + ${{ + github.event_name == 'workflow_dispatch' && + github.event.repository.private == false && + github.ref == 'refs/heads/main' && + 'production-release' || format('release-ignored-{0}', github.run_id) + }} cancel-in-progress: false jobs: - classify: - name: classify-release-trigger - runs-on: ubuntu-latest - timeout-minutes: 2 - outputs: - release: ${{ steps.classify.outputs.release }} - steps: - - id: classify - env: - EVENT_NAME: ${{ github.event_name }} - PR_MERGED: ${{ github.event.pull_request.merged }} - PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - run: | - release=false - if [ "${EVENT_NAME}" = workflow_dispatch ]; then - release=true - elif [ "${PR_MERGED}" = true ] && [[ "${PR_HEAD_REF}" == release/v* ]]; then - release=true - fi - echo "release=${release}" >> "${GITHUB_OUTPUT}" - authorize: name: authorize-release - needs: classify if: >- + github.event_name == 'workflow_dispatch' && github.event.repository.private == false && - github.ref == 'refs/heads/main' && - (github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && - needs.classify.outputs.release == 'true' + github.ref == 'refs/heads/main' runs-on: ubuntu-latest timeout-minutes: 5 permissions: @@ -83,16 +64,14 @@ jobs: tree: ${{ steps.authorize.outputs.tree }} version: ${{ steps.authorize.outputs.version }} steps: - - name: Load the pinned main history for recovery - if: github.event_name == 'workflow_dispatch' + - name: Load the pinned main history uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.sha }} path: dispatch-main fetch-depth: 0 persist-credentials: false - - name: Verify the historical recovery policy reference before checkout - if: github.event_name == 'workflow_dispatch' + - name: Verify the protected release policy reference before checkout env: GH_TOKEN: ${{ github.token }} PR_NUMBER: ${{ inputs['pull-request-number'] }} @@ -102,6 +81,10 @@ jobs: BASE: ${{ inputs['reviewed-base'] }} shell: bash run: | + if [[ "${GITHUB_REF}" != refs/heads/main ]]; then + echo "release dispatch must run from refs/heads/main" >&2 + exit 1 + fi [[ "${PR_NUMBER}" =~ ^[1-9][0-9]*$ && "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] [[ "${MERGE}" =~ ^[0-9a-f]{40}$ && "${HEAD}" =~ ^[0-9a-f]{40}$ && "${BASE}" =~ ^[0-9a-f]{40}$ ]] [[ "${GITHUB_SHA}" =~ ^[0-9a-f]{40}$ ]] @@ -116,55 +99,46 @@ jobs: curl --fail --silent --show-error --proto '=https' \ --connect-timeout 10 --max-time 30 --max-filesize 1048576 \ --header 'Accept: application/vnd.github+json' \ - --header 'X-GitHub-Api-Version: 2026-03-10' \ + --header "X-GitHub-Api-Version: $1" \ --oauth2-bearer "${GH_TOKEN}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/$1" + "https://api.github.com/repos/${GITHUB_REPOSITORY}/$2" } - read_github_metadata "pulls/${PR_NUMBER}" | + # Pull request responses in 2026-03-10 omit merge_commit_sha. + if ! read_github_metadata 2022-11-28 "pulls/${PR_NUMBER}" | jq -e --arg repo "${GITHUB_REPOSITORY}" --argjson number "${PR_NUMBER}" \ --arg version "${VERSION}" --arg head "${HEAD}" --arg merge "${MERGE}" --arg base "${BASE}" ' .number == $number and .merged == true and .merge_commit_sha == $merge and .base.repo.full_name == $repo and .base.ref == "main" and .base.sha == $base and .head.repo.full_name == $repo and .head.ref == ("release/v" + $version) and .head.sha == $head and .title == ("Release v" + $version) - ' >/dev/null - read_github_metadata "git/commits/${MERGE}" | + ' >/dev/null; then + echo "release pull request does not match the requested identities" >&2 + exit 1 + fi + if ! read_github_metadata 2026-03-10 "git/commits/${MERGE}" | jq -e --arg merge "${MERGE}" --arg base "${BASE}" ' .sha == $merge and (.parents | length) == 1 and .parents[0].sha == $base - ' >/dev/null + ' >/dev/null; then + echo "release merge is not a squash of the requested protected base" >&2 + exit 1 + fi - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Authorization code must come from protected policy that predates the # release PR. Candidate head and merge commits are inspected only as data. - ref: ${{ github.event.pull_request.base.sha || inputs['reviewed-base'] }} + ref: ${{ inputs['reviewed-base'] }} persist-credentials: false - id: authorize env: GH_TOKEN: ${{ github.token }} - EVENT_NAME: ${{ github.event_name }} - EVENT_PR_NUMBER: ${{ github.event.pull_request.number }} - EVENT_BASE_SHA: ${{ github.event.pull_request.base.sha }} - INPUT_PR_NUMBER: ${{ inputs['pull-request-number'] }} - INPUT_VERSION: ${{ inputs.version }} - INPUT_COMMIT: ${{ inputs['merge-commit'] }} - INPUT_HEAD: ${{ inputs['reviewed-head'] }} - INPUT_BASE: ${{ inputs['reviewed-base'] }} + PR_NUMBER: ${{ inputs['pull-request-number'] }} + REQUESTED_VERSION: ${{ inputs.version }} + REQUESTED_COMMIT: ${{ inputs['merge-commit'] }} + REQUESTED_HEAD: ${{ inputs['reviewed-head'] }} + REQUESTED_BASE: ${{ inputs['reviewed-base'] }} REPOSITORY: ${{ github.repository }} run: | - if [ "${EVENT_NAME}" = workflow_dispatch ]; then - PR_NUMBER=${INPUT_PR_NUMBER} - REQUESTED_VERSION=${INPUT_VERSION} - REQUESTED_COMMIT=${INPUT_COMMIT} - REQUESTED_HEAD=${INPUT_HEAD} - REQUESTED_BASE=${INPUT_BASE} - else - PR_NUMBER=${EVENT_PR_NUMBER} - REQUESTED_VERSION= - REQUESTED_COMMIT= - REQUESTED_HEAD= - REQUESTED_BASE=${EVENT_BASE_SHA} - fi - test "$(scripts/bounded_github_api.sh \ + test "$(GITHUB_API_VERSION=2022-11-28 scripts/bounded_github_api.sh \ "repos/${REPOSITORY}/pulls/${PR_NUMBER}" /tmp/release-pr.json)" = 200 HEAD_SHA=$(jq -r .head.sha /tmp/release-pr.json) MERGE_SHA=$(jq -r .merge_commit_sha /tmp/release-pr.json) @@ -340,6 +314,21 @@ jobs: encoding="utf-8", ) PY + - name: Verify original source attestations before publication + if: github.sha != needs.authorize.outputs.commit + env: + GH_TOKEN: ${{ github.token }} + EXPECTED_COMMIT: ${{ needs.authorize.outputs.commit }} + shell: bash + run: | + for artifact in dist/* runtime-requirements.txt; do + gh attestation verify "${artifact}" \ + --repo "${GITHUB_REPOSITORY}" \ + --signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/release.yml" \ + --source-digest "${EXPECTED_COMMIT}" \ + --source-ref refs/heads/main \ + --deny-self-hosted-runners + done - name: Load protected v0.11.1 PyPI recovery policy if: github.event_name == 'workflow_dispatch' && inputs.version == '0.11.1' uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -408,6 +397,7 @@ jobs: classify testpypi https://test.pypi.org/simple/open-code-review-toolkit/ /tmp/testpypi-index.json classify pypi https://pypi.org/simple/open-code-review-toolkit/ /tmp/pypi-index.json - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 + if: github.sha == needs.authorize.outputs.commit with: subject-path: | dist/* @@ -426,7 +416,7 @@ jobs: publish-testpypi: name: publish-testpypi needs: build - if: needs.build.outputs.testpypi-state == 'publish' + if: github.ref == 'refs/heads/main' && needs.build.outputs.testpypi-state == 'publish' runs-on: ubuntu-latest timeout-minutes: 10 environment: testpypi-public-disclosure @@ -479,7 +469,7 @@ jobs: publish-pypi: name: publish-pypi needs: [build, verify-testpypi] - if: needs.build.outputs.pypi-state == 'publish' + if: github.ref == 'refs/heads/main' && needs.build.outputs.pypi-state == 'publish' runs-on: ubuntu-latest timeout-minutes: 10 environment: pypi-production @@ -557,7 +547,7 @@ jobs: needs: [authorize, build, verify-pypi] if: >- always() && needs.authorize.result == 'success' && needs.build.result == 'success' && - needs.verify-pypi.result == 'success' + needs.verify-pypi.result == 'success' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest timeout-minutes: 10 permissions: @@ -704,11 +694,6 @@ jobs: --hashes artifact-hashes.json \ --runtime-requirements runtime-requirements.txt \ --validate-existing release-receipt.json - if [[ "${GITHUB_EVENT_NAME}" == pull_request ]] && - ! jq -e --argjson run "${GITHUB_RUN_ID}" '.workflow.run_id == $run' release-receipt.json >/dev/null; then - echo "This receipt was created by another run. Use the main-branch release recovery dispatch." >&2 - exit 1 - fi ;; *) echo "duplicate GitHub Release receipt asset" >&2; exit 1 ;; esac diff --git a/.github/workflows/site-release-notify.yml b/.github/workflows/site-release-notify.yml index 4c23003c..cf591f51 100644 --- a/.github/workflows/site-release-notify.yml +++ b/.github/workflows/site-release-notify.yml @@ -3,6 +3,7 @@ name: Notify toolkit site of stable release on: workflow_run: workflows: [Release] + branches: [main] types: [completed] permissions: {} @@ -20,8 +21,7 @@ jobs: github.event.workflow_run.repository.full_name == github.repository && github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.conclusion == 'success' && - ((github.event.workflow_run.event == 'pull_request' && startsWith(github.event.workflow_run.head_branch, 'release/v')) || - (github.event.workflow_run.event == 'workflow_dispatch' && github.event.workflow_run.head_branch == 'main')) + github.event.workflow_run.event == 'workflow_dispatch' && github.event.workflow_run.head_branch == 'main' runs-on: ubuntu-latest timeout-minutes: 5 permissions: @@ -104,11 +104,8 @@ jobs: exit 1 } read -r _ _ _ expected_tag expected_digest receipt_mode <<< "${marker}" - case "${SOURCE_EVENT}" in - pull_request) test "${SOURCE_HEAD_BRANCH}" = "release/${expected_tag}" ;; - workflow_dispatch) test "${SOURCE_HEAD_BRANCH}" = main ;; - *) exit 1 ;; - esac + test "${SOURCE_EVENT}" = workflow_dispatch + test "${SOURCE_HEAD_BRANCH}" = main gh api -H 'X-GitHub-Api-Version: 2026-03-10' "repos/${GITHUB_REPOSITORY}/releases/latest" \ > "${RUNNER_TEMP}/latest-release.json" @@ -137,21 +134,17 @@ jobs: exit 1 fi jq -e --arg tag "${expected_tag}" --arg mode "${receipt_mode}" \ - --arg event "${SOURCE_EVENT}" --arg head "${SOURCE_HEAD_SHA}" \ --argjson id "${SOURCE_RUN_ID}" --argjson attempt "${SOURCE_RUN_ATTEMPT}" ' def positive_integer: type == "number" and . == floor and . > 0; .schema_version == "ocr-toolkit.release-receipt/v2" and .tag == $tag and .version == ($tag | ltrimstr("v")) and (.reviewed.merge | type == "string" and test("^[0-9a-f]{40}$")) and .github.annotated_tag_target == .reviewed.merge and - ($event != "pull_request" or .reviewed.head == $head) and (.workflow.run_id | positive_integer) and (.workflow.run_attempt | positive_integer) and (if $mode == "created" then .workflow.run_id == $id and .workflow.run_attempt == $attempt - elif .workflow.run_id == $id then - .workflow.run_attempt <= $attempt else - $event == "workflow_dispatch" + .workflow.run_id != $id or .workflow.run_attempt <= $attempt end) ' "${RUNNER_TEMP}/release-receipt.json" >/dev/null diff --git a/.release-metadata.json b/.release-metadata.json index 0325b8be..94a305f3 100644 --- a/.release-metadata.json +++ b/.release-metadata.json @@ -1,15 +1,12 @@ { "schema_version": "ocr-toolkit.release-authorization/v1", - "version": "0.16.0", + "version": "0.16.1", "issues": [ - 335, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343 + 351, + 352, + 353, + 355, + 356, + 358 ] } diff --git a/.release-source-date-epoch b/.release-source-date-epoch index 2cc47dce..a8da39b4 100644 --- a/.release-source-date-epoch +++ b/.release-source-date-epoch @@ -1 +1 @@ -1796068357 +1796159248 diff --git a/.release-version b/.release-version index 04a373ef..2a0970ca 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -0.16.0 +0.16.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d6649a..1805a286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ +## 0.16.1 - 2026-12-01 + +### 🚀 Features + +- `ocr-ci review --local --incremental` now shows how many groups qualified for reuse and counts why other groups need fresh review in the terminal and local report. ([#352](https://github.com/xeonvs/open-code-review-toolkit/issues/352)) +- After independent Markdown or JSON edits, `ocr-ci review --local --incremental` can reuse unchanged groups. It verifies source reads and repeats supported searches, diff reads and built-in evidence queries before reusing a group. ([#353](https://github.com/xeonvs/open-code-review-toolkit/issues/353)) + +### 🐛 Bug Fixes + +- Accept `GIT_EDITOR` and `GIT_SEQUENCE_EDITOR` in incremental local review qualification, and name any rejected Git setting in the fallback message. ([#351](https://github.com/xeonvs/open-code-review-toolkit/issues/351)) +- Keep mixed GitLab and local reviews running when OCR reports tracked paths excluded by `.gitignore` alongside a changed submodule pointer. Only eligible files count as completed review work, and the repository summary still reports partial coverage. ([#355](https://github.com/xeonvs/open-code-review-toolkit/issues/355)) +- Publication DLP keeps findings that quote supported ISO date ranges, dated local Markdown anchors and power-of-two size assignments. Phone numbers and sensitive material elsewhere in the finding still prevent publication. ([#358](https://github.com/xeonvs/open-code-review-toolkit/issues/358)) + +### 🛠 Maintenance + +- Update the locked Hypothesis, Ruff, regex stubs, certifi, regex, httpx2, and httpcore2 versions from the reviewed Dependabot updates in PRs #346–349. ([#346](https://github.com/xeonvs/open-code-review-toolkit/issues/346)) +- Recommend checksum-verified Open Code Review 1.14.6 for local and GitLab reviews. ([#355](https://github.com/xeonvs/open-code-review-toolkit/issues/355)) +- Separate draft and ready pull-request checks and prepare protected `dev` intake, with reduced fork CI storage and release notification bound to the verified publication attempt. ([#356](https://github.com/xeonvs/open-code-review-toolkit/issues/356)) + +### Security + +- Update the pinned GitHub Actions, including Scorecard's upstream security fixes. Require SHA-256 verification of the uv release archive in CI and use uv 0.13.10 for CI and the local dependency audit. [GHSA-vjvj-3m3f-fgmm](https://github.com/astral-sh/uv/security/advisories/GHSA-vjvj-3m3f-fgmm) ([#350](https://github.com/xeonvs/open-code-review-toolkit/issues/350)) +- Pin the GitLab example’s official Python 3.12 slim image to a reviewed Docker Hub manifest digest. The example requires a `linux/amd64` runner for its OCR binary. + + - Require fresh, verified coverage before GitLab auto-approval and preserve earlier findings during incomplete reviews. Check external tool data before model delivery and review text before publication. + - **Migration for federated installations** — For each tool in `OCR_MCP_SERVERS_JSON`, review and supply an operator-authored `description` and closed `input_schema`, then change the registry’s `version` from 2 to 3. Identity-only installations need no external registry. + + ([#356](https://github.com/xeonvs/open-code-review-toolkit/issues/356)) + +### Contributors + +- Thanks to @ahmedpdf445-stack for [fixing incremental local review when Git editor settings are present](https://github.com/xeonvs/open-code-review-toolkit/pull/354). ([#354](https://github.com/xeonvs/open-code-review-toolkit/issues/354)) + + ## 0.16.0 - 2026-11-30 ### 🚀 Features diff --git a/PLANS.md b/PLANS.md index fb6894ac..ecc5b3e7 100644 --- a/PLANS.md +++ b/PLANS.md @@ -1,162 +1,8 @@ # Execution Plans -## Active Plan: Toolkit 0.16.1 — contributor intake and incremental review - -plan_schema_version: 2 -Status: active -Release classification: release-required -Target release: 0.16.1 -Next development marker: 0.17.0 -Last Updated: 2026-12-01 - -### Goal - -Deliver the full selected patch release through protected external intake on `dev`, maintainer promotion to `main`, and the existing signed release and receipt process. - -### Plan Origin - -direct_execution - -### Requested Scope - -Review the new contributor's entire repository history, fix incremental qualification and extend safe reuse, integrate the pending dependency and OCR updates, harden contributor CI, update contribution rules for agent-assisted submissions and credit accepted work in the release. - -### Requirement Traceability - -| Requirement | Outcome | Queue | Status | -| --- | --- | --- | --- | -| REQ-001 | Inspect external submissions and observed GitHub disclosure surfaces | WQ-01 | done | -| REQ-002 | Protect dev intake and isolate privileged publication | WQ-02 | in_progress | -| REQ-003 | Qualify #351/#354 and implement #352–353 | WQ-03 | done | -| REQ-004 | Review #346–350 and qualify #355 | WQ-04 | done | -| REQ-005 | Document contribution rules and conditional release credit | WQ-02, WQ-05 | done | -| REQ-006 | Deliver and reconcile 0.16.1 | WQ-06, WQ-08 | pending | -| REQ-007 | Retain proven technical literals during publication and increase default test coverage (#358) | WQ-07 | complete | - -### Explicit Non-Goals - -Prepare protected dev intake and retarget both existing PRs before merge or publication. Keep the contributor’s #354 changes and attribution in the original PR. - -### Constraints - -Inspect fork revisions as data locally. Keep private evidence, credentials, operator inputs and unredacted logs outside public artifacts. Preserve contributor attribution and the stable release authorizer. Review real effective permissions after changes. Keep security reports on the private reporting route. - -### Inputs And Sources - -Use the live [contributor PR](https://github.com/xeonvs/open-code-review-toolkit/pull/354), [CI failure](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46632932603/job/142597665154), [qualification issue](https://github.com/xeonvs/open-code-review-toolkit/issues/355), all eleven workflows, GitHub Actions settings, rulesets, environments and the repository's development, local review, compatibility and release guides. - -For AI-assisted intake, the September policy study documents substantial variation in disclosure requirements. The October Linux Foundation survey identifies disclosure and contributor responsibility as common practices. GitHub's July workflow holds illustrate why maintainers inspect proposed execution before approval. Adopt a short disclosure and actual verification evidence, with the same security review for all authors. [Policy study](https://arxiv.org/abs/2609.07542), [Linux Foundation research](https://www.linuxfoundation.org/hubfs/Research%20Reports/Navigating-Open-Source-Software-Development-in-the-Generative-AI-Era.pdf), [GitHub July update](https://github.blog/changelog/2026-07-28-github-actions-holds-potentially-malicious-workflows-for-approval/). - -### User Decisions And Answers - -Prepare the full maintainer-owned implementation on `maintainer/0.16.1-intake`, review successive changes incrementally and open a draft. Use an existing issue when available; the issue owns the synthetic case and the PR links it and reports actual validation. Keep suspected vulnerabilities on the private reporting route. - -The owner selected protected `dev → main`, the full release composition, revised contributor rules and a conditional acknowledgment section. Include all currently open maintenance PRs, independently of the human contributor's work. - -REQ-002/004 include the external contribution supply-chain threat model, Docker Hub consumption, mandatory pre-push freshness review and maintainer/Dependabot ownership. At merge the maintainer checks the author and source branch in GitHub and reviews every dependency-related change, including additions, renames/deletions, lock sources, action references and installers. Exercise an ordinary fork PR, a fork changing a pin, a spoofed bot label/name, genuine Dependabot and maintainer updates. WQ-04 includes qualifying and pinning the official Python manifest used by the GitLab example and verifying the supported Linux image and installed toolkit in that environment. Keep monthly refresh ownership explicit; the configured uv and github-actions ecosystems do not update a GitLab YAML image digest. - -The contributor guide and PR template now request material AI disclosure, human verification, existing-PR checks and source attribution. Keep intake open. If overlapping submissions become a problem here, GitHub supports a per-user limit on simultaneous external PRs without granting write access to bypass it. [GitHub June update](https://github.blog/changelog/2026-06-17-limit-open-pull-requests-for-users-without-write-access/). - -### Completed Baseline State - -Current protected main is c5750fd, the v0.16.0 release merge. GitHub reports that release immutable. Remote dev and the new milestone did not exist at inspection. The contributor authored one repository PR (#354) and zero issues across all states. #351–353 belong to the maintainer, #355 to Actions and #346–350 to Dependabot. - -At b93ec7d the three changed files cover local opt-in qualification, its tests and the bugfix fragment. The change accepts two editor settings, still falls back for other unsupported settings and prints their names to stderr. Values are omitted, but arbitrary inherited names can contain private text or control characters and the output has no count or byte bound. Use a closed vocabulary of useful known names plus a generic bounded fallback. Verify the two editor commands never run during qualification or review; prefer removing the unnecessary editor values from the incremental child environment. The follow-up 4b395cbe changes only the unused test binding. - -### Current Work Queue - -| Item | Work and exit evidence | Requirements | Status | -| --- | --- | --- | --- | -| WQ-01 | Inventory submissions, review immutable diff, logs, token permissions, artifacts, CI triggers and settings. Record limits below. | REQ-001 | done | -| WQ-02 | Target the maintainer bootstrap and external PR at protected dev; promote reviewed dev to main. Restrict both publishing environments to branch main only and verify the external Trusted Publishers. Scope site dispatch credentials to the trusted main workflow/environment. Configure approval for all outside collaborators. Set up native GitHub protections and required Build/CodeQL checks on dev. At merge the maintainer verifies external PRs target dev and main receives repository-owned promotions and release PRs. Account explicitly for maintenance bots and bootstrap. Verify the intended review and retargeting paths before retargeting #354. Synchronize contribution guide and template with rollout. | REQ-002, REQ-005 | in_progress | -| WQ-03 | Retarget and review #354 at the new merge base, retain author credit, replace premature issue closing keywords, address diagnostic bounds. #352 uses closed per-group reason counts with overlapping reasons and no paths/arguments. #353 extends file-level reuse to unchanged non-Python blobs and replays bounded deterministic searches on immutable inputs; qualify only complete equivalent observations including dependencies, result order, truncation and failures. Recheck uncertain groups. | REQ-003 | done | -| WQ-04 | Integrate development tooling #346, certifi #347, regex #348, httpx2 #349 and six action updates #350. Check upstream commit identities, permissions, cache defaults and artifact changes before updating action pins. Reconcile overlapping lock changes and test the combined tree. For #355 inspect upstream gitignore/preview semantics, verify exact assets, Linux and applicable native handoffs and consumer behavior before promotion to OCR 1.14.6. | REQ-004 | done | -| WQ-05 | Add conditional Towncrier Contributors category, maintainer-reviewed public handle and accepted PR link once per contributor. Verify populated and empty releases, canonical changelog section and final comparison link. | REQ-005 | done | -| WQ-06 | After WQ-08 passes on the final development head and the maintainer authorizes release, merge the protected promotion, verify TestPyPI on the resulting push to main, then prepare the signed release/v0.16.1 PR and reconcile published artifacts. | REQ-006 | pending | -| WQ-07 | Qualify publication-only DLP handling for date ranges, dated headings and size assignments, retain phone and credential rejection, and integrate #359 through the twelve protected checks. | REQ-007 | complete | -| WQ-08 | Complete private corrective review, verify native OCR and installed-wheel behavior, run the full quality and secret gates on the final development range, and record review findings and their disposition in the private corrective PR before requesting release authorization. | REQ-006 | in_progress | - -### Locked Decisions - -Keep #354 open against its original fork head. The maintainer posted [two requested adjustments](https://github.com/xeonvs/open-code-review-toolkit/pull/354#issuecomment-7310075633). When protected dev is ready, change the existing PR base, inspect the new merge diff, require fresh checks and review, and squash into dev with attribution. Open a separate repository-owned dev-to-main promotion PR. Use non-closing issue references in its body and squash message. - -Exercise the base-change event in CI. Default pull_request activity types omit edited. Require observed runs bound to the new dev base and head; a rerun of an old main-target event cannot establish this. [GitHub base change behavior](https://docs.github.com/en/pull-requests/how-tos/create-pull-requests/changing-the-base-branch-of-a-pull-request). - -Protect the long-lived dev ref from automatic deletion. Repository merge commits are enabled. Main retains signed linear history, strict checks and squash/rebase restrictions. Create a maintainer sync branch at the current dev tip, merge main into it with a signed commit, and merge its reviewed PR into dev with a merge commit so the latest main becomes its ancestor after a squash promotion and release-marker changes. Test two consecutive promotion cycles and verify that the second contains only its intended tree changes. Keep this configuration decision in the bootstrap review. - -Fork validation uses GitHub-hosted pull_request jobs with SHA-pinned actions, read-only effective tokens, no environment, no publisher secrets or OIDC. Allow classification, tests, lint/types, SAST, dependency review/audit, CodeQL PR analysis and distribution build/install smoke after head review. Read the Gitleaks policy and version selector from the protected base. Keep package build local to the job for external PRs; disable unnecessary fork artifact uploads, including scanner reports, or validate and redact any retained public output. Rebuild reviewed source for publication. Reserve Release, TestPyPI, site dispatch, Scorecard publication, maintenance and qualification writes for trusted triggers. No privileged execution of fork code through pull_request_target or workflow_run. - -### Verification - -Verify a bare dev push starts no publisher. With a dev-to-main promotion open, push a fresh reviewed commit to dev and inspect the resulting PR synchronization jobs for effective permissions and exclusion of publishing OIDC and site credentials. Use a fork PR to verify dev CI and actual runner permission banners, maintainer retargeting of external main-targeted PRs, eligible dev promotion, changed-head reapproval, and dev exclusion from both registry environments. Check release authorization on its existing protected path. Verify the actual current PR target, source repository and revision in GitHub before merge. Verify admin bypass is limited and auditable. Allow the sole maintainer to promote via a reviewed PR without creating an impossible self-approval requirement. Require maintainer review of external changes, especially workflows, runnable build/test scripts, dependencies and CODEOWNERS. - -For #351–353 exercise installed incremental review across successive heads, an editor setting, a disallowed key, bounded diagnostics, changed and unchanged search results, deleted and newly matching files, failed/incomplete calls, changed policy and the issue's 23-file/two-change case. Compare findings with fresh full review. Run focused tests, quality, Gitleaks, dependency audit, aggregate security and own-tool review, installed package smoke and the release contracts named in docs/release.md. Versioned dependency CI and hosted ruleset checks must cover the exact promotion tree. - -### Latest Validation Results - -The maintainer intake work is tracked in [#356](https://github.com/xeonvs/open-code-review-toolkit/issues/356). The external contribution stays in #354. The contribution guide and forms now put reusable synthetic evidence on the issue; the PR records implementation, verification and attribution. Maintainers own the shared release plan and credit accepted work through Towncrier. - -The maintainer branch integrates #346–350, qualifies OCR 1.14.6 with official assets and exercises the installed wheel on Linux amd64 using the pinned GitLab Python image. Empty and populated Towncrier previews verified conditional contributor credit. Publication and the hosted intake transition remain pending. A real self-review of c5750fd..d37c88d completed all 21 selected files and identified documentation corrections. Two incremental attempts on the first commit failed before a model response when using the staged executable. With governed MCP enabled, official OCR 1.14.6 exercised a complete fresh review and recorded the reason, with one completed gateway call and no reused files. - -The managed worktree scan rejected the resolvable maintainer checkout before allocating a scan ID or SARIF. Independent reviewers inspected contributor intake, publisher recovery, site notification, secrets, cache and artifact permissions, and traced incremental playback against OCR 1.14.6. The owner accepted this limitation for the draft only. Review findings on partial observations, native input ordering, narrowed groups, private argument storage and dependency selection are tracked through implementation and regression checks. - -The owner selected native GitHub branch rules and a maintainer decision at merge. Retarget external work after both branches have the intended protections and the publication secrets have been isolated. - -The contributor replied and updated #354 to 26080da. Static review on that revision confirmed both editor keys are removed from the incremental child environment and the diagnostic uses a bounded fixed vocabulary. Keep the existing PR open for protected dev intake and review the retargeted candidate. - -All eleven main-required checks passed on 26080da. The maintainer [acknowledged both corrections](https://github.com/xeonvs/open-code-review-toolkit/pull/354#issuecomment-7311647605) and retained the PR for protected dev intake. - -After updating the installed Darwin OCR to 1.14.6 and granting outbound access, two actual ChatGPT incremental reviews completed in a disposable repository. The first saved one qualified file. After editing that file the second correctly performed fresh review and saved its new baseline. The local development firewall binds its allowance to an executable path and subsequently blocked another session copy. Maintainer self-review on this host uses the installed OCR path. A controlled provider exercised reuse of 21 of 23 files in a separate official-binary test. - -The approved 4b395cbe rerun completed with all 17 checks successful, including quality and both platform matrices. All five revised workflow log archives, the revised unpacked wheel/sdist and the SARIF artifact passed the redacted signature scan. Revised job banners again showed only read permissions. The SARIF contained zero results. These observations supersede the initial approval state below. The maintainer's comment is public; branch protections, remote settings and the PR base are still at their original values. - -At b93ec7d all five workflows ran on pull_request, attempt 2. Attempt 1 lists zero jobs. Six test jobs, build, scanners and dependency review passed. Quality stopped on Ruff RUF059 before mypy. At 4b395cbe Ruff passes on the exact revised test file; all five new workflows initially returned action_required. Local diff whitespace validation passed. A manual static review covered the changed files and supporting environment handoff. The managed diff scan rejected the resolvable worktree before creating a scan ID. Repeat it on the assembled release range before merge. - -All five observed job-log archives showed read-only token permissions, including SecurityEvents read for CodeQL. Redacted Gitleaks scans found no matches in the downloaded logs, SARIF and unpacked wheel/sdist streams. SARIF contained zero results. These observations cover recorded output and known detectors. Runner network traffic and private cache contents were not observed. - -Live metadata showed a public repository, no registered repository runners, default read token, Actions PR approvals disabled, mandatory SHA pinning, verified creators broadly allowed and approval only for first-time contributors. No repository Actions variables or environment secrets/variables were listed. A repository-level site dispatch secret exists. Main caches include setup-uv and Gitleaks; assume fork jobs can read base caches. No #354 merge cache was listed. Inspect cache producers and inputs, disable fork restore/save where unnecessary, and keep private packages, home directories and credentials out of every base cache. Review implicit setup-uv defaults in quality, build and security jobs. [GitHub cache scopes](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching). - -The active main ruleset requires PRs, signatures, strict checks and thread resolution, but zero approving reviews, no mandatory CODEOWNERS and a PR-only admin bypass. Its check list omits the Ubuntu 3.13 matrix job documented as blocking. Align it with intended gates. Only the owner appeared in the collaborator inventory. Both publication environments currently allow all protected branches. The notifier reads trusted metadata and a public receipt without checking out triggering source; strengthen the match between receipt run/attempt and publication, with the documented recovery path covered. Open secret-scanning and Dependabot alerts were zero. Four open Scorecard alerts concern CI tests, SAST, code review and branch protection; reconcile against live configuration after rollout. - -### Risks And Recovery - -Protect dev before admitting any external code. A PR from dev in the same repository has a different trust context from a fork and may reference repository secrets. Restrict sensitive credentials first. Retain the protected-main path for bootstrap and recovery. If dev filters, scope isolation or branch protections fail, keep intake pending, correct trusted policy, and repeat affected checks. Never copy a fork build artifact into a privileged publishing job. Re-read PR heads and settings on resume. - -### Resume Point - -Review the corrective range from its protected development base to the fix head. Before promotion, validate the entire release diff from protected main to the final dev head and record both SHAs. WQ-08 gates release promotion. Keep the validation record with the private corrective PR until coordinated disclosure. - -The maintainer bootstrap merged into protected `dev` in #357. All three environments select only `main`. The site dispatch credential is environment-scoped and the repository Actions secret list is empty. The fork workflow approval policy covers all external contributors. All twelve required checks passed on #354 at `75bedaf` against `ef5f376`. GitHub attributed its verified squash commit `feafbf7` to @ahmedpdf445-stack. - -#359 merged the #358 fix and its regression tests into protected `dev` at -`f65053e`. This is the base of the private corrective PR. Keep the milestone -and release issues open through release verification. Obtain explicit release -authorization after the corrective work lands on `dev`. - -### Plan Fidelity Check - -REQ-001–007 cover the selected inputs, full release scope, public contributor guidance, CI isolation, verification and attribution. Queue items identify owners and acceptance evidence at each boundary. - -### Reconciliation Check - -The hosted settings above describe the observed pre-rollout state. The current intake target is protected `dev`. No release authorization or external delivery has occurred. - -### Closure Gate - -Archive in the protected release PR after promotion, development publication, current required checks, signed release markers, release notes, authorized issues and indexes are reconciled. Preserve pending external facts. - -### Post-Close Delivery - -Verify stable registry artifacts, supported Python installs, provenance, annotated tag, immutable release and receipt readback. Confirm tracked issue and milestone closure only after the release workflow records the receipt. - -### Handoff Notes - -Use bare issue references in promotion and release text. Preserve contributors' public attribution across squash or maintainer revisions. Raw logs and profile investigation are unnecessary in release notes. - -If #354 ships, the proposed Contributors entry is “Thanks to @ahmedpdf445-stack for fixing incremental local review when Git editor settings are present ([#354](https://github.com/xeonvs/open-code-review-toolkit/pull/354)).” Verify the handle, contribution and final merged change when preparing the release. - ## Recently Completed +- [x] 2026-12-01: Completed Toolkit 0.16.1 — contributor intake and incremental review; [full archived plan](docs/engineering/execution_history/plans/2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md). - [x] 2026-11-30: Completed Toolkit 0.16.0 — GitLab telemetry and local review recovery; [full archived plan](docs/engineering/execution_history/plans/2026-11-30-toolkit-0-16-0-gitlab-telemetry-and-local-review-recovery.md). - [x] 2026-11-28: Completed Toolkit 0.15.2 — CI outcome DLP, OCR qualification, Analysis and local telemetry; [full archived plan](docs/engineering/execution_history/plans/2026-11-28-toolkit-0-15-2-ci-outcome-dlp-ocr-qualification-analysis-and-local-telemetry.md). - [x] 2026-11-16: Completed Toolkit 0.15.1 — evidence diagnostics and rejection cleanup; [full archived plan](docs/engineering/execution_history/plans/2026-11-16-toolkit-0-15-1-evidence-diagnostics-and-rejection-cleanup.md). @@ -166,4 +12,3 @@ If #354 ships, the proposed Contributors entry is “Thanks to @ahmedpdf445-stac - [x] 2026-11-06: Completed Internal engineering cycle corrections; [full archived plan](docs/engineering/execution_history/plans/2026-11-06-internal-engineering-cycle-corrections.md). - [x] 2026-11-06: Completed Toolkit 0.14.6 — OCR 1.13.6, DLP precision and efficient delivery; [full archived plan](docs/engineering/execution_history/plans/2026-11-06-toolkit-0-14-6-ocr-1-13-6-dlp-precision-and-efficient-delivery.md). - [x] 2026-11-04: Completed Toolkit 0.14.5 — DLP precision, OCR qualification and maintenance quality; [full archived plan](docs/engineering/execution_history/plans/2026-11-04-toolkit-0-14-5-dlp-precision-ocr-qualification-and-maintenance-quality.md). -- [x] 2026-10-31: Completed Toolkit 0.14.4 systematic DLP corrections and diagram source validation; [full archived plan](docs/engineering/execution_history/plans/2026-10-31-toolkit-0-14-4-systematic-dlp-corrections-and-diagram-source-validation.md). diff --git a/changelog.d/346.maintenance.md b/changelog.d/346.maintenance.md deleted file mode 100644 index 6e108a9e..00000000 --- a/changelog.d/346.maintenance.md +++ /dev/null @@ -1 +0,0 @@ -Update the locked Hypothesis, Ruff, regex stubs, certifi, regex, httpx2, and httpcore2 versions from the reviewed Dependabot updates in PRs #346–349. diff --git a/changelog.d/350.security.md b/changelog.d/350.security.md deleted file mode 100644 index 7fe3d8b3..00000000 --- a/changelog.d/350.security.md +++ /dev/null @@ -1 +0,0 @@ -Update the pinned GitHub Actions, including Scorecard's upstream security fixes. Require SHA-256 verification of the uv release archive in CI and use uv 0.13.10 for CI and the local dependency audit. [GHSA-vjvj-3m3f-fgmm](https://github.com/astral-sh/uv/security/advisories/GHSA-vjvj-3m3f-fgmm) diff --git a/changelog.d/351.bugfix.md b/changelog.d/351.bugfix.md deleted file mode 100644 index 00a2c814..00000000 --- a/changelog.d/351.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -Accept `GIT_EDITOR` and `GIT_SEQUENCE_EDITOR` in incremental local review qualification, and name any rejected Git setting in the fallback message. diff --git a/changelog.d/352.feature.md b/changelog.d/352.feature.md deleted file mode 100644 index a217a06e..00000000 --- a/changelog.d/352.feature.md +++ /dev/null @@ -1 +0,0 @@ -`ocr-ci review --local --incremental` now shows how many groups qualified for reuse and counts why other groups need fresh review in the terminal and local report. diff --git a/changelog.d/353.feature.md b/changelog.d/353.feature.md deleted file mode 100644 index 9f5e02e3..00000000 --- a/changelog.d/353.feature.md +++ /dev/null @@ -1 +0,0 @@ -After independent Markdown or JSON edits, `ocr-ci review --local --incremental` can reuse unchanged groups. It verifies source reads and repeats supported searches, diff reads and built-in evidence queries before reusing a group. diff --git a/changelog.d/354.contributor.md b/changelog.d/354.contributor.md deleted file mode 100644 index 097e8e05..00000000 --- a/changelog.d/354.contributor.md +++ /dev/null @@ -1 +0,0 @@ -Thanks to @ahmedpdf445-stack for fixing incremental local review when Git editor settings are present. diff --git a/changelog.d/355.bugfix.md b/changelog.d/355.bugfix.md deleted file mode 100644 index 92981136..00000000 --- a/changelog.d/355.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -Keep mixed GitLab and local reviews running when OCR reports tracked paths excluded by `.gitignore` alongside a changed submodule pointer. Only eligible files count as completed review work, and the repository summary still reports partial coverage. diff --git a/changelog.d/355.maintenance.md b/changelog.d/355.maintenance.md deleted file mode 100644 index e9718b20..00000000 --- a/changelog.d/355.maintenance.md +++ /dev/null @@ -1 +0,0 @@ -Recommend checksum-verified Open Code Review 1.14.6 for local and GitLab reviews. diff --git a/changelog.d/356.maintenance.md b/changelog.d/356.maintenance.md deleted file mode 100644 index c6a4b07d..00000000 --- a/changelog.d/356.maintenance.md +++ /dev/null @@ -1 +0,0 @@ -Separate draft and ready pull-request checks and prepare protected `dev` intake, with reduced fork CI storage and release notification bound to the verified publication attempt. diff --git a/changelog.d/356.security.md b/changelog.d/356.security.md deleted file mode 100644 index 5ba49e4a..00000000 --- a/changelog.d/356.security.md +++ /dev/null @@ -1,4 +0,0 @@ -Pin the GitLab example’s official Python 3.12 slim image to a reviewed Docker Hub manifest digest. The example requires a `linux/amd64` runner for its OCR binary. - -- Require fresh, verified coverage before GitLab auto-approval and preserve earlier findings during incomplete reviews. Check external tool data before model delivery and review text before publication. -- **Migration for federated installations** — For each tool in `OCR_MCP_SERVERS_JSON`, review and supply an operator-authored `description` and closed `input_schema`, then change the registry’s `version` from 2 to 3. Identity-only installations need no external registry. diff --git a/changelog.d/358.bugfix.md b/changelog.d/358.bugfix.md deleted file mode 100644 index 978cceb9..00000000 --- a/changelog.d/358.bugfix.md +++ /dev/null @@ -1 +0,0 @@ -Publication DLP keeps findings that quote supported ISO date ranges, dated local Markdown anchors and power-of-two size assignments. Phone numbers and sensitive material elsewhere in the finding still prevent publication. diff --git a/changelog.d/364.maintenance.md b/changelog.d/364.maintenance.md new file mode 100644 index 00000000..2e220ac5 --- /dev/null +++ b/changelog.d/364.maintenance.md @@ -0,0 +1 @@ +Start stable publication on protected main and verify historical rebuilds against the original source attestations before registry upload. Group scheduled minor and patch runtime dependency updates on dev. Skip advisory macOS jobs on internal documentation-only PRs and direct dev-to-main promotions. diff --git a/docs/codex/ENGINEERING_WORKFLOW_STATE.yaml b/docs/codex/ENGINEERING_WORKFLOW_STATE.yaml index 5c7c4908..31192278 100644 --- a/docs/codex/ENGINEERING_WORKFLOW_STATE.yaml +++ b/docs/codex/ENGINEERING_WORKFLOW_STATE.yaml @@ -32,7 +32,7 @@ plan_archive_indexes: - docs/engineering/execution_history/README.md - docs/engineering/README.md - docs/README.md -active_plan: PLANS.md +active_plan: null runtime_agent_config_managed: true instruction_contract_version: 3 planning_contract_version: 2 diff --git a/docs/compatibility.md b/docs/compatibility.md index 7770c02b..fce359fb 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -8,17 +8,17 @@ requires its own qualification before installation. ## Upgrading the toolkit and OCR -Upgrade the wheel in the toolkit virtual environment and check its installed version. +Upgrade the wheel in the toolkit virtual environment and check its installed +version. Use the support manifest from that toolkit release to select the +matching OCR binary. ```sh python -m pip install --upgrade --only-binary=:all: open-code-review-toolkit ocr-ci --version ``` -Toolkit 0.16.0 uses OCR 1.14.5. The 1.14.6 instructions below apply to builds containing the 0.16.1 qualification. Match the manifest from the installed toolkit release before changing the binary. - -On Linux amd64, verify the -download in a private directory before installing the executable: +On Linux amd64, verify the download in a private directory before installing +the executable. ```sh ( @@ -32,13 +32,11 @@ download in a private directory before installing the executable: ) ``` -Put `$HOME/.local/bin` on `PATH`. For another platform -use the matching asset and SHA-256 in the same release entry. After installing -the wheel, check `ocr --version` and run `ocr-ci preflight --local` in the -configured local environment or `ocr-ci preflight` in GitLab CI. Preflight -rejects the former 1.13.x binary. The GitLab example verifies both downloads; -use the example from the tag matching the installed toolkit. -[OCR 1.14.6 release assets](https://github.com/alibaba/open-code-review/releases/tag/v1.14.6) +Put `$HOME/.local/bin` on `PATH`. For another platform use the matching asset and +SHA-256 in the same release entry. Check `ocr --version` and run +`ocr-ci preflight --local` in the configured local environment or +`ocr-ci preflight` in GitLab CI. Use the GitLab example from the same toolkit +release tag to verify the downloads in CI. [OCR 1.14.6 release assets](https://github.com/alibaba/open-code-review/releases/tag/v1.14.6) ## Changes in OCR 1.13.11 through 1.14.6 diff --git a/docs/configuration.md b/docs/configuration.md index 22499e4e..95d5b788 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -34,7 +34,7 @@ These are the complete supported toolkit-owned runtime inputs. `Required` is sco | `OCR_LLM_REASONING_EFFORT` | Operator / configure and preflight | No | Unset (no overlay) | Case-insensitive `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`; explicit `none` is sent, not omitted. Nonempty values require an OpenAI protocol. | | `OCR_ANTHROPIC_DISABLE_THINKING` | Operator / `ocr-ci configure` | No | `false` | With the Anthropic protocol, exact `true` adds `thinking.type=disabled`. | | `OCR_REVIEW_LANGUAGE` | Operator / shared language resolver | No | `English` | Allowed language label or BCP-47 tag used for the review. | -| `OCR_ANALYSIS` | Operator / review runner | No | `false` | Requires the new wheel and qualified OCR binary in the [paired upgrade instructions](compatibility.md#upgrading-the-toolkit-and-ocr). The preceding release’s GitLab pipeline ignores this setting. Enable a separate Behavior/Impact investigation on the reviewed range in GitLab or local review. It is private by default. GitLab publication requires the explicit `ocr-ci post --include-analysis` flag. | +| `OCR_ANALYSIS` | Operator / review runner | No | `false` | Enable a separate Behavior/Impact investigation on the reviewed range in GitLab or local review. It is private by default. GitLab publication requires the explicit `ocr-ci post --include-analysis` flag. | | `OCR_ANALYSIS_MAX_TOKENS_BUDGET` | Operator / review runner | No | `0` | Soft token budget for the additional investigation. Supply a non-negative decimal integer up to 9223372036854775807. Zero is unlimited. An explicitly blank value fails validation, including when Analysis is off. The main review has its own budget. | | `OCR_REVIEW_EFFORT` | Operator / `ocr-ci configure` | No | `medium` | Closed OCR quality preset: `low`, `medium`, or `high`; maps to one, two, or three review rounds. | | `OCR_REVIEW_DIAGRAM_MODE` | Operator / review and posting | No | `on` | Unset selects the default. Exact `on`, `off`, `spoiler`, or `local`; blank/unknown fails before acquisition. GitLab requests expanded/collapsed output with `on`/`spoiler`; standalone requests only `local`. See [optional diagrams](diagrams.md). | @@ -245,7 +245,12 @@ guides OCR to read available intent before considering useful allowlisted tools. References in MR text remain untrusted data; they do not authorize tools or cause automatic acquisition. Configured tools may remain unused. -`OCR_MCP_SERVERS_JSON` accepts only the closed version-3 registry. Server and tool names use ASCII letters, digits, underscore or hyphen, begin with a letter, and cannot contain `__`; aliases cannot collide with toolkit tools. Each tool policy requires an operator-authored `description` and closed `input_schema`; the gateway exposes and validates those values instead of the upstream's live description or input schema. Declare a root object and one explicit type per schema node. Every object schema must set `additionalProperties: false`. For arrays, supply an item schema or set `items: false` to allow only an empty array. Argument schemas reject `allOf`, `anyOf`, `oneOf` and `prefixItems`. Use ASCII IDNA A-labels for internationalized hosts in HTTPS endpoints and resource origins. Each tool policy defaults to `assurance: "advisory"`; use explicit `review_read` only after the operator has established that the declared fields and data classes are a bounded read whose successful use may remain approval-eligible. This assurance is operator policy, not a server annotation. Registry v2 is rejected rather than reinterpreted; migrate each selected tool by reviewing and adding its operator-owned interface fields, then set `version` to `3`. +`OCR_MCP_SERVERS_JSON` accepts only the closed version-3 registry. Server and tool names use ASCII letters, digits, underscore or hyphen, begin with a letter, and cannot contain `__`; aliases cannot collide with toolkit tools. Each tool policy requires an operator-authored `description` and closed `input_schema`; the gateway exposes and validates those values instead of the upstream's live description or input schema. Declare a root object and one explicit type per schema node. Every object schema must set `additionalProperties: false`. For arrays, supply an item schema or set `items: false` to allow only an empty array. Argument schemas reject `allOf`, `anyOf`, `oneOf` and `prefixItems`. Use ASCII IDNA A-labels for internationalized hosts in HTTPS endpoints and resource origins. Each tool policy defaults to `assurance: "advisory"`; use explicit `review_read` only after the operator has established that the declared fields and data classes are a bounded read whose successful use may remain approval-eligible. This assurance is operator policy, not a server annotation. + +To migrate a v2 registry, add those two fields to each allowlisted tool, set +`version` to `3`, and roll out the registry with the new toolkit and qualified +OCR binary. A v2 registry is rejected before review. Identity-only GitLab +deployments without external MCP tools can leave `OCR_MCP_SERVERS_JSON` unset. A GitLab-MR external server therefore looks like: diff --git a/docs/contributor-intake.md b/docs/contributor-intake.md index 7bc0490a..4930014c 100644 --- a/docs/contributor-intake.md +++ b/docs/contributor-intake.md @@ -12,4 +12,16 @@ 2. Review the full diff at those revisions before approving fork CI. Check workflow and executable changes, dependency and lockfile sources, installation and container inputs, Action pins and OCR qualification integrity values. Review additions and removals and both paths of renames and copies. Confirm a human updater's maintainer role in GitHub's repository access settings. For Dependabot updates to `dev`, verify the configured bot account, repository-owned branch and GitHub-verified commits through the reviewed head. Treat labels and branch names as context. Have a maintainer prepare dependency changes requested by an outside contributor. [Dependency audit and upstream review](development.md#dependency-audit-before-push) 3. Mark the PR ready and verify the full applicable protected CI ran and passed for the live base and head. Repeat review and checks when either revision changes. The maintainer verifies the author, source, target and revisions immediately before manual merge. Require an independent approval and dismiss stale approvals when there are two eligible maintainers. With a sole maintainer, record the exact revision reviewed and retain protected PR checks for maintainer-authored work. Squash eligible fork changes into `dev` with contributor attribution. For a CLI squash merge, supply the reviewed head with `gh pr merge "$PR_NUMBER" --squash --match-head-commit "$REVIEWED_HEAD"`. Whenever current main is no longer an ancestor of dev, including after a squash promotion or stable release, create a maintainer sync branch at the current `dev` tip, merge current `main` into it with a signed merge, and open a PR back to `dev`. Use a merge commit to preserve ancestry. Check that the current `main` tip is an ancestor of `dev` before the next promotion. [GitHub CLI merge options](https://cli.github.com/manual/gh_pr_merge) -Dependabot's `target-branch: dev` applies to scheduled version updates. GitHub opens security update PRs against the default branch. Retarget those to `dev` for review or prepare the fix there on a maintainer branch. [Dependabot target-branch behavior](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#target-branch) +Dependabot groups scheduled runtime minor and patch updates into one PR to `dev`. Review the lockfile changes for each package. GitHub opens security update PRs against the default branch. Retarget those to `dev` for review or prepare the fix there on a maintainer branch. [Dependabot target-branch behavior](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#target-branch) + +### Reconcile superseded Dependabot PRs before promotion + +Before merging a protected development promotion, list open Dependabot PRs targeting its base. This covers older version-update PRs that still target `main`. + +```sh +gh pr list --state open --base main --author app/dependabot --json number,title,headRefName,headRefOid +``` + +For a scheduled version update already incorporated in the reviewed promotion, compare the complete proposed dependency and lockfile or Action-pin diff, including transitive changes. If every change is accounted for, record the promotion PR and close the superseded bot PR before moving the base. Keep outstanding changes and security updates open until the target contains their fix. + +Check for queued or in-progress PR runs on the bot branch after closure. A queued event can create a run after the PR closes. Before cancelling an individual run, re-read the PR state and verify its closed, unmerged head, source repository and branch against the run. Limit cancellation to superseded pull-request validation runs in the same repository and confirm no open PR still uses that branch and revision. Use the run ID for cancellation and read back its terminal state. Ordinary dependency PRs continue through the usual required checks. diff --git a/docs/development.md b/docs/development.md index 96e33f7a..db082db4 100644 --- a/docs/development.md +++ b/docs/development.md @@ -30,16 +30,22 @@ A high combined result cannot hide a weak group. Individual DLP/audit, source syntax, shared credential material/completion, diagram-source metadata and orientation owners have 90% floors in the local and hosted coverage gates. Structural evidence sizing, bounded store serialization and optional target admission each have an independent 90% floor. -Ready hosted pull requests run source and contract -tests on all six supported OS/Python combinations. The expensive +Ready product pull requests and manual CI runs cover all six supported +OS/Python combinations. The expensive clean-install wheel/sdist behavioral test runs once in the required Ubuntu/Python 3.12 job; the separate required build job smoke-tests both distribution paths. -The five matrix jobs start alongside Python 3.12 rather than waiting for it. -Each of the four Linux jobs can fail the CI workflow, with Ubuntu on Python -3.14 as the sole coverage owner. Effective branch rules determine which -individual checks GitHub requires before merge. The two macOS endpoint jobs are best-effort compatibility -diagnostics: they remain visible for follow-up, but a platform-only failure does -not block a Linux-priority release. Bandit scans only the supported runtime package +The matrix starts alongside Ubuntu/Python 3.12. All four Linux check identities +remain available to the branch rules, with Ubuntu/Python 3.14 as the sole +coverage owner. CI omits the two advisory macOS jobs for positively classified +same-repository documentation-only pull requests and direct promotions from +`dev` to `main`. Direct promotions still run the Linux tests and coverage. +Manual runs, release-preparation pull requests, fork pull requests and uncertain +classifications retain the full matrix. Once required checks pass for the verified head and base, +an advisory job waiting for a runner can finish independently. Use a manual CI +run to check macOS on a deferred change. +Inspect any reported product regression before promotion. Report runner capacity +separately from test failures and retry only the affected job when appropriate. +Bandit scans only the supported runtime package at medium-or-higher severity and confidence; tests and synthetic fixtures are outside that bounded gate. diff --git a/docs/engineering/execution_history/README.md b/docs/engineering/execution_history/README.md index a4ecc31b..ec5cc080 100644 --- a/docs/engineering/execution_history/README.md +++ b/docs/engineering/execution_history/README.md @@ -14,6 +14,7 @@ | Stable tag | Primary archived plan | Related context in the same archive | | --- | --- | --- | +| `v0.16.1` | [Contributor intake and incremental review](plans/2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md) | #351–353, #355–356 and #358. Protected promotion #361 and TestPyPI development build `0.17.0.dev154` passed. This prepublication snapshot records the handoff for stable publication, immutable receipt verification and issue reconciliation. | | `v0.16.0` | [GitLab telemetry and local review recovery](plans/2026-11-30-toolkit-0-16-0-gitlab-telemetry-and-local-review-recovery.md) | #335–343. Feature #344 and the TestPyPI development build passed. This prepublication snapshot records the handoff for stable publication, immutable receipt verification and issue reconciliation. | | `v0.15.2` | [CI outcome DLP, OCR qualification, Analysis and local telemetry](plans/2026-11-28-toolkit-0-15-2-ci-outcome-dlp-ocr-qualification-analysis-and-local-telemetry.md) | #324–330, #332 and #333. Includes the local GitLab telemetry CLI and revision-scoped review history from #331. | | `v0.15.1` | [Evidence diagnostics and rejection cleanup](plans/2026-11-16-toolkit-0-15-1-evidence-diagnostics-and-rejection-cleanup.md) | #321; distinct missing/zero evidence telemetry, closed CI cause/count facts and failure-safe rejection disposal. Protected feature #322 and development TestPyPI verified; stable markers, pins, notes and checked archive/reset prepared. Stable publication, immutable receipt readback and issue/milestone closure remain required Post-Close Delivery; this archive is a prepublication snapshot. | diff --git a/docs/engineering/execution_history/plans/2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md b/docs/engineering/execution_history/plans/2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md new file mode 100644 index 00000000..689b4ecc --- /dev/null +++ b/docs/engineering/execution_history/plans/2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md @@ -0,0 +1,174 @@ +# Execution Plans + +## Active Plan: Toolkit 0.16.1 — contributor intake and incremental review + +plan_schema_version: 2 +Status: done +Release classification: release-required +Target release: 0.16.1 +Next development marker: 0.17.0 +Last Updated: 2026-12-01 + +### Goal + +Deliver the full selected patch release through protected external intake on `dev`, maintainer promotion to `main`, and the existing signed release and receipt process. + +### Plan Origin + +direct_execution + +### Requested Scope + +Review the new contributor's entire repository history, fix incremental qualification and extend safe reuse, integrate the pending dependency and OCR updates, harden contributor CI, update contribution rules for agent-assisted submissions and credit accepted work in the release. + +### Requirement Traceability + +| Requirement | Outcome | Queue | Status | +| --- | --- | --- | --- | +| REQ-001 | Inspect external submissions and observed GitHub disclosure surfaces | WQ-01 | done | +| REQ-002 | Protect dev intake and isolate privileged publication | WQ-02 | done | +| REQ-003 | Qualify #351/#354 and implement #352–353 | WQ-03 | done | +| REQ-004 | Review #346–350 and qualify #355 | WQ-04 | done | +| REQ-005 | Document contribution rules and conditional release credit | WQ-02, WQ-05 | done | +| REQ-006 | Complete the repository handoff for 0.16.1 and identify the required external delivery | WQ-06, WQ-08 | done | +| REQ-007 | Retain proven technical literals during publication and increase default test coverage (#358) | WQ-07 | done | + +### Explicit Non-Goals + +Keep the contributor’s changes and attribution in the original #354. Use issue links for reusable synthetic cases and the private reporting route for suspected vulnerabilities. + +### Constraints + +Inspect fork revisions as data locally. Keep private evidence, credentials, operator inputs and unredacted logs outside public artifacts. Preserve contributor attribution and the stable release authorizer. Review real effective permissions after changes. Keep security reports on the private reporting route. + +### Inputs And Sources + +Use the live [contributor PR](https://github.com/xeonvs/open-code-review-toolkit/pull/354), [CI failure](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46632932603/job/142597665154), [qualification issue](https://github.com/xeonvs/open-code-review-toolkit/issues/355), all eleven workflows, GitHub Actions settings, rulesets, environments and the repository's development, local review, compatibility and release guides. + +For AI-assisted intake, the September policy study documents substantial variation in disclosure requirements. The October Linux Foundation survey identifies disclosure and contributor responsibility as common practices. GitHub's July workflow holds illustrate why maintainers inspect proposed execution before approval. Adopt a short disclosure and actual verification evidence, with the same security review for all authors. [Policy study](https://arxiv.org/abs/2609.07542), [Linux Foundation research](https://www.linuxfoundation.org/hubfs/Research%20Reports/Navigating-Open-Source-Software-Development-in-the-Generative-AI-Era.pdf), [GitHub July update](https://github.blog/changelog/2026-07-28-github-actions-holds-potentially-malicious-workflows-for-approval/). + +### User Decisions And Answers + +Prepare the full maintainer-owned implementation on `maintainer/0.16.1-intake`, review successive changes incrementally and open a draft. Use an existing issue when available; the issue owns the synthetic case and the PR links it and reports actual validation. Keep suspected vulnerabilities on the private reporting route. + +The owner selected protected `dev → main`, the full release composition, revised contributor rules and a conditional acknowledgment section. Include all currently open maintenance PRs, independently of the human contributor's work. + +REQ-002/004 include the external contribution supply-chain threat model, Docker Hub consumption, mandatory pre-push freshness review and maintainer/Dependabot ownership. At merge the maintainer checks the author and source branch in GitHub and reviews every dependency-related change, including additions, renames/deletions, lock sources, action references and installers. Exercise an ordinary fork PR, a fork changing a pin, a spoofed bot label/name, genuine Dependabot and maintainer updates. WQ-04 includes qualifying and pinning the official Python manifest used by the GitLab example and verifying the supported Linux image and installed toolkit in that environment. Keep monthly refresh ownership explicit; the configured uv and github-actions ecosystems do not update a GitLab YAML image digest. + +The contributor guide and PR template now request material AI disclosure, human verification, existing-PR checks and source attribution. Keep intake open. If overlapping submissions become a problem here, GitHub supports a per-user limit on simultaneous external PRs without granting write access to bypass it. [GitHub June update](https://github.blog/changelog/2026-06-17-limit-open-pull-requests-for-users-without-write-access/). + +### Completed Baseline State + +At baseline, protected `main` was `c5750fd`, the v0.16.0 release merge. GitHub reported that release immutable. Remote dev and the new milestone did not exist at inspection. The contributor authored one repository PR (#354) and zero issues across all states. #351–353 belong to the maintainer, #355 to Actions and #346–350 to Dependabot. + +At b93ec7d the three changed files cover local opt-in qualification, its tests and the bugfix fragment. The change accepts two editor settings, still falls back for other unsupported settings and prints their names to stderr. Values are omitted, but arbitrary inherited names can contain private text or control characters and the output has no count or byte bound. Use a closed vocabulary of useful known names plus a generic bounded fallback. Verify the two editor commands never run during qualification or review; prefer removing the unnecessary editor values from the incremental child environment. The follow-up 4b395cbe changes only the unused test binding. + +### Current Work Queue + +| Item | Work and exit evidence | Requirements | Status | +| --- | --- | --- | --- | +| WQ-01 | Inventory submissions, review immutable diff, logs, token permissions, artifacts, CI triggers and settings. Record limits below. | REQ-001 | done | +| WQ-02 | Target the maintainer bootstrap and external PR at protected dev; promote reviewed dev to main. Restrict both publishing environments to branch main only and verify the external Trusted Publishers. Scope site dispatch credentials to the trusted main workflow/environment. Configure approval for all outside collaborators. Set up native GitHub protections and required Build/CodeQL checks on dev. At merge the maintainer verifies external PRs target dev and main receives repository-owned promotions and release PRs. Account explicitly for maintenance bots and bootstrap. Verify the intended review and retargeting paths before retargeting #354. Synchronize contribution guide and template with rollout. | REQ-002, REQ-005 | done | +| WQ-03 | Retarget and review #354 at the new merge base, retain author credit, replace premature issue closing keywords, address diagnostic bounds. #352 uses closed per-group reason counts with overlapping reasons and no paths/arguments. #353 extends file-level reuse to unchanged non-Python blobs and replays bounded deterministic searches on immutable inputs; qualify only complete equivalent observations including dependencies, result order, truncation and failures. Recheck uncertain groups. | REQ-003 | done | +| WQ-04 | Integrate development tooling #346, certifi #347, regex #348, httpx2 #349 and six action updates #350. Check upstream commit identities, permissions, cache defaults and artifact changes before updating action pins. Reconcile overlapping lock changes and test the combined tree. For #355 inspect upstream gitignore/preview semantics, verify exact assets, Linux and applicable native handoffs and consumer behavior before promotion to OCR 1.14.6. | REQ-004 | done | +| WQ-05 | Add conditional Towncrier Contributors category, maintainer-reviewed public handle and accepted PR link once per contributor. Verify populated and empty releases, canonical changelog section and final comparison link. | REQ-005 | done | +| WQ-06 | Merge the reviewed protected promotion after WQ-08, verify the resulting development build on TestPyPI, and prepare the signed release/v0.16.1 pull request and checked archive. Stable publication and external reconciliation are Post-Close Delivery. | REQ-006 | done | +| WQ-07 | Qualify publication-only DLP handling for date ranges, dated headings and size assignments, retain phone and credential rejection, and integrate #359 through the twelve protected checks. | REQ-007 | done | +| WQ-08 | Complete corrective review, verify native OCR and installed-wheel behavior, and run quality and secret gates on the final development range. Preserve the private review evidence through the coordinated disclosure boundary. | REQ-006 | done | + +### Locked Decisions + +The maintainer retained #354 against its original fork head and posted [two requested adjustments](https://github.com/xeonvs/open-code-review-toolkit/pull/354#issuecomment-7310075633). After protected dev was ready, the maintainer retargeted the existing PR, required fresh checks, and retained authorship through the dev squash merge. The repository-owned dev-to-main promotion used non-closing issue references. + +Exercise the base-change event in CI. Default pull_request activity types omit edited. Require observed runs bound to the new dev base and head; a rerun of an old main-target event cannot establish this. [GitHub base change behavior](https://docs.github.com/en/pull-requests/how-tos/create-pull-requests/changing-the-base-branch-of-a-pull-request). + +Protect the long-lived dev ref from automatic deletion. Repository merge commits are enabled. Main retains signed linear history, strict checks and squash/rebase restrictions. Create a maintainer sync branch at the current dev tip, merge main into it with a signed commit, and merge its reviewed PR into dev with a merge commit so the latest main becomes its ancestor after a squash promotion and release-marker changes. Test two consecutive promotion cycles and verify that the second contains only its intended tree changes. Keep this configuration decision in the bootstrap review. + +Fork validation uses GitHub-hosted pull_request jobs with SHA-pinned actions, read-only effective tokens, no environment, no publisher secrets or OIDC. Allow classification, tests, lint/types, SAST, dependency review/audit, CodeQL PR analysis and distribution build/install smoke after head review. Read the Gitleaks policy and version selector from the protected base. Keep package build local to the job for external PRs; disable unnecessary fork artifact uploads, including scanner reports, or validate and redact any retained public output. Rebuild reviewed source for publication. Reserve Release, TestPyPI, site dispatch, Scorecard publication, maintenance and qualification writes for trusted triggers. No privileged execution of fork code through pull_request_target or workflow_run. + +### Verification + +Verify a bare dev push starts no publisher. With a dev-to-main promotion open, push a fresh reviewed commit to dev and inspect the resulting PR synchronization jobs for effective permissions and exclusion of publishing OIDC and site credentials. Use a fork PR to verify dev CI and actual runner permission banners, maintainer retargeting of external main-targeted PRs, eligible dev promotion, changed-head reapproval, and dev exclusion from both registry environments. Check release authorization on its existing protected path. Verify the actual current PR target, source repository and revision in GitHub before merge. Verify admin bypass is limited and auditable. Allow the sole maintainer to promote via a reviewed PR without creating an impossible self-approval requirement. Require maintainer review of external changes, especially workflows, runnable build/test scripts, dependencies and CODEOWNERS. + +For #351–353 exercise installed incremental review across successive heads, an editor setting, a disallowed key, bounded diagnostics, changed and unchanged search results, deleted and newly matching files, failed/incomplete calls, changed policy and the issue's 23-file/two-change case. Compare findings with fresh full review. Run focused tests, quality, Gitleaks, dependency audit, aggregate security and own-tool review, installed package smoke and the release contracts named in docs/release.md. Versioned dependency CI and hosted ruleset checks must cover the exact promotion tree. + +### Latest Validation Results + +The maintainer intake work is tracked in [#356](https://github.com/xeonvs/open-code-review-toolkit/issues/356). The external contribution stays in #354. The contribution guide and forms now put reusable synthetic evidence on the issue; the PR records implementation, verification and attribution. Maintainers own the shared release plan and credit accepted work through Towncrier. + +The maintainer branch integrates #346–350, qualifies OCR 1.14.6 with official assets and exercises the installed wheel on Linux amd64 using the pinned GitLab Python image. Empty and populated Towncrier previews verified conditional contributor credit. This baseline preceded the hosted intake transition and the protected promotion. A real self-review of c5750fd..d37c88d completed all 21 selected files and identified documentation corrections. Two incremental attempts on the first commit failed before a model response when using the staged executable. With governed MCP enabled, official OCR 1.14.6 exercised a complete fresh review and recorded the reason, with one completed gateway call and no reused files. + +The managed worktree scan rejected the resolvable maintainer checkout before allocating a scan ID or SARIF. Independent reviewers inspected contributor intake, publisher recovery, site notification, secrets, cache and artifact permissions, and traced incremental playback against OCR 1.14.6. The owner accepted this limitation for the draft only. Review findings on partial observations, native input ordering, narrowed groups, private argument storage and dependency selection are tracked through implementation and regression checks. + +The owner selected native GitHub branch rules and a maintainer decision at merge. Both branch protections and isolation of publication credentials preceded external intake on `dev`. + +The contributor replied and updated #354 to 26080da. Static review on that revision confirmed both editor keys are removed from the incremental child environment and the diagnostic uses a bounded fixed vocabulary. The existing PR remained open at that stage for protected dev intake. + +All eleven main-required checks passed on 26080da. The maintainer [acknowledged both corrections](https://github.com/xeonvs/open-code-review-toolkit/pull/354#issuecomment-7311647605) and retained the PR for protected dev intake. + +After updating the installed Darwin OCR to 1.14.6 and granting outbound access, two actual ChatGPT incremental reviews completed in a disposable repository. The first saved one qualified file. After editing that file the second correctly performed fresh review and saved its new baseline. The local development firewall binds its allowance to an executable path and subsequently blocked another session copy. Maintainer self-review on this host uses the installed OCR path. A controlled provider exercised reuse of 21 of 23 files in a separate official-binary test. + +The approved 4b395cbe rerun completed with all 17 checks successful, including quality and both platform matrices. All five revised workflow log archives, the revised unpacked wheel/sdist and the SARIF artifact passed the redacted signature scan. Revised job banners again showed only read permissions. The SARIF contained zero results. These observations supersede the initial approval state below. The maintainer's public comment preceded the later protection changes and retargeting. + +At b93ec7d all five workflows ran on pull_request, attempt 2. Attempt 1 lists zero jobs. Six test jobs, build, scanners and dependency review passed. Quality stopped on Ruff RUF059 before mypy. At 4b395cbe Ruff passes on the exact revised test file; all five new workflows initially returned action_required. Local diff whitespace validation passed. A manual static review covered the changed files and supporting environment handoff. The managed diff scan rejected the resolvable worktree before creating a scan ID. This attempt produced no managed scan evidence. + +All five observed job-log archives showed read-only token permissions, including SecurityEvents read for CodeQL. Redacted Gitleaks scans found no matches in the downloaded logs, SARIF and unpacked wheel/sdist streams. SARIF contained zero results. These observations cover recorded output and known detectors. Runner network traffic and private cache contents were not observed. + +Before rollout, live metadata showed a public repository, no registered repository runners, default read token, Actions PR approvals disabled, mandatory SHA pinning, verified creators broadly allowed and approval only for first-time contributors. No repository Actions variables or environment secrets/variables were listed. A repository-level site dispatch secret existed. Main caches include setup-uv and Gitleaks; assume fork jobs can read base caches. No #354 merge cache was listed. Inspect cache producers and inputs, disable fork restore/save where unnecessary, and keep private packages, home directories and credentials out of every base cache. Review implicit setup-uv defaults in quality, build and security jobs. [GitHub cache scopes](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching). + +Before rollout, the main ruleset required PRs, signatures, strict checks and thread resolution, with zero approving reviews, no mandatory CODEOWNERS and a PR-only admin bypass. Its check list omitted the Ubuntu 3.13 matrix job documented as blocking. Only the owner appeared in the collaborator inventory. Both publication environments allowed all protected branches. The notifier reads trusted metadata and a public receipt without checking out triggering source; strengthen the match between receipt run/attempt and publication, with the documented recovery path covered. Open secret-scanning and Dependabot alerts were zero. Four open Scorecard alerts concern CI tests, SAST, code review and branch protection; reconcile against live configuration after rollout. + +On 2026-12-01, the maintainer bootstrap merged into protected `dev` at `ef5f376`. GitHub readback showed a PR gate and required status checks on `dev`. The branch policy for each of the TestPyPI, PyPI and site-notification environments selects only `main`. The site dispatch credential is environment-scoped, the repository Actions secret list is empty, and fork workflows require maintainer approval. [Maintainer bootstrap #357](https://github.com/xeonvs/open-code-review-toolkit/pull/357). + +The retargeted contributor PR passed all twelve required checks at `75bedaf` against `ef5f376`. GitHub attributed verified squash commit `feafbf7` to @ahmedpdf445-stack. The #358 regression fix reached protected `dev` at `f65053e` through #359. [Contributor PR #354](https://github.com/xeonvs/open-code-review-toolkit/pull/354), [DLP correction #359](https://github.com/xeonvs/open-code-review-toolkit/pull/359). + +The corrective PR passed protected checks at `ba80c66` and merged into `dev` as `4e82db1`. Its recorded local gate passed 6,809 tests and 364 subtests, with 11 optional skips and 90.03% coverage. Both distribution formats passed isolated installation and runtime MCP smoke. Gitleaks passed on the patch range and tree, and the locked dependency audit reported no known vulnerabilities. [Corrective PR #360](https://github.com/xeonvs/open-code-review-toolkit/pull/360). + +The test-only OCR follow-up passed protected checks at `d2ce8ee` and merged into `dev` as `65ed3d0`. It verifies rejection when the protected base's OCR 1.14.5 preview omits a tracked ignored file and checks the explicit gitignore exclusion and production manifest with qualified OCR 1.14.6. Its recorded local validation passed all 78 gitlink tests with the qualified OCR executable, plus Ruff, Gitleaks and dependency audit. [Trusted-base OCR checks #362](https://github.com/xeonvs/open-code-review-toolkit/pull/362). + +All seventeen hosted PR checks passed on #360, #362 and #361. Protected promotion #361 used `65ed3d0` and merged as `a2ca5b4` on top of `c5750fd`. The promoted tree matched `65ed3d0` exactly as `d3631431dcecd4f200a7a8355a8e66e94289eae2`. [Promotion PR #361](https://github.com/xeonvs/open-code-review-toolkit/pull/361). + +The TestPyPI development workflow on `a2ca5b4` completed all four jobs, including Trusted Publishing and verification of the exact published wheel and source distribution. TestPyPI readback listed both files for `0.17.0.dev154`. [Development build 154](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46745358005). + +The extracted release notes credit the accepted contributor once under Contributors and end with the v0.16.0 to v0.16.1 comparison. The authorization metadata lists all six open release issues. The candidate uses the protected promotion commit timestamp as its deterministic source epoch and retains the existing next development line. + +### Risks And Recovery + +Protect dev before admitting any external code. A PR from dev in the same repository has a different trust context from a fork and may reference repository secrets. Restrict sensitive credentials first. Retain the protected-main path for bootstrap and recovery. If dev filters, scope isolation or branch protections fail, keep intake pending, correct trusted policy, and repeat affected checks. Never copy a fork build artifact into a privileged publishing job. Re-read PR heads and settings on resume. + +### Resume Point + +No repository implementation remains. This archive records the prepublication handoff. + +### Plan Fidelity Check + +REQ-001 through REQ-007 cover the selected inputs, release preparation, contributor guidance and attribution, CI isolation, incremental qualification, DLP and corrective review. Their queue items and validation evidence identify the relevant boundary and revision. Stable publication and external verification retain an explicit delivery stage. + +### Reconciliation Check + +Protected intake, contributor attribution and the exact dev-to-main promotion agree with the recorded GitHub evidence. The release issue set is #351, #352, #353, #355, #356 and #358. Tracked issues and the milestone remain open for receipt-backed closure. + +### Closure Gate + +The protected promotion and verified TestPyPI development build cover the accepted implementation. The release PR carries the stable and next development markers, reproducible build epoch, tracked issue authorization, generated notes, qualified GitLab example and checked archive. + +### Post-Close Delivery + +Protected release-PR checks and signed squash merge, stable publication and independent external reconciliation are outside the closed repository plan. The Release workflow verifies the stable TestPyPI and PyPI artifacts, supported Python installs, provenance, annotated tag, immutable GitHub Release and receipt before issue closure. The operator reads back exact external delivery, verifies issue and milestone closure, and reconciles protected branches and temporary resources. + +### Handoff Notes + +No in-scope work remains. The contributor attribution is preserved in #354 and the generated changelog. + +## Recently Completed + +- [x] 2026-11-30: Completed Toolkit 0.16.0 — GitLab telemetry and local review recovery; [full archived plan](docs/engineering/execution_history/plans/2026-11-30-toolkit-0-16-0-gitlab-telemetry-and-local-review-recovery.md). +- [x] 2026-11-28: Completed Toolkit 0.15.2 — CI outcome DLP, OCR qualification, Analysis and local telemetry; [full archived plan](docs/engineering/execution_history/plans/2026-11-28-toolkit-0-15-2-ci-outcome-dlp-ocr-qualification-analysis-and-local-telemetry.md). +- [x] 2026-11-16: Completed Toolkit 0.15.1 — evidence diagnostics and rejection cleanup; [full archived plan](docs/engineering/execution_history/plans/2026-11-16-toolkit-0-15-1-evidence-diagnostics-and-rejection-cleanup.md). +- [x] 2026-11-16: Completed Toolkit 0.15.0 — complete evidence, .NET and numeric DLP; [full archived plan](docs/engineering/execution_history/plans/2026-11-16-toolkit-0-15-0-complete-evidence-net-and-numeric-dlp.md). +- [x] 2026-11-12: Completed Toolkit 0.14.8 — OCR 1.13.8, provider HTTP and first integration; [full archived plan](docs/engineering/execution_history/plans/2026-11-12-toolkit-0-14-8-ocr-1-13-8-provider-http-and-first-integration.md). +- [x] 2026-11-10: Completed Toolkit 0.14.7 — OCR 1.13.7, recoverable diagrams and private diagnostics; [full archived plan](docs/engineering/execution_history/plans/2026-11-10-toolkit-0-14-7-ocr-1-13-7-recoverable-diagrams-and-private-diagnostics.md). +- [x] 2026-11-06: Completed Internal engineering cycle corrections; [full archived plan](docs/engineering/execution_history/plans/2026-11-06-internal-engineering-cycle-corrections.md). +- [x] 2026-11-06: Completed Toolkit 0.14.6 — OCR 1.13.6, DLP precision and efficient delivery; [full archived plan](docs/engineering/execution_history/plans/2026-11-06-toolkit-0-14-6-ocr-1-13-6-dlp-precision-and-efficient-delivery.md). +- [x] 2026-11-04: Completed Toolkit 0.14.5 — DLP precision, OCR qualification and maintenance quality; [full archived plan](docs/engineering/execution_history/plans/2026-11-04-toolkit-0-14-5-dlp-precision-ocr-qualification-and-maintenance-quality.md). +- [x] 2026-10-31: Completed Toolkit 0.14.4 systematic DLP corrections and diagram source validation; [full archived plan](docs/engineering/execution_history/plans/2026-10-31-toolkit-0-14-4-systematic-dlp-corrections-and-diagram-source-validation.md). diff --git a/docs/engineering/execution_history/plans/README.md b/docs/engineering/execution_history/plans/README.md index 3c29d3ad..c97bf69f 100644 --- a/docs/engineering/execution_history/plans/README.md +++ b/docs/engineering/execution_history/plans/README.md @@ -20,4 +20,5 @@ Each new repository plan archived through the engineering-workflow lifecycle is - [2026-11-16-toolkit-0-15-1-evidence-diagnostics-and-rejection-cleanup.md](2026-11-16-toolkit-0-15-1-evidence-diagnostics-and-rejection-cleanup.md) - [2026-11-28-toolkit-0-15-2-ci-outcome-dlp-ocr-qualification-analysis-and-local-telemetry.md](2026-11-28-toolkit-0-15-2-ci-outcome-dlp-ocr-qualification-analysis-and-local-telemetry.md) - [2026-11-30-toolkit-0-16-0-gitlab-telemetry-and-local-review-recovery.md](2026-11-30-toolkit-0-16-0-gitlab-telemetry-and-local-review-recovery.md) +- [2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md](2026-12-01-toolkit-0-16-1-contributor-intake-and-incremental-review.md) diff --git a/docs/gitlab.md b/docs/gitlab.md index a4e34101..a93f5a48 100644 --- a/docs/gitlab.md +++ b/docs/gitlab.md @@ -6,7 +6,12 @@ GitLab is the toolkit's first forge provider. The provider layer owns GitLab API Install `open-code-review-toolkit` from PyPI and install Open Code Review separately. Use the exact recommended OCR version and asset checksum from the [compatibility manifest](../compatibility/ocr-support.json); the toolkit package never downloads OCR. -Start with the [complete checksum-pinned pipeline](../examples/gitlab/ocr-review.gitlab-ci.yml), then choose a mode from the same toolkit release tag. The default identity-only mode requires no external registry. If you enable federation, use the registry format and mode file from the tag named by `OCR_TOOLKIT_VERSION` in the linked pipeline. To adopt the operator-authored v3 recipe, take both files from a release tag that ships it. See the [GitLab mode matrix](../examples/gitlab/README.md). The pipeline keeps the repository's lint/test stage ahead of AI review, verifies the release runtime lock and toolkit wheel, installs hash-locked binary dependencies followed by the wheel, checks dependency consistency, runs preflight and configuration, performs one production `ocr-ci review`, and makes `ocr-ci post` the sole GitLab write boundary. The rules pack adds Jinja, conventional Ansible-role templates, and Twig to the recommended OCR file selection; project exclusions still win. +Start with the [complete checksum-pinned pipeline](../examples/gitlab/ocr-review.gitlab-ci.yml), then choose a mode from the same toolkit release tag. The pipeline keeps the repository's lint/test stage ahead of AI review, verifies the release runtime lock and toolkit wheel, installs hash-locked binary dependencies followed by the wheel, checks dependency consistency, runs preflight and configuration, performs one production `ocr-ci review`, and makes `ocr-ci post` the sole GitLab write boundary. The rules pack adds Jinja, conventional Ansible-role templates, and Twig to the recommended OCR file selection; project exclusions still win. + +Use the install and mode files from the tag named by `OCR_TOOLKIT_VERSION`. +The default identity-only mode needs no external registry. If you already use +governed federation, migrate its registry and tool declarations when you update +the pipeline. [Registry v3 migration](configuration.md#governed-mcp-federation-and-trust-boundary) · [GitLab mode matrix](../examples/gitlab/README.md) Use a `linux/amd64` runner with an executor that honors the GitLab `image:` setting, such as the Docker executor. The job starts the official Python image at a pinned Docker Hub manifest digest and installs the Linux amd64 OCR @@ -14,10 +19,6 @@ binary. ## Required configuration -Behavior/Impact Analysis requires the wheel and qualified binary described in -the [paired upgrade instructions](compatibility.md#upgrading-the-toolkit-and-ocr). -Use the example from the matching release tag once published. The preceding -release’s example still pins the older wheel and ignores the Analysis setting. Set `OCR_ANALYSIS=true` on the ordinary review job to investigate the same MR diff alongside the main review. Set `OCR_ANALYSIS_MAX_TOKENS_BUDGET` to cap the investigation separately. By default the result stays in the private job JSON. The example uploads no report artifact. To show the investigation to MR readers, add one flag to the existing post command in that job: diff --git a/docs/release.md b/docs/release.md index a24d4ce7..cbac5fc5 100644 --- a/docs/release.md +++ b/docs/release.md @@ -27,12 +27,12 @@ The delivery sequence is: 2. merge the protected feature pull request to `main`; 3. verify the deterministic `.devN` wheel and sdist on TestPyPI; 4. prepare and merge a protected signed `release/vX.Y.Z` pull request; -5. monitor stable TestPyPI and PyPI publication, annotated tag, provenance, attestations, and immutable GitHub Release; +5. start the Release workflow on protected `main` for the reviewed squash and monitor stable TestPyPI and PyPI publication, annotated tag, provenance, attestations, and immutable GitHub Release; 6. require the release CI jobs to independently compare artifact hashes and smoke-install every supported Python boundary; 7. require CI readback of the immutable `release-receipt.json`, then close the tracked issues and milestone; 8. independently read back the exact external state against the immutable receipt and issue comments, then close the delivery objective without another repository pull request. -The release pull request is the final repository mutation before stable publication. It owns stable and next version markers, deterministic source epoch, tracked authorization metadata, generated Towncrier changelog, release notes, and reconciliation of the plan and status documents. Follow the checked [plan archive and external reconciliation](#external-reconciliation-and-plan-archiving) below. `.release-reconciled-version` is historical evidence for releases that used a post-publication repository closure PR; it does not advance for plans closed in the release PR. Current validation uses the archived plan, stable index and immutable external receipts instead. The release PR must not claim that registry files, provenance, tag, immutable Release, receipt, or installs already exist. The protected-main merge may run the normal TestPyPI development workflow described below; verify its workflow outcome, but do not treat that development build as another stable release or repeat stable artifact readback. +The release pull request fixes the final source tree for stable publication. An explicitly authorized protected workflow repair can advance `main` before a historical recovery. The release PR owns stable and next version markers, deterministic source epoch, tracked authorization metadata, generated Towncrier changelog, release notes, and reconciliation of the plan and status documents. Follow the checked [plan archive and external reconciliation](#external-reconciliation-and-plan-archiving) below. `.release-reconciled-version` is historical evidence for releases that used a post-publication repository closure PR; it does not advance for plans closed in the release PR. Current validation uses the archived plan, stable index and immutable external receipts instead. The release PR must not claim that registry files, provenance, tag, immutable Release, receipt, or installs already exist. The protected-main merge may run the normal TestPyPI development workflow described below; verify its workflow outcome, but do not treat that development build as another stable release or repeat stable artifact readback. List tracked release issues in a release PR as bare references or ordinary non-closing prose. Do not use GitHub closing-keyword forms such as `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, or `resolves` together with those issue references: merging such a PR can close the issues before the immutable receipt exists. The Release workflow is the sole closure owner, and acts only after its post-publication receipt readback. @@ -87,9 +87,17 @@ are inputs to the release contracts, not bookkeeping covered by an earlier run. Other changed release boundaries add their own tests; this set does not replace the final quality gate or protected CI. -Squash-merging that exact repository-owned release PR is the only human publication gate. The **Release** workflow then: +Squash-merging the exact repository-owned release PR authorizes publication. Start the Release workflow once on protected `main` using the reviewed identities, preferably before advancing the branch again. -1. validates the branch, title, tracked metadata, reviewed head/base, exact required checks, squash-tree equivalence, merge parent, canonical version, and tracked build epoch; +```sh +gh workflow run release.yml --ref main \ + -f pull-request-number="$PR_NUMBER" -f version="$VERSION" \ + -f merge-commit="$MERGE_SHA" -f reviewed-head="$HEAD_SHA" -f reviewed-base="$BASE_SHA" +``` + +The **Release** workflow performs these steps. + +1. It validates the branch, title, tracked metadata, reviewed head/base, exact required checks, squash-tree equivalence, merge parent, canonical version, and tracked build epoch; 2. relies on successful required PR quality/build checks bound to the exact reviewed tree, then runs release dependency, packaging, and artifact-set checks; 3. builds wheel and sdist once, records SHA-256 values, and creates GitHub provenance attestations; 4. publishes or exact-hash-verifies the same bytes on TestPyPI through OIDC; @@ -131,7 +139,10 @@ After publication, independently verify the immutable release, workflow, tag, re Recovery dispatch is bound to the original release PR, version, merge commit, reviewed head, and protected reviewed base. Before loading the historical authorizer, the workflow confirms that the squash merge is on the first-parent -history of the exact `main` commit that started the dispatch. Recovery +history of the exact `main` commit that started the dispatch. If main has advanced, +the rebuilt wheel, sdist and runtime lock must each match an existing GitHub-hosted +release workflow attestation for the original squash on main before either +registry can receive files. Recovery evaluates the current effective `main` rules against the original reviewed head. Reconcile outstanding releases before adding new required check contexts, since the original reviewed head must still satisfy those checks. @@ -139,8 +150,7 @@ contexts, since the original reviewed head must still satisfy those checks. Recovery accepts only exact registry bytes and the existing immutable receipt's closed release identity, and rejects unknown receipt fields. When a prior dispatch created the receipt, resume through a new recovery dispatch -from `main`. A PR-triggered rerun can resume a receipt created by its own -workflow run. Draft +from `main`. Draft GitHub Releases are retained and addressed by their numeric release ID until publication because tag lookup does not expose private drafts reliably. Every numeric-ID read, asset upload, and publication step revalidates the expected diff --git a/examples/gitlab/README.md b/examples/gitlab/README.md index 99501892..c21205be 100644 --- a/examples/gitlab/README.md +++ b/examples/gitlab/README.md @@ -44,7 +44,9 @@ pipeline timing and merge-policy implications. It does not replace manual readin | Enriched discussions | [`modes/enriched-discussions.gitlab-ci.yml`](modes/enriched-discussions.gitlab-ci.yml) | Metadata plus protected-policy GitLab discussions and remediation threads | GitLab reads before OCR | Explicitly disabled in the recipe | | Governed MCP federation | [`modes/direct-mcp.gitlab-ci.yml`](modes/direct-mcp.gitlab-ci.yml) | Metadata plus model-selected, gateway-admitted tool results | Authorized HTTPS upstream through the bounded gateway | Used advisory tools are comment-only; unused services and successful `review_read` use are not independent blockers | -Use the mode files from the same Git tag as the checksum-pinned wheel. The governed MCP recipe requires a wheel that accepts the operator-authored registry interface. +Use the mode files from the same Git tag as the checksum-pinned wheel. The +governed MCP recipe requires the operator-authored registry interface. +[Registry v3 migration](../../docs/configuration.md#governed-mcp-federation-and-trust-boundary) The default `auto` profile can use `off`, `metadata`, `enriched`, and configured federation for a single MR targeting an unprotected branch; its Rules and context policy come from the protected default branch P, while the actual diff and target stay separate. It never adds an approval for that unprotected target. The explicit `unprotected` recipe retains the earlier limited profile: only `off` or `metadata`, Rules at the exact captured target SHA as untrusted guidance, no accepted decisions or structured guidance, and no enriched context or external federation. Its limitation line does not make a complete result incomplete. A protected target keeps normal behavior in either profile. diff --git a/examples/gitlab/ocr-review.gitlab-ci.yml b/examples/gitlab/ocr-review.gitlab-ci.yml index b0d4ff09..935ec74e 100644 --- a/examples/gitlab/ocr-review.gitlab-ci.yml +++ b/examples/gitlab/ocr-review.gitlab-ci.yml @@ -6,10 +6,10 @@ default: image: docker.io/library/python:3.12-slim@sha256:5b5fe805d367f8f5a359ded6ab2652b7f9a206453ee6ee789c0045ba6ec15016 variables: - OCR_VERSION: "v1.14.5" - OCR_TOOLKIT_VERSION: "0.16.0" + OCR_VERSION: "v1.14.6" + OCR_TOOLKIT_VERSION: "0.16.1" OCR_TOOLKIT_CHECKSUMS_URL: "https://github.com/xeonvs/open-code-review-toolkit/releases/download/v${OCR_TOOLKIT_VERSION}/SHA256SUMS" - OCR_SHA256: "4bfb9142dda07c38e120c83ceeaed3e86697aa401e57d683df063a5b7c5d64d4" + OCR_SHA256: "a91fea039d7070f8155e8bdaac3b8324e97104fb510ac0fa97de40e622ee3fff" OCR_POST_MODE: "draft" OCR_STRICT_POSTING: "true" # Default-on receipt-bound approval; governed federation still applies receipt gates. diff --git a/tests/test_docs_only_ci.py b/tests/test_docs_only_ci.py index 4ed733c0..01adc792 100644 --- a/tests/test_docs_only_ci.py +++ b/tests/test_docs_only_ci.py @@ -588,8 +588,85 @@ def test_pr_cannot_replace_trusted_classifier(tmp_path: Path) -> None: **os.environ, "BASE": base, "HEAD": _git(tmp_path, "rev-parse", "HEAD"), + "BASE_REF": "dev", + "HEAD_REF": "topic", + "HEAD_REPO": "owner/toolkit", + "GITHUB_REPOSITORY": "owner/toolkit", "RUNNER_TEMP": str(tmp_path), "GITHUB_OUTPUT": str(output), } subprocess.run(["bash", "-e", "-c", classifier], cwd=tmp_path, env=environment, check=True) - assert output.read_text() == "docs_only=false\n" + assert output.read_text() == "docs_only=false\nskip_macos=false\n" + + +@pytest.mark.parametrize( + ("path", "target", "source", "same_repo", "uncertainty", "docs", "skipped"), + [ + ("README.md", "dev", "topic", True, "", True, True), + ("README.md", "dev", "topic", False, "", True, False), + ("runtime.py", "dev", "topic", True, "", False, False), + ("runtime.py", "main", "dev", True, "", False, True), + ("runtime.py", "main", "dev", False, "", False, False), + ("runtime.py", "dev", "dev", True, "", False, False), + (".release-version", "main", "release/v1.2.3", True, "", False, False), + ("runtime.py", "main", "dev", True, "missing-script", False, False), + ("runtime.py", "main", "dev", True, "script-exit", False, False), + ("runtime.py", "main", "dev", True, "unknown-output", False, False), + ("runtime.py", "main", "dev", True, "missing-head", False, False), + ("runtime.py", "main", "dev", True, "empty-delta", False, False), + ], +) +def test_advisory_runner_skip_requires_positive_same_repository_evidence( + tmp_path: Path, + path: str, + target: str, + source: str, + same_repo: bool, + uncertainty: str, + docs: bool, + skipped: bool, +) -> None: + _git(tmp_path, "init", "-q") + _git(tmp_path, "config", "user.email", "test@example.invalid") + _git(tmp_path, "config", "user.name", "Test") + script = tmp_path / "scripts" / "docs_only.py" + script.parent.mkdir() + if uncertainty != "missing-script": + code = { + "script-exit": "raise SystemExit(2)\n", + "unknown-output": 'print("docs_only=false\\nskip_macos=true")\n', + }.get(uncertainty, SCRIPT.read_text()) + script.write_text(code) + _git(tmp_path, "add", ".") + _git(tmp_path, "commit", "--allow-empty", "-qm", "base") + base = _git(tmp_path, "rev-parse", "HEAD") + if uncertainty != "empty-delta": + (tmp_path / path).write_text("changed\n") + _git(tmp_path, "add", path) + _git(tmp_path, "commit", "--allow-empty", "-qm", "head") + head = "0" * 40 if uncertainty == "missing-head" else _git(tmp_path, "rev-parse", "HEAD") + workflow = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text()) + classifier = workflow["jobs"]["classify"]["steps"][-1] + output = tmp_path / "github-output" + subprocess.run( + ["bash", "-e", "-c", classifier["run"]], + cwd=tmp_path, + env={ + **os.environ, + "BASE": base, + "HEAD": head, + "BASE_REF": target, + "HEAD_REF": source, + "HEAD_REPO": "owner/toolkit" if same_repo else "contributor/toolkit", + "GITHUB_REPOSITORY": "owner/toolkit", + "RUNNER_TEMP": str(tmp_path), + "GITHUB_OUTPUT": str(output), + }, + capture_output=True, + check=True, + timeout=15, + ) + assert output.read_text().splitlines() == [ + f"docs_only={str(docs).lower()}", + f"skip_macos={str(skipped).lower()}", + ] diff --git a/tests/test_quality_script.py b/tests/test_quality_script.py index 5ab11996..affb4ac4 100644 --- a/tests/test_quality_script.py +++ b/tests/test_quality_script.py @@ -47,9 +47,6 @@ def test_quality_script_enforces_combined_and_boundary_coverage(tmp_path: Path) "uv run --no-sync pytest --ignore=tests/test_installed_policy_e2e.py --cov=ocr_toolkit --cov-report=term-missing --cov-fail-under=88" in workflow ) - assert workflow.count("coverage: true") == 1 - assert "if: ${{ needs.classify.outputs.docs_only != 'true' && matrix.coverage }}" in workflow - assert "if: ${{ needs.classify.outputs.docs_only != 'true' && !matrix.coverage }}" in workflow assert ( "for audit_module in cli corpus scanner state limits worker_process report proof; do" in script @@ -101,6 +98,16 @@ def declared_modules(text: str) -> list[str]: steps = yaml.safe_load(workflow)["jobs"]["test-matrix"]["steps"] coverage_steps = [s for s in steps if s.get("name") == "Test with boundary coverage gates"] assert len(coverage_steps) == 1 + coverage_if = ( + "${{ needs.classify.outputs.docs_only != 'true' && " + "matrix.os == 'ubuntu-latest' && matrix.python == '3.14' }}" + ) + assert coverage_steps[0]["if"] == coverage_if + assert next(step["if"] for step in steps if step.get("id") == "native-ocr") == coverage_if + assert next(step["if"] for step in steps if step.get("name") == "Test") == ( + "${{ needs.classify.outputs.docs_only != 'true' && " + "(matrix.os != 'ubuntu-latest' || matrix.python != '3.14') }}" + ) hosted = subprocess.run( ["sh", "-eu", "-c", coverage_steps[0]["run"]], cwd=PROJECT_ROOT, diff --git a/tests/test_release_authorization.py b/tests/test_release_authorization.py index 17f8d5d1..ae66274c 100644 --- a/tests/test_release_authorization.py +++ b/tests/test_release_authorization.py @@ -333,33 +333,67 @@ def test_required_check_and_ruleset_synchronization_are_exact() -> None: authorize(protection=protection) -def test_release_workflow_classifies_ordinary_merges_before_authorization() -> None: - workflow = WORKFLOW.read_text(encoding="utf-8") +def test_release_workflow_accepts_only_main_dispatches_with_explicit_identities() -> None: + workflow = yaml.load(WORKFLOW.read_text(encoding="utf-8"), Loader=yaml.BaseLoader) + assert set(workflow["on"]) == {"workflow_dispatch"} + inputs = workflow["on"]["workflow_dispatch"]["inputs"] + assert {name: (field["required"], field["type"]) for name, field in inputs.items()} == { + "pull-request-number": ("true", "number"), + "version": ("true", "string"), + "merge-commit": ("true", "string"), + "reviewed-head": ("true", "string"), + "reviewed-base": ("true", "string"), + } - assert "name: classify-release-trigger" in workflow - assert '[[ "${PR_HEAD_REF}" == release/v* ]]' in workflow - assert "needs: classify" in workflow - assert "needs.classify.outputs.release == 'true'" in workflow + jobs = workflow["jobs"] + assert {name for name, job in jobs.items() if "needs" not in job} == {"authorize"} + gate = jobs["authorize"]["if"] + assert gate == ( + "github.event_name == 'workflow_dispatch' && github.event.repository.private == false && " + "github.ref == 'refs/heads/main'" + ) + concurrency = workflow["concurrency"] + assert " ".join(concurrency["group"].split()) == ( + f"${{{{ {gate} && 'production-release' || format('release-ignored-{{0}}', github.run_id) }}}}" + ) + assert concurrency["cancel-in-progress"] == "false" + assert jobs["build"]["needs"] == "authorize" + assert jobs["build"]["if"] == "needs.authorize.outputs.approved == 'true'" + for publisher in ("publish-testpypi", "publish-pypi", "github-release"): + assert "github.ref == 'refs/heads/main'" in jobs[publisher]["if"] @pytest.mark.parametrize( - "scenario", ["matched", "wrong_base", "wrong_parent", "fork", "retired", "side_parent"] + "scenario", + [ + "matched", + "current", + "wrong_ref", + "wrong_base", + "wrong_parent", + "missing_merge", + "fork", + "retired", + "side_parent", + ], ) -def test_manual_recovery_verifies_protected_policy_before_checkout( - tmp_path: Path, scenario: str -) -> None: +def test_dispatch_verifies_protected_policy_before_checkout(tmp_path: Path, scenario: str) -> None: job = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))["jobs"]["authorize"] assert "github.ref == 'refs/heads/main'" in job["if"] trusted_checkout, gate, checkout = job["steps"][:3] - assert trusted_checkout["if"] == "github.event_name == 'workflow_dispatch'" + assert "if" not in trusted_checkout assert trusted_checkout["with"] == { "ref": "${{ github.sha }}", "path": "dispatch-main", "fetch-depth": 0, "persist-credentials": False, } - assert gate["if"] == "github.event_name == 'workflow_dispatch'" + assert "if" not in gate assert checkout["uses"].startswith("actions/checkout@") + assert checkout["with"] == { + "ref": "${{ inputs['reviewed-base'] }}", + "persist-credentials": False, + } history = tmp_path / "dispatch-main" history.mkdir() @@ -376,7 +410,8 @@ def git(*args: str) -> str: merge = git("rev-parse", "HEAD") if scenario in {"retired", "side_parent"}: git("switch", "-qc", "restored-main", base) - git("commit", "--allow-empty", "-qm", "current policy") + if scenario != "current": + git("commit", "--allow-empty", "-qm", "current policy") if scenario == "side_parent": git("merge", "--no-ff", "-qm", "merge old history as a side parent", merge) git("merge-base", "--is-ancestor", merge, "HEAD") @@ -387,6 +422,8 @@ def git(*args: str) -> str: pr["base"]["repo"] = {"full_name": repository} pr["base"]["sha"] = base pr["merge_commit_sha"] = merge + if scenario == "missing_merge": + del pr["merge_commit_sha"] if scenario == "fork": pr["head"]["repo"]["full_name"] = "fork/open-code-review-toolkit" parent = dispatch_sha if scenario == "wrong_parent" else base @@ -401,8 +438,16 @@ def git(*args: str) -> str: "esac\n" "for url do :; done\n" 'case "$url" in\n' - ' "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER") cat pr.json ;;\n' - ' "https://api.github.com/repos/$GITHUB_REPOSITORY/git/commits/$MERGE") cat merge.json ;;\n' + ' "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER")\n' + ' case " $* " in\n' + ' *" X-GitHub-Api-Version: 2022-11-28 "*) cat pr.json ;;\n' + " *) jq 'del(.merge_commit_sha)' pr.json ;;\n" + " esac ;;\n" + ' "https://api.github.com/repos/$GITHUB_REPOSITORY/git/commits/$MERGE")\n' + ' case " $* " in\n' + ' *" X-GitHub-Api-Version: 2026-03-10 "*) cat merge.json ;;\n' + " *) exit 1 ;;\n" + " esac ;;\n" " *) exit 1 ;;\n" "esac\n" ) @@ -411,6 +456,7 @@ def git(*args: str) -> str: **os.environ, "PATH": f"{tmp_path}{os.pathsep}{os.environ['PATH']}", "GITHUB_REPOSITORY": repository, + "GITHUB_REF": "refs/heads/Main" if scenario == "wrong_ref" else "refs/heads/main", "GITHUB_SHA": dispatch_sha, "GH_TOKEN": "synthetic-token", "PR_NUMBER": "5", @@ -428,17 +474,26 @@ def git(*args: str) -> str: timeout=10, check=False, ) - assert (completed.returncode == 0) is (scenario == "matched"), completed.stderr + assert (completed.returncode == 0) is (scenario in {"matched", "current"}), completed.stderr if scenario in {"retired", "side_parent"}: assert "outside the dispatch main first-parent history" in completed.stderr + elif scenario == "wrong_ref": + assert "release dispatch must run from refs/heads/main" in completed.stderr + elif scenario in {"wrong_base", "fork", "missing_merge"}: + assert "release pull request does not match the requested identities" in completed.stderr + elif scenario == "wrong_parent": + assert "release merge is not a squash of the requested protected base" in completed.stderr def test_release_workflow_keeps_strict_release_authorization() -> None: workflow = WORKFLOW.read_text(encoding="utf-8") assert "python scripts/release_authorization.py" in workflow - assert "github.event.pull_request.base.sha || inputs['reviewed-base']" in workflow assert "Candidate head and merge commits are inspected only as data" in workflow + assert ( + "GITHUB_API_VERSION=2022-11-28 scripts/bounded_github_api.sh \\\n" + ' "repos/${REPOSITORY}/pulls/${PR_NUMBER}" /tmp/release-pr.json' + ) in workflow assert 'test "${RELEASE_BRANCH}" = "release/v${VERSION}"' in workflow assert "repos/${REPOSITORY}/rules/branches/main" in workflow assert "commits/${HEAD_SHA}/check-runs?filter=latest&per_page=100" in workflow @@ -460,7 +515,6 @@ def test_release_workflow_keeps_strict_release_authorization() -> None: assert "--validate-issue-only" in workflow assert 'test "$(git rev-parse HEAD^{tree})" = "${EXPECTED_TREE}"' in workflow assert 'test "$(git rev-parse FETCH_HEAD^{tree})" = "${EXPECTED_TREE}"' in workflow - assert "github.event.pull_request.merged == true" not in workflow def test_bounded_github_helper_rejects_unknown_endpoints_and_writes_atomically( diff --git a/tests/test_release_receipt.py b/tests/test_release_receipt.py index 6352bf9f..95ebe52c 100644 --- a/tests/test_release_receipt.py +++ b/tests/test_release_receipt.py @@ -158,6 +158,68 @@ def test_release_matrix_payload_reads_authorized_checkout_including_historical_b assert json.loads(completed.stdout.removeprefix("python-minors=")) == expected +@pytest.mark.parametrize("reject_sdist", [False, True]) +def test_historical_dispatch_verifies_original_artifacts_before_registry_work( + tmp_path: Path, reject_sdist: bool +) -> None: + import subprocess + + import yaml + + steps = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))["jobs"]["build"]["steps"] + verify = next( + step + for step in steps + if step.get("name") == "Verify original source attestations before publication" + ) + classify = next(step for step in steps if step.get("id") == "registry") + attest = next( + step + for step in steps + if step.get("uses", "").startswith("actions/attest-build-provenance@") + ) + assert steps.index(verify) < steps.index(classify) + assert verify["if"] == "github.sha != needs.authorize.outputs.commit" + assert verify["env"]["EXPECTED_COMMIT"] == "${{ needs.authorize.outputs.commit }}" + assert attest["if"] == "github.sha == needs.authorize.outputs.commit" + + (tmp_path / "dist").mkdir() + files = ("dist/a.whl", "dist/b.tar.gz", "runtime-requirements.txt") + for path in files: + (tmp_path / path).touch() + gh = tmp_path / "gh" + gh.write_text( + '#!/bin/sh\nprintf "%s\\n" "$*" >> calls\n' + 'test "$REJECT_SDIST" != 1 || test "$3" != dist/b.tar.gz\n', + encoding="utf-8", + ) + gh.chmod(0o700) + repository = "example/open-code-review-toolkit" + merge = "c" * 40 + environment = { + **os.environ, + "PATH": f"{tmp_path}{os.pathsep}{os.environ['PATH']}", + "LC_ALL": "C", + "GITHUB_REPOSITORY": repository, + "EXPECTED_COMMIT": merge, + "REJECT_SDIST": str(int(reject_sdist)), + } + completed = subprocess.run( + ["bash", "-e", "-o", "pipefail", "-c", verify["run"]], + cwd=tmp_path, + env=environment, + timeout=10, + check=False, + ) + assert (completed.returncode != 0) is reject_sdist + assert (tmp_path / "calls").read_text(encoding="utf-8").splitlines() == [ + f"attestation verify {path} --repo {repository} " + f"--signer-workflow {repository}/.github/workflows/release.yml " + f"--source-digest {merge} --source-ref refs/heads/main --deny-self-hosted-runners" + for path in (files[:2] if reject_sdist else files) + ] + + def test_existing_receipt_recovery_ignores_new_run_but_rejects_delivery_drift() -> None: payload = build_receipt(run_id=555, run_attempt=3) receipt.validate_receipt( diff --git a/tests/test_site_release_notify.py b/tests/test_site_release_notify.py index f73bbfa4..5502ce40 100644 --- a/tests/test_site_release_notify.py +++ b/tests/test_site_release_notify.py @@ -22,7 +22,10 @@ def _verification_step() -> str: def test_site_dispatch_occurs_once_after_read_only_verification() -> None: - jobs = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))["jobs"] + workflow = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8")) + assert workflow[True]["workflow_run"]["branches"] == ["main"] + jobs = workflow["jobs"] + assert "workflow_dispatch" in jobs["verify"]["if"] steps = jobs["notify"]["steps"] assert "--method POST" not in _verification_step() assert "OCR_SITE_DISPATCH_TOKEN" not in str(jobs["verify"]) @@ -59,7 +62,7 @@ def test_site_dispatch_occurs_once_after_read_only_verification() -> None: (["success"], {"receipt_attempt": 3, "receipt_mode": "reused"}, 1, "", 1, False), ( ["success"], - {"receipt_run": 39784500000, "receipt_attempt": 1, "receipt_mode": "reused"}, + {"receipt_run": 39784500000, "receipt_attempt": 1}, 1, "", 1, @@ -87,7 +90,7 @@ def test_site_dispatch_occurs_once_after_read_only_verification() -> None: 1, False, ), - (["success"], {"reviewed_head": "3" * 40}, 1, "", 1, False), + (["success"], {"event": "pull_request", "branch": "release/v0.12.1"}, 1, "", 1, False), ], ) def test_release_job_readback_is_bounded_and_fail_closed( @@ -199,8 +202,8 @@ def test_release_job_readback_is_bounded_and_fail_closed( "SOURCE_RUN_ATTEMPT": str(run_attempt), "SOURCE_WORKFLOW_ID": "315030204", "SOURCE_HEAD_SHA": source_sha, - "SOURCE_EVENT": str(overrides.get("event", "pull_request")), - "SOURCE_HEAD_BRANCH": str(overrides.get("branch", "release/v0.12.1")), + "SOURCE_EVENT": str(overrides.get("event", "workflow_dispatch")), + "SOURCE_HEAD_BRANCH": str(overrides.get("branch", "main")), "RUNNER_TEMP": str(tmp_path), "GITHUB_OUTPUT": str(output), } diff --git a/tests/test_testpypi_preview.py b/tests/test_testpypi_preview.py index 44e39623..5980e852 100644 --- a/tests/test_testpypi_preview.py +++ b/tests/test_testpypi_preview.py @@ -3,11 +3,15 @@ from __future__ import annotations import importlib.util +import json +import re +from itertools import product from pathlib import Path from types import ModuleType from typing import Any import pytest +import yaml SCRIPT = Path(__file__).parents[1] / "scripts" / "testpypi_preview.py" PROJECT_ROOT = SCRIPT.parents[1] @@ -297,7 +301,8 @@ def test_production_release_verifies_reviewed_registry_artifacts() -> None: assert "release_id=$(jq -r .id" in workflow assert "release_is_draft=$(jq -r .draft" in workflow assert "invalid GitHub Release numeric identity" in workflow - assert workflow.count("timeout-minutes:") == 8 + jobs = yaml.safe_load(workflow)["jobs"] + assert all(0 < job["timeout-minutes"] <= 30 for job in jobs.values()) assert workflow.count("--max-filesize 10485760") >= 1 assert "--retry 3 --retry-delay 2 --retry-connrefused" in verifier assert "--connect-timeout 10 --max-time 120" in verifier @@ -345,31 +350,34 @@ def test_distribution_build_is_a_bounded_pull_request_gate() -> None: def test_ci_matrix_covers_supported_python_minors_and_os_boundaries() -> None: - """Keep Linux blocking and macOS visible but advisory at both endpoints.""" + """Keep all Linux identities and both advisory macOS endpoints in full runs.""" workflow = (PROJECT_ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8") + jobs = yaml.safe_load(workflow)["jobs"] + job = jobs["test-matrix"] + matrix = job["strategy"]["matrix"] assert " push:" not in workflow - assert "continue-on-error: ${{ matrix.advisory }}" in workflow - assert "test-python312:" in workflow - assert "|| 'test-ubuntu-latest-py3.12' }}" in workflow - assert " test-matrix:\n needs: classify" in workflow + assert job["continue-on-error"] == "${{ matrix.os == 'macos-latest' }}" + assert jobs["test-python312"]["name"].endswith("|| 'test-ubuntu-latest-py3.12' }}") + assert job["name"].endswith("|| format('test-{0}-py{1}', matrix.os, matrix.python) }}") + assert job["needs"] == "classify" assert workflow.count("--ignore=tests/test_installed_policy_e2e.py") == 2 assert "run: uv run --no-sync pytest -q\n" in workflow assert 'UV_PYTHON: "3.12"' in workflow assert "UV_PYTHON: ${{ matrix.python }}" in workflow assert "uv sync --locked --python 3.12" in workflow assert 'uv sync --locked --python "${{ matrix.python }}"' in workflow - assert workflow.count("advisory: false") == 3 - assert workflow.count("advisory: true") == 2 - assert workflow.count("os: ubuntu-latest") == 3 - assert workflow.count("os: macos-latest") == 2 - assert workflow.count('python: "3.12"') == 1 - assert workflow.count('python: "3.13"') == 1 - assert workflow.count('python: "3.14"') == 2 - assert workflow.count('python: "3.15"') == 1 - for unsupported in ("3.10", "3.11"): - assert f'python: "{unsupported}"' not in workflow + assert ( + "github.event_name == 'pull_request' && needs.classify.result == 'success' && " + "needs.classify.outputs.skip_macos == 'true' &&" + ) in matrix["os"] + selected, fallback = (json.loads(value) for value in re.findall(r"'(\[[^']*\])'", matrix["os"])) + excluded = {(row["os"], row["python"]) for row in matrix["exclude"]} + required = {("ubuntu-latest", version) for version in ("3.13", "3.14", "3.15")} + advisory = {("macos-latest", version) for version in ("3.12", "3.14")} + assert set(product(selected, matrix["python"])) - excluded == required + assert set(product(fallback, matrix["python"])) - excluded == required | advisory def test_required_dependency_review_runs_for_every_pull_request() -> None: