Repository navigation
feat(autofix): deny-by-default footprint gate and positional window censuses #9156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -606,6 +606,61 @@ not_merge_freight() { | |
| git diff --quiet origin/main "${BRANCH}" -- "${f}" 2> /dev/null || printf '%s\0' "${f}" | ||
| done | ||
| } | ||
| # --- Deny-by-default footprint areas ---------------------------------------- | ||
| # The class gate above protects an ENUMERATED surface, and enumeration is | ||
| # never complete (a denylist is not a boundary). This check inverts the | ||
| # default: every file a round touches is mapped to an AREA — its declared | ||
| # workspace, else its top-level directory, else the root file itself — and | ||
| # any area outside the PR's own footprint is surfaced. Consequence is | ||
| # staged via QWEN_AUTOFIX_FOOTPRINT_ENFORCE: 'advisory' (default) writes a | ||
| # gate-authored report section; 'reject' turns expansions into a retryable | ||
| # rejection. Merge freight is excluded from the round side; deleted | ||
| # workspaces degrade to their top-level segment (conservative: mismatch | ||
| # surfaces rather than hides). | ||
| list_areas() { | ||
| local wss f matched w | ||
| wss="$(tr '\0' '\n' < "${1}" | bash "${RUNNER_TEMP}/resolve-owning-packages.sh" 2> /dev/null || true)" | ||
|
wenshao marked this conversation as resolved.
Resolved
wenshao marked this conversation as resolved.
Resolved
|
||
| while IFS= read -r -d '' f; do | ||
| [[ -n "${f}" ]] || continue | ||
| matched='' | ||
| while IFS= read -r w; do | ||
| [[ -n "${w}" && "${f}" == "${w}"/* ]] && { matched="${w}"; break; } | ||
| done <<< "${wss}" | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| if [[ -n "${matched}" ]]; then | ||
| echo "${matched}" | ||
| elif [[ "${f}" == */* ]]; then | ||
| echo "${f%%/*}" | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| else | ||
| echo "/${f}" | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| fi | ||
| done < "${1}" | sort -u | ||
| } | ||
| FOOTPRINT_ENFORCE="${FOOTPRINT_ENFORCE:-advisory}" | ||
| [[ "${FOOTPRINT_ENFORCE}" == 'reject' ]] || FOOTPRINT_ENFORCE='advisory' | ||
| ROUND_FILES_Z="$(mktemp)" | ||
| PR_FILES_Z="$(mktemp)" | ||
| git diff --name-only -z --no-renames "${ROUND_RANGE}" 2> /dev/null | not_merge_freight > "${ROUND_FILES_Z}" || true | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Queued per the round's batch cap: a freight-file footprint fixture (conflict-resolution round shape). 🤖 via Claude Code · model
wenshao marked this conversation as resolved.
Resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The Failure scenario: A race condition where the branch's remote tracking ref ( Suggested fix: When the round-side — deepseek-v4-flash via Qwen Code /review (v0.21.11) |
||
| git diff --name-only -z --no-renames "${PR_RANGE}" 2> /dev/null > "${PR_FILES_Z}" || true | ||
|
wenshao marked this conversation as resolved.
Resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The PR-side Failure scenario: A transient failure of Suggested fix: When the PR-side — deepseek-v4-flash via Qwen Code /review (v0.21.11) |
||
| OUT_AREAS="$(comm -23 <(list_areas "${ROUND_FILES_Z}") <(list_areas "${PR_FILES_Z}"))" || OUT_AREAS='' | ||
| rm -f "${ROUND_FILES_Z}" "${PR_FILES_Z}" | ||
| if [[ -n "${OUT_AREAS}" ]]; then | ||
| if [[ "${FOOTPRINT_ENFORCE}" == 'reject' ]]; then | ||
| { | ||
| echo 'This round modified areas entirely outside the PR footprint:' | ||
| printf '%s\n' "${OUT_AREAS//[^A-Za-z0-9._\/ -]/?}" | ||
| echo 'Footprint enforcement is set to reject: revert these files, or escalate the feedback that requires them to a maintainer as an open question.' | ||
| } >> "${GATE_LOG}" | ||
| reject_fix 'round expands into areas outside the PR footprint' | ||
| else | ||
| { | ||
| echo '🧭 **Gate advisory — this round modified areas outside the PR footprint** (machine-measured, not agent-authored):' | ||
| printf -- '- %s\n' "${OUT_AREAS//[^A-Za-z0-9._\/ -]/?}" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Queued per the round's batch cap: per-line sanitization and one bullet per area, both arms. 🤖 via Claude Code · model
wenshao marked this conversation as resolved.
Resolved
|
||
| echo 'Review the expansion deliberately; the footprint gate is in advisory mode. · 本轮改动了 PR 足迹之外的区域(门自动测量,非 agent 文本),当前足迹门为 advisory 模式,请有意识地审阅该扩张。' | ||
| } >> "${WORKDIR}/gate-advisories.md" | ||
| echo "🧭 footprint expansion (advisory): $(tr '\n' ' ' <<< "${OUT_AREAS}")" | tee -a "${GATE_LOG}" | ||
|
wenshao marked this conversation as resolved.
Resolved
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Queued per the round's batch cap: the GATE_LOG sink gets the same charset treatment with the per-line bullet rework. 🤖 via Claude Code · model
wenshao marked this conversation as resolved.
Resolved
|
||
| fi | ||
| fi | ||
|
|
||
| # Test-deletion advisory: deleting or shrinking tests is sometimes right | ||
| # (the pinned behavior was wrong, or coverage is duplicated) and the agent | ||
| # is required to justify it in its summary — but the SURFACING must not be | ||
|
|
@@ -781,15 +836,18 @@ if [[ -s "${WORKDIR}/resolved-comments.txt" && -s "${WORKDIR}/rc.json" ]]; then | |
| | ($ids | split("\n") | ||
| | map(sub("^rc:"; "") | sub("\r$"; "") | ||
| | select(test("^[0-9]+$")) | tonumber)) as $resolved | ||
| | def critical($c): | ||
| | def cr_attached($x): | ||
| (($x.pull_request_review_id // null) as $review | ||
| | $review != null | ||
| and any($reviews[]; .id == $review and ((.state // "") == "CHANGES_REQUESTED"))); | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| def critical($c): | ||
| (($c.body // "") | contains("**[Critical]**")) | ||
| or (($c.in_reply_to_id // null) as $root | ||
| | $root != null | ||
| and any($comments[]; | ||
| .id == $root and ((.body // "") | contains("**[Critical]**")))) | ||
| or (($c.pull_request_review_id // null) as $review | ||
| | $review != null | ||
| and any($reviews[]; .id == $review and ((.state // "") == "CHANGES_REQUESTED"))); | ||
| .id == $root | ||
| and (((.body // "") | contains("**[Critical]**")) or cr_attached(.)))) | ||
|
wenshao marked this conversation as resolved.
Resolved
|
||
| or cr_attached($c); | ||
|
Comment on lines
+887
to
+888
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Queued per the round's batch cap: the reply-arm rc.json fixture (reply + CR-attached root) lands with the bite fixture batch. 🤖 via Claude Code · model |
||
| any($comments[]; (.id as $id | $resolved | index($id) != null) and critical(.))' \ | ||
| "${WORKDIR}/rc.json" 2> /dev/null)" || BITE_ENFORCE='false' | ||
| [[ "${BITE_ENFORCE}" == 'true' ]] || BITE_ENFORCE='false' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -163,6 +163,14 @@ env: | |
| # tripping engages the brake. | ||
| # TUNABLE WITHOUT A CODE CHANGE like the scan budgets above; a malformed | ||
| # value falls back to its default at the read site. | ||
| # Staged-rollout switch for the verification gate's deny-by-default | ||
| # footprint check: a round touching AREAS (declared workspace, else | ||
| # top-level dir, else root file) outside the PR's own footprint is | ||
| # surfaced as a gate advisory by default; setting the repo variable to | ||
| # 'reject' turns expansions into a retryable rejection once advisory | ||
| # observation shows an acceptable false-positive rate. The class gate's | ||
| # enumerated protections reject regardless of this switch. | ||
| FOOTPRINT_ENFORCE: "${{ vars.QWEN_AUTOFIX_FOOTPRINT_ENFORCE || 'advisory' }}" | ||
|
wenshao marked this conversation as resolved.
Resolved
wenshao marked this conversation as resolved.
Resolved
|
||
| GROWTH_BUDGET_SRC_LINES: '${{ vars.QWEN_AUTOFIX_GROWTH_BUDGET_SRC_LINES || 400 }}' | ||
| GROWTH_BUDGET_TEST_LINES: '${{ vars.QWEN_AUTOFIX_GROWTH_BUDGET_TEST_LINES || 400 }}' | ||
| # Non-convergence handoff: once the growth brake has been over budget for | ||
|
|
@@ -4993,8 +5001,8 @@ jobs: | |
| PRIOR_TIMEOUTS="$(jq -r --arg ab "${AUTOFIX_BOT}" --arg key "${LIVE_REARM_KEY}" ' | ||
| [ .[] | select((.user.login // "") == $ab) | ||
| | select((.body // "") | contains("<!-- autofix-eval ")) | ||
| | select(((.body // "") | contains("win=" + $key + " -->")) | ||
| or ($key == "none" and (((.body // "") | contains("win=")) | not))) | ||
| | select(([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins | ||
| | ($wins | length) > 0 and any($wins[]; . == $key)) | ||
|
wenshao marked this conversation as resolved.
Resolved
wenshao marked this conversation as resolved.
Resolved
|
||
| ] | sort_by(.created_at) | ||
| | map((.body | gsub("\r"; "") | split("\n")[0])) | ||
| | (map(test("Addressed the latest review feedback|no changes needed")) | rindex(true) // -1) as $lastok | ||
|
|
@@ -5950,8 +5958,8 @@ jobs: | |
| [.[] | select((.user.login // "") == $ab) | ||
| | select((.body // "") | contains("<!-- autofix-eval ")) | ||
| | select( | ||
| ((.body // "") | contains("win=" + $win + " -->")) | ||
| or ($win == "none" and (((.body // "") | contains("win=")) | not)))] | ||
| ([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins | ||
| | ($wins | length) > 0 and any($wins[]; . == $win))] | ||
| | sort_by(.created_at) | .[] | ||
| | (.body | gsub("\r"; "") | split("\n")[0])' "${WORKDIR}/ic.json" 2> /dev/null || true)" | ||
| if [[ -z "${WIN_HEADS}" ]]; then | ||
|
|
@@ -6423,8 +6431,8 @@ jobs: | |
| [.[] | select((.user.login // "") == $ab) | ||
| | select((.body // "") | contains("<!-- autofix-eval ")) | ||
| | select( | ||
| ((.body // "") | contains("win=" + $win + " -->")) | ||
| or ($win == "none" and (((.body // "") | contains("win=")) | not)))] | ||
| ([ ((.body // "") | scan("<!-- autofix-eval ts=[^ ]+ acted=[^ ]+ round=[0-9]+(?: win=([^ ]+))? -->")) ] | map(.[0] // "none")) as $wins | ||
| | ($wins | length) > 0 and any($wins[]; . == $win))] | ||
| | sort_by(.created_at) | .[] | ||
| | (.body | gsub("\r"; "") | split("\n")[0])' <<< "${COMMENTS_JSON}" 2> /dev/null || true)" | ||
|
Comment on lines
+6433
to
6436
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partially addressed (site 1's fixture now discriminates); discriminating fixtures at WIN_HEADS and PRIOR_HEADS are queued. 🤖 via Claude Code · model |
||
| while IFS= read -r H; do | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partially addressed in 3bce044: the footprint path no longer consumes the staged resolver at all (ref-anchored globs), which removes this consumer from the unpinned surface. Digest-pinning the resolver for its remaining consumers (bite, class scans) is queued with the follow-up backlog.
🤖 via Claude Code · model
claude-fable-5