Skip to content

Python keyword families: all nine red cells read 0.8 or better on the pinned crucible (Part of #8863) - #9308

Merged
squid-shepherd[bot] merged 6 commits into
mainfrom
churn/8863-20261125T1512Z
Nov 25, 2026
Merged

squid-shepherd[bot] merged 6 commits into
mainfrom
churn/8863-20261125T1512Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #8863

Python's nine red cells in the keyword-family validity grid are now all at or above 0.8 (recall and precision) on the pinned language-crucible v1.8.0. Numbers are from family_oracle_sweep.py; the committed baseline's python cells are regenerated from it.

Cells (recall / precision, before -> after)

Family Before After Cause class
telemetry 0.03 / 1.00 1.00 / 0.986 rule: only logging/logger receivers named; Airflow-style self.log.*, LOG.* missed
sync_locks 0.09 / 0.20 1.00 / 1.00 (oracle n=8) rule: counted Event/Barrier words, missed .acquire(/.release(); oracle: release(code) and acquire on non-lock receivers counted
bitwise_ops 0.88 / 0.24 0.84 / 0.913 rule: | in annotations / A | B unions; oracle: |= and nested-def return annotations
time_date_logic 0.33 / 0.53 0.927 / 0.974 rule: time.sleep double-owned, .now/utcnow/today(, bare gmtime( missed; oracle: clock names
io 0.58 / 0.41 0.875 / 0.84 rule: bare words (open, socket, requests) in non-call positions; .read/.write/.readline/.mkdir( missed
concurrency 0.71 / 0.48 (hatched) 1.00 / 0.976 oracle: counted threads only; the contract names async/await
thread_sleeps 0.55 / 1.00 1.00 / 1.00 rule: anyio.sleep, bare sleep( after from time import sleep
high_risk_execution 0.65 / 0.92 1.00 / 0.812 (oracle n=13) rule: bare exit(; oracle: system/abort only count on os
comprehensions 0.79 / 0.67 0.859 / 0.96 rule: for statement after an open bracket; map/filter/reduce/starmap( forms

family_red_cells.py reports no red python cell.

What changed

  • languages/python.py: rule fixes for the nine families above (shared _COMP_FOR helper for the bracket comprehension forms).
  • languages/embedded_python.py: the 14 .py files under the crucible's embedded_python/ use that profile but are scored in the "python" cells, so its telemetry and sync_locks needed the same fixes.
  • tests/tools/family_oracle.py (+ test_family_oracle.py): oracle brought to the contracts (async nodes count as concurrency; |= counts as bitwise; nested-def return unions excluded; lock/clock/danger receivers tightened).
  • tests/test_python_family_validity_8863.py (new): positive and negative line tables per family.
  • Regenerated, not hand-edited: tests/family_validity_baseline.json (python cells only; other languages' stale cells left as on main), the two docs/self_scan/family_validity_*.svg, and both golden masters.

Gates

  • Golden bless (re-done after merging main, which touched the same golden files) via golden-lock.sh crucible_check.py --update --yes. The first attempt was refused (box load 39.7, one checker.ts regex timeout); I waited for load under 8 and re-ran, with no timeout bypass. Visible drift is all .py files (python, embedded_python, and .py helper scripts living in the fortran and cpp corpora); no non-python extension is in the shown differences. The log caps the list, so the unseen tail was not attributed per file.
  • pr_gates.py --fast 9/9 (after regenerating the stale SVGs), --ratchets 9/9, audit_check.py all clear.
  • New and oracle tests: 186 passed (chart, oracle, new python tests).
  • CPU (galaxyscope on language-crucible/data/python, GALAXYSCOPE_MAX_WORKERS=1, 3 alternating runs, user s): main 15.03 / 14.79 / 14.87 (mean 14.90), branch 15.22 / 15.25 / 15.28 (mean 15.25): +2.3%.
  • keyword-rosetta rosetta_audit.py against main as baseline: 51 languages, 0 regressions. python (2 mismatches) and embedded_python (1) fail identically on main (pre-existing drift), unchanged by this PR.

Class / Sibling gaps

  • Other languages' cells in tests/family_validity_baseline.json are stale against the sweep (it rewrites every language); I kept them as on main and only changed python. A remeasure of the whole grid is the family-validity-remeasure skill's job.
  • arch_globals for python reads 0.79 / 0.89; it is not in the epic's list for python, so I left it.
  • embedded_python is a sibling profile scored in the python cells: fixed for telemetry and sync_locks only because those were what its files moved. Its other families were not audited separately.
  • Known limits of the rules: no per-family string shielding exists (prism/detector: string-literal shielding is selective by signal family (if/try/open count inside a literal, eval does not) #2535), so the bitwise rule only counts operators before the first quote on a line (an operator after a string on the same line is missed). The oracle still counts a few type unions in value positions (bitwise: 7 | and 1 & missed). socket.socket() is counted by the io rule but not by the oracle. sync_locks and high_risk_execution have thin oracle counts (8 and 13), so their 1.0 values are a small sample.

Plan differences

The plan listed 4 hand-written files; the work needed embedded_python.py as well (above), and high_risk_execution turned out to need a rule-side exit( fix rather than being already green. The baseline's stale function counts were replaced by the sweep's.

Not in this PR

  • Other languages' red cells, and a whole-grid remeasure.
  • arch_globals for python.
  • family_missing_keywords.py (owned by another worker).

Remaining slices

None for the nine python cells. Open questions for the contract (not filed): none; the contracts were specific enough to rule on every cell.

Checklist: done [c:b49e1cd0] -- all 9 python cells >= 0.8 on the pinned crucible; arch_globals and other languages not in scope

Cross-repo

None: engine-only. The keyword-rosetta corpus is unchanged and shows no new regression.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 25, 2026
@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 25, 2026 16:11
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit aef60af into main Nov 25, 2026
57 of 58 checks passed
@squid-shepherd

Copy link
Copy Markdown
Contributor

PR #9308 @ 1a61f18: 1 failed check(s)

== shepherd (label event) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/45651610895/job/139337341305
repro: python tests/tools/pr_gates.py --fast
errors:
fail-on-cache-miss: false
##[error]Process completed with exit code 1.
log tail:
Cache restored successfully
Cache restored from key: shepherd-api-45614693707
##[warning]Input 'app-id' has been deprecated with message: Use 'client-id' instead.
##[group]Run actions/create-github-app-token@64ab729
with:
app-id: ***
private-key: ***
skip-token-revoke: false
github-api-url: https://api.github.com
##[endgroup]
Inputs 'owner' and 'repositories' are not set. Creating token for this repository (squid-protocol/gitgalaxy).
##[group]Run python3 tests/tools/shepherd_gh.py event --event-path "$GITHUB_EVENT_PATH" --flake-cache flake-cache/flake_history.json
python3 tests/tools/shepherd_gh.py event --event-path "$GITHUB_EVENT_PATH" --flake-cache flake-cache/flake_history.json
shell: /usr/bin/bash -e {0}
env:
GH_TOKEN: ***
SHEPHERD_TRUSTED_BOTS: squid-shepherd[bot]
SHEPHERD_API_CACHE: api-cache
##[endgroup]
#9308 approval marker for 1a61f18: FAILED: unexpected end of JSON input
##[error]Process completed with exit code 1.
##[warning]Input 'app-id' has been deprecated with message: Use 'client-id' instead.
Post job cleanup.
Token revoked
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.1
Temporarily overriding HOME='/home/runner/work/_temp/767dc8f6-5e3a-4da3-b23c-ff5cd47c0265' 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

@squid-shepherd
squid-shepherd Bot deleted the churn/8863-20261125T1512Z branch November 25, 2026 16:41
@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 Nov 25, 2026
squid-protocol added a commit that referenced this pull request Nov 25, 2026
…uments the new rule (red main after #9308) (#9316)

* fix(python): `.filter(` is not a comprehension; the bitwise test documents the new string rule (red main after #9308)

#9308 (aef60af) left two tests in tests/extraction/languages/test_python_strict.py failing on main. Each is a different kind of failure:

1. comprehensions: the added functional-builtin alternative `\b(?:map|filter|reduce|starmap)\(` matched the METHOD `qs.filter(`, because \b holds after a dot. That is exactly the false positive test_python_comprehensions_was_fixed_from_a_javascript_copy_paste guards (Django's `User.objects.filter(...)`). Now: bare `map(` / `filter(` / `reduce(` / `starmap(`, plus the explicit `functools.reduce(` and `itertools.starmap(` forms; a method of anything else no longer counts.
2. bitwise_ops: #9308 deliberately stopped counting an operator after the first quote on a line (its own comment states the cost). The old test still asserted the pre-change behaviour (`re.compile(r"^a~b<<")` matching). The test now documents the new rule: operator before the quote counts, inside a string literal does not. This narrows #2535 / #8866's "no string shielding" decision; flagged in the PR for the owner.

Re-blessed on main's pin (language-crucible v1.8.0): both golden-master legs (90 differences, all comprehension-count and cluster-distance shifts), the one family-baseline cell it moves (python/comprehensions: n_family 177 -> 175, recall 0.859 -> 0.848) and the family-validity SVGs. The full family sweep also reports 11 stale cells in c / go / javascript / rust / typescript that this change does not touch; they are left as they are.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* test(python): re-bless the golden masters and family charts on the tree merged with main (Swift keyword families)

6 differences per golden-master leg. family_oracle_sweep agrees with the merged baseline except for 11 cells (c, go, javascript, rust, typescript) that are stale on main and unrelated to this change; the python/comprehensions cell and the new Swift cells match.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 25, 2026
…(Part of #9321) (#9322)

Class guard for the #9308 regression fixed by #9316.

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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 shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant