Skip to content

go/kotlin/swift dead_code: count a keyword-led comment only when it has a statement's shape (Part of #7207) - #7322

Merged
squid-shepherd[bot] merged 9 commits into
mainfrom
churn/7207-20261031T1506Z
Oct 31, 2026
Merged

squid-shepherd[bot] merged 9 commits into
mainfrom
churn/7207-20261031T1506Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #7207 (slice 3: go, kotlin, swift).

Stacked on #7319 (csharp/typescript/javascript/rust, branch churn/7207-20261031T1444Z, not yet on main): this branch merges it and reuses its helper commented_keyword_statement. Retarget/merge after #7319 lands; until then the diff vs main also shows slice 2.

What changed

dead_code in go, kotlin and swift was // + bare keyword, so prose ("// if the user cancels, we retry", "// return value is ignored") counted as commented-out code. Each now uses commented_keyword_statement(<same keywords>, block=False): the keyword must be followed by a statement-shaped line (ends in ; { } or a (...) group, or holds an assignment incl. :=). Markers and keyword lists are unchanged (// only, as before).

Files (hand-written, 4 of this slice): languages/go.py, kotlin.py, swift.py, tests/extraction/languages/test_native_dead_code_shape_7207.py (prose negatives + real commented-out-statement positives per language, plus a long-line speed pin). Goldens regenerated.

File-cap exception: stacked on #7319, whose 5 hand-written files appear in the diff against main until it lands; this slice adds 4 (go.py, kotlin.py, swift.py, one test).

Golden re-bless

golden-lock.sh crucible_check.py --update --yes, both legs. scope_check.py --base origin/churn/7207-20261031T1444Z --mode both --expect go,kotlin,swift: drift is go 227, swift 23, plus repo-wide rollup fields (60) and 106 rows labelled dockerfile that are .go files under the moby dockerfile/ directory (e.g. versioning.go), i.e. Go. No kotlin rows moved (no commented-out keyword-led prose in the kotlin corpus samples). No other language moved.

Class / Sibling gaps

Class: keyword-led comment counted as dead code without a statement shape (#7207's 43 matching languages). Done: cobol (#7296), c/cpp/java (#7307), csharp/typescript/javascript/rust (#7319), go/kotlin/swift (this PR).
Known trade-off in this slice: a keyword-led line with no terminator or call/assignment (// import "fmt", // import Foundation, // return x) no longer counts.
Sibling gaps (not here: other families, each a per-language syntax decision): abap, acs, ada, apex, assembly, crystal, dart, db2_sql, easytrieve, embedded_python, fortran, fsharp, groovy, haskell, livecode, lua, matlab, objective-c, perl, php, postgresql, powershell, python, rexx, ruby, scala, shell, solidity, tcl, yacc, zig, zscript (list from #7207, not re-verified here).
Remaining slices: those families, one checklist per family.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 31, 2026 15:45
@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (9d19fde) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd
squid-shepherd Bot marked this pull request as draft October 31, 2026 16:15
@squid-shepherd squid-shepherd Bot added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 31, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 31, 2026 16:20
@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #7322 @ 9d19fde: 9 failed check(s)

== db2 (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502147/job/124588938098
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== db2 ${{ matrix.shard }} (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502142/job/124588940603
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== det (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502142/job/124588939326
repro: tests/tools/box/heavy-run.sh python tests/tools/proof_sweep.py --det-only --skip-db2 --cases --work /tmp/gitgalaxy-scratch/ci-digest/sweep
errors:
##[error]Process completed with exit code 1.
log tail:
compression-level: 6
overwrite: false
include-hidden-files: false
archive: true
env:
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
##[endgroup]
With the provided path, there will be 184 files uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: det-sweep-ledger.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 158473
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is a359aaafeae31e765b94e4b22a26f4c875bf24202692ee6cae1aa97bbd4b2d0a
Finalizing artifact upload
Artifact det-sweep-ledger successfully finalized. Artifact ID 13048229322
Artifact det-sweep-ledger has been successfully uploaded! Final size is 158473 bytes. Artifact ID is 13048229322
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502142/artifacts/13048229322
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/d747babd-08ee-40f5-b4df-fe751cf12090' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

== equivalence-e2e (failure) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502147/job/124588937115
repro: python tests/tools/pr_gates.py --fast
errors:
##[error]Process completed with exit code 1.
log tail:
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: equivalence-e2e
##[group]Run echo "plan: $PLAN, db2 $DB2_PLAN ($PLAN_RESULT), shards: $SHARDS, db2: $DB2"
echo "plan: $PLAN, db2 $DB2_PLAN ($PLAN_RESULT), shards: $SHARDS, db2: $DB2"
# runner-minutes of this run so far (every finished job but this one), for the PR body / the nightly trend
gh api --paginate "repos/$REPO/actions/runs/$RUN_ID/jobs?per_page=100" --jq '.jobs[] | select(.name != "equivalence-e2e" and .completed_at != null) | [.name, ((.completed_at | fromdateiso8601) - (.started_at | fromdateiso8601))] | @TSV' > j
python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY"
rows = [ln.rstrip("\n").split("\t") for ln in open("jobs.tsv", encoding="utf-8") if ln.strip()]
total = sum(float(s) for _, s in rows)
print("## Equivalence E2E runner time")
print("| job | seconds |\n|---|---|")
print("".join(f"| {n} | {float(s):.0f} |\n" for n, s in rows), end="")
print(f"\n**{total / 60:.1f} runner-minutes** across {len(rows)} job(s)")
PY
# #4935: a tree the PR run of this workflow proved green: the gate skipped the plan and every job after it
if [ "$SKIP" = "true" ]; then test "$PLAN_RESULT" = "skipped" && test "$SHARDS" = "skipped" && test "$DB2" = "skipped"; exit; fi
test "$PLAN_RESULT" = "success"
if [ "$PLAN" = "none" ]; then test "$SHARDS" = "skipped" && test "$DB2" = "skipped"; exit; fi
test "$SHARDS" = "success"
# #6664: a skipped db2 is green only when the plan said none (no input of the Db2 files changed)
if [ "$DB2_PLAN" = "none" ]; then test "$DB2" = "skipped"; else test "$DB2" = "success"; fi
shell: /usr/bin/bash -e {0}
env:
PLAN:
DB2_PLAN:
PLAN_RESULT: cancelled
SKIP:
SHARDS: cancelled
DB2: cancelled
GH_TOKEN: ***
REPO: squid-protocol/gitgalaxy
RUN_ID: 41218502147
##[endgroup]
plan: , db2 (cancelled), shards: cancelled, db2: cancelled
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== measure (shard ${{ matrix.shard }}/${{ matrix.total }}) (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502236/job/124588942500
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== runner-tests (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502236/job/124588583394
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== shard ${{ matrix.group }}/${{ needs.plan.outputs.splits }} (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502147/job/124588937791
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== shard ${{ matrix.shard }} (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502142/job/124588940303
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

== shard ${{ matrix.shard }} (${{ matrix.loc }} LOC) (cancelled) -- infra
https://github.com/squid-protocol/gitgalaxy/actions/runs/41218502215/job/124588922372
repro: python tests/tools/pr_gates.py --fast
log tail:
(log unavailable: gh: HTTP 404)

@squid-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 31, 2026 16:37
@squid-shepherd squid-shepherd Bot removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md labels Oct 31, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 31, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit 4e6f311 into main Oct 31, 2026
74 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/7207-20261031T1506Z branch October 31, 2026 17:50
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

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

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant