Repository navigation
Swift keyword families: closures, decorators and thread_sleeps read their contracts (Part of #8863) - #9312
Merged
Conversation
…heir contracts (Part of #8863) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #8863
Checklist: done [c:swift]
Swift's three red cells on the pinned crucible (alamofire) are fixed in
swift.py. Four more Swift cells are red but hatched (no pinned crucible); they are listed below.What each rule now counts
{ [self] in(capture list, no params),{ x -> Int in(return type), and$0-shorthand closures ($Nexists only inside a closure)@escaping,@autoclosureand a@Sendablein type position (after: ( [ < = , >or@escaping) attribute a TYPE, not the declaration the contract namesretryResult.delayis a property, not a sleep: nowsleep(/usleep(/nanosleep(calls,.asyncAfter,Timer.scheduledTimer(the oracle's list; contract names timed deferral)No oracle or contract change. Nothing else in the swift rows fell (
family_oracle.pybefore/after diff: only these rows moved, plusstate_halt_hitsover-counts -> no-instances).Class / Sibling gaps
Class: Swift keyword-family rules that count a different construct than their contract names (decorators, thread_sleeps) or miss a closure form (closures); all three pinned red members are handled here, each with tests in
tests/test_swift_family_validity.py.Sibling gaps (none needs a burned-estate COBOL program: Swift is not a mainframe language):
queue.async { ... },{ retry() }) are not counted; a regex cannot tell them fromif x { }blocks. Needs a ruling or a narrow member-call anchor; not chosen here because it would move counts without a ruling.tests/family_validity_baseline.jsonon main is stale for other languages (c, go, javascript, rust, typescript cells differ from a fresh sweep); only swift's cells are updated here.Evidence
@literal stays first so the lookbehinds run only at an@). Not a three-run scan A/B.KEYWORD_ROSETTA_PATHis not set in this worktree and no checkout was provided). Owed:verify_language.py swifton the branch; the new rules can move rosetta cells.golden-lock.sh crucible_check.py --update --yes(both legs; a second run reports no drift).scope_check.py --expect swift --mode full: 157 differences vs main, 130 swift, 27 repo-wide archetype-distribution rollups (Callbacks & Closures 1259 -> 1268 etc.), no other language.pr_gates --fast: lint failed only onruff formatof my two files, fixed with the pinned ruff 0.17.5; the other 8 gates pass.pr_gates --ratchets: 9 pass, 0 fail.tests/test_swift_family_validity.py,test_swift_strict.py,test_swift.py, family sweep/chart/red-cells tests pass.family_validity_baseline.json(swift cells), the twodocs/self_scan/family_validity_*.svg.Lessons for agents
family_oracle_sweep.py --writerewrites every language's baseline cells; when main's baseline is stale, splice only your language back and write withjson.dumps(indent=1, sort_keys=True)ortest_committed_svgs_are_currentfails on formatting.@) first and the lookbehind after it.🤖 Generated with Claude Code