Skip to content

Swift keyword families: io, time_date_logic, bitwise_ops, regex_execution read their contracts (Part of #9341, #8863) - #9374

Merged
squid-shepherd[bot] merged 3 commits into
mainfrom
churn/9341-20261126T0618Z
Nov 26, 2026
Merged

squid-shepherd[bot] merged 3 commits into
mainfrom
churn/9341-20261126T0618Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Checklist: done [c:swift-keyword-families]

What changed

Swift's 4 red cells were measured on vapor (the pinned crucible has too few Swift functions to score them). Re-measured on current main, then fixed:

cell cause class fix before (recall / precision) after
bitwise_ops rule counts a different construct (~ ^ << >> inside string fixtures) bitwise_ops: outside_literals scope filter in swift.py 1.00 / 0.77 1.00 / 0.93
regex_execution oracle misses a form (.range(of:, options: .regularExpression)) oracle reads .range / .replacingOccurrences with .regularExpression; rule also covers replacingOccurrences - / 0.00 (1 vs 0) 1.00 / 1.00
time_date_logic real missing keywords (Date(...), timeIntervalSince*, addingTimeInterval, ISO8601DateFormatter, DateComponents, TimeZone, clocks, Duration); Timer.scheduledTimer removed (a timer is thread_sleeps', per the ruling) rule 0.59 / 0.96 0.98 / 0.90
io real missing keyword (Data(contentsOfFile:), String(contentsOf...)) rule 0.73 / 1.00 1.00 / 1.00

Remaining bitwise over-count (14 fire vs 13): one default-parameter shift (max: Int? = 1 << 14) the oracle does not read; a real shift, no change.

Class / Sibling gaps

Class: Swift family rules disagreeing with their contract or the oracle's reading, on the four red cells. Same-mechanism siblings handled here: replacingOccurrences(... .regularExpression) (regex), String(contentsOf...) (io), the clock/duration/timezone constructors (time). Sibling gaps: none in Swift; & and | are not counted by the rule (oracle counts them) but recall is 1.00 so left alone, risk of inout/pattern false positives. Other languages' cells are their own issues.

Evidence

  • Measured on vapor with family_oracle.py --lang swift before/after; cells recorded with --update-baseline (not pinned); family_red_cells.py --lang swift: 0 red cells.
  • Golden masters re-blessed (golden-lock, both legs): 14 files, only bitwise_operations and time_date_logic signal files plus aggregates/snapshots, matching the two changed rules on the crucible's Swift files (io/regex did not move there).
  • CPU, 3 alternating runs on the swift crucible data, mean user s: base 3.30, branch 3.29.
  • keyword-rosetta rebless.py swift --dry-run: nothing moved.
  • audit_check all clear; pr_gates --fast 9/9; --ratchets 9/9.

Family-validity checklist

  • one language, one PR
  • each cell re-measured on current main first
  • cause class named, oracle checked against contract before the rule
  • before/after numbers above
  • regression tests with positives and false positives (test_swift_strict.py, oracle cases in family_oracle_cases.json)
  • CPU, keyword-rosetta, golden bless

Lessons for agents

  • The Swift crucible is too small to score these cells: re-measure on vapor (/nvme-data/gitgalaxy-data/vapor), then family_oracle.py --corpus vapor --update-baseline and family_validity_chart.py --write.
  • _scope_filters outside_literals works per rule key, not just branch; test it through StructuralExtractor(...).splice(code, "")["equations"].

Cross-repo: no companion PRs. Overlaps in tests/family_validity_baseline.json and the chart SVGs with other open family-validity PRs: whichever merges second re-merges main and re-runs family_validity_chart.py --write.

Facts checked: all 4 cells green by re-scan; ratchets pass; no files over 5 hand-written (swift.py, test_swift_strict.py, family_oracle_specs_a.py, family_oracle_cases.json).

🤖 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 26, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 26, 2026 06:57
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 26, 2026 06:58
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@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 Nov 26, 2026
@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