Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
4d9e696
Preserve chained sleep call detection
austinywang Jul 21, 2026
1ad7e4b
Classify sleep calls by receiver shape
austinywang Jul 21, 2026
18a2903
Limit sleep guard to known real clocks
austinywang Jul 21, 2026
45eefc7
Resolve named standard clock sleeps
austinywang Jul 21, 2026
0ce6e61
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 21, 2026
9406d1d
test: cover named clock scope resolution
austinywang Jul 21, 2026
dc20b12
Fix named clock scope resolution
austinywang Jul 21, 2026
94987bc
test: cover specialized Task sleep calls
austinywang Jul 21, 2026
578a97c
Preserve specialized Task sleep detection
austinywang Jul 21, 2026
6ce8459
test: cover lexical clock visibility
austinywang Jul 21, 2026
2677f48
Resolve named clocks by lexical scope
austinywang Jul 21, 2026
06dcb42
test: cover lexical sleep edge cases
austinywang Jul 21, 2026
5e98baa
Handle lexical sleep edge cases
austinywang Jul 21, 2026
9dc4f2b
test: cover qualified and member clock receivers
austinywang Jul 21, 2026
426a0cc
Handle qualified and member clock receivers
austinywang Jul 21, 2026
ffb0034
test: cover self and multi-binding clocks
austinywang Jul 21, 2026
db5f4a0
Resolve self and multi-binding clocks
austinywang Jul 21, 2026
1f14456
test: cover signature and comment masking
austinywang Jul 21, 2026
671d089
Preserve signature and comment scope
austinywang Jul 21, 2026
66d324f
test: cover comments and qualified POSIX sleeps
austinywang Jul 21, 2026
c8b6b22
Handle line comments and qualified POSIX sleeps
austinywang Jul 21, 2026
95f8ea7
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 21, 2026
fcd5f88
test: cover multiline clocks and failable initializers
austinywang Jul 21, 2026
1d53941
Resolve continued clocks and failable initializers
austinywang Jul 21, 2026
36317f8
test: cover multiline closure clock parameters
austinywang Jul 22, 2026
506485b
test: cover assigned closure clock captures
austinywang Jul 22, 2026
8670833
Resolve multiline closure clock receivers
austinywang Jul 22, 2026
11d9fb6
test: cover shorthand and conditional clocks
austinywang Jul 22, 2026
d55d385
Preserve clocks through Swift conditional scopes
austinywang Jul 22, 2026
84ebf1a
test: cover explicit optional clock bindings
austinywang Jul 22, 2026
3fd5173
Inherit clock identity through optional bindings
austinywang Jul 22, 2026
5fb7df2
test: cover loop clocks and nested initializers
austinywang Jul 22, 2026
53f2bf4
Anchor named clock declaration classification
austinywang Jul 22, 2026
df510d9
test: cover later real clock members
austinywang Jul 22, 2026
b52aedb
Resolve explicit real clock members by type
austinywang Jul 22, 2026
47db2e6
test: cover sleep modules and nested type identity
austinywang Jul 22, 2026
9e254ff
Preserve module sleeps and nested type identity
austinywang Jul 22, 2026
50e7f20
test: cover shell globs and split clock members
austinywang Jul 22, 2026
546bae8
Handle aliased and cross-file real clocks
austinywang Jul 22, 2026
f58a4ee
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
a2ef99b
test: cover capture aliases and target subdirectories
austinywang Jul 22, 2026
9077ef1
Resolve capture aliases across test targets
austinywang Jul 22, 2026
201e986
test: cover extension clocks and switch cases
austinywang Jul 22, 2026
685120a
Resolve extension clocks across switch cases
austinywang Jul 22, 2026
7f067cb
test: cover qualified self clock sleeps
austinywang Jul 22, 2026
8996c60
Recognize qualified self clock sleeps
austinywang Jul 22, 2026
02c9c1e
test: cover explicit standard clock initializers
austinywang Jul 22, 2026
28dcaae
Recognize explicit standard clock initializers
austinywang Jul 22, 2026
4eb3f12
test: cover tuple and inherited real clocks
austinywang Jul 22, 2026
2b9175c
Resolve tuple and inherited real clocks
austinywang Jul 22, 2026
2e51862
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
153509c
test: cover reassigned and qualified clocks
austinywang Jul 22, 2026
59b4c7d
Resolve reassigned and qualified clocks
austinywang Jul 22, 2026
85c794c
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
68b8e07
test: cover nested clock reassignments
austinywang Jul 22, 2026
9f00088
Track nested clock reassignments
austinywang Jul 22, 2026
2355fc9
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
f3af7f1
test: cover remaining sleep guard regressions
austinywang Jul 22, 2026
e0f6f11
Close remaining sleep guard gaps
austinywang Jul 22, 2026
d1150b7
test: cover typed and shadowed sleep receivers
austinywang Jul 22, 2026
d0114cc
Resolve typed and shadowed sleep receivers
austinywang Jul 22, 2026
a39e734
test: cover switch and Python alias scopes
austinywang Jul 22, 2026
a998967
Handle switch and Python alias scopes
austinywang Jul 22, 2026
a1c77d3
test: cover remaining real sleep receivers
austinywang Jul 22, 2026
e2eea86
Preserve remaining real sleep detection
austinywang Jul 22, 2026
c17dabb
test: cover namespace and chained sleep receivers
austinywang Jul 22, 2026
01cd4d8
test: correct chained receiver bundle fixture
austinywang Jul 22, 2026
83a3596
Resolve namespace and chained sleep receivers
austinywang Jul 22, 2026
dc5d7ec
test: cover defaulted and same-line sleep receivers
austinywang Jul 22, 2026
83a7e10
Handle defaulted and same-line sleep receivers
austinywang Jul 22, 2026
1b1285a
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
19bb4c4
test: cover parameter defaults and longer chains
austinywang Jul 22, 2026
fd74271
Resolve default aliases and deep clock chains
austinywang Jul 22, 2026
b29f131
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
61c38bf
test: cover typealiases and private type collisions
austinywang Jul 22, 2026
78ce1ee
Resolve Swift aliases and private type collisions
austinywang Jul 22, 2026
68afd70
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
d85ee12
Make sidebar scheduler test deterministic
austinywang Jul 22, 2026
400b322
test: cover self-qualified clock reassignment
austinywang Jul 22, 2026
aca2cbf
Track self-qualified clock reassignment
austinywang Jul 22, 2026
8fa9e87
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
19fc9bc
test: cover project-defined real clocks
austinywang Jul 22, 2026
d7ed1d0
Detect project-defined real clock sleeps
austinywang Jul 22, 2026
02ff81d
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
4335a30
Limit project clock member indexing
austinywang Jul 22, 2026
aa214c1
test: cover collected project clock members
austinywang Jul 22, 2026
83fcf31
Fix collected project clock member detection
austinywang Jul 22, 2026
4f0cfb4
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 22, 2026
fa1b0df
test: cover transitive collected clock members
austinywang Jul 23, 2026
8c5d17a
Fix transitive project clock member detection
austinywang Jul 23, 2026
2dfdf4e
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 23, 2026
1290d6b
test: cover inherited and qualified project clocks
austinywang Jul 23, 2026
2bcc4cd
Handle inherited and qualified project clocks
austinywang Jul 23, 2026
97f856a
test: cover clock identity and lexical lookup
austinywang Jul 23, 2026
3474ac3
Fix clock identity and lexical lookup
austinywang Jul 23, 2026
fa6a27f
test: cover standard clock shadows and access scope
austinywang Jul 23, 2026
3ea293c
Resolve clock identity with Swift access scope
austinywang Jul 23, 2026
2acc242
Simplify sleep determinism detection
austinywang Jul 23, 2026
056e50b
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 23, 2026
3cb53d6
test: cover direct sleep module boundaries
austinywang Jul 23, 2026
d61a6b5
Fix direct sleep module boundaries
austinywang Jul 23, 2026
0b053c5
test: cover sleep interpolation boundaries
austinywang Jul 23, 2026
082f0f8
Fix sleep API language and interpolation boundaries
austinywang Jul 23, 2026
51e9322
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 23, 2026
5d2143e
Avoid regex backtracking in sleep scan
austinywang Jul 23, 2026
d33b3ea
test: cover multiline and import sleep boundaries
austinywang Jul 23, 2026
5682224
Handle multiline and imported sleep syntax
austinywang Jul 23, 2026
17d68ab
test: cover multiline shell and Python shadows
austinywang Jul 23, 2026
53fbf0a
Track multiline shell and Python shadow syntax
austinywang Jul 23, 2026
ec3753b
test: cover shell and Python binding fast paths
austinywang Jul 23, 2026
9f4f2aa
Handle shell and Python binding fast paths
austinywang Jul 23, 2026
6849c05
test: cover scoped Python sleeps and global timers
austinywang Jul 24, 2026
b8ef5e2
Restore scoped Python sleeps and global timers
austinywang Jul 24, 2026
3d5f2d7
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
8c4ed07
test: cover Python non-binding assignments
austinywang Jul 24, 2026
c3501af
Distinguish Python assignment targets
austinywang Jul 24, 2026
bf1a0d0
test: cover shell variables and Python nested scopes
austinywang Jul 24, 2026
c38f494
Handle shell variables and Python nested scopes
austinywang Jul 24, 2026
0c6d29a
test: cover import suffixes and lambda ranges
austinywang Jul 24, 2026
765ec21
Handle import suffixes and lambda ranges
austinywang Jul 24, 2026
bbd321a
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
e87737b
test: cover Python expression and alias ordering
austinywang Jul 24, 2026
d8097a8
Use Python AST for trusted sleep detection
austinywang Jul 24, 2026
f722121
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
efa8828
test: cover determinism review edge cases
austinywang Jul 24, 2026
0487acc
Address determinism review edge cases
austinywang Jul 24, 2026
d91d085
test: cover Python statement and comprehension semantics
austinywang Jul 24, 2026
455c912
Preserve Python AST statement semantics
austinywang Jul 24, 2026
73a4e28
test: cover annotations heredocs and multiline Task sleeps
austinywang Jul 24, 2026
e047b50
Handle annotation heredoc and multiline sleep semantics
austinywang Jul 24, 2026
21dec3e
test: cover annotation heredoc and JS line breaks
austinywang Jul 24, 2026
df7658d
Preserve annotation heredoc and JS call semantics
austinywang Jul 24, 2026
d68472e
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
680fe72
test: cover determinism checker lexer edge cases
austinywang Jul 24, 2026
72a2ebe
Fix determinism checker lexer edge cases
austinywang Jul 24, 2026
f46bbc3
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
735d482
test: cover sleep token boundary edge cases
austinywang Jul 24, 2026
d3d2138
Handle Swift interpolation and sleep token boundaries
austinywang Jul 24, 2026
e4ac04e
test: cover shell and JavaScript parser boundaries
austinywang Jul 24, 2026
f7c6c7a
Harden shell and JavaScript syntax masking
austinywang Jul 24, 2026
baa46b7
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
315f96e
test: cover multiline and lexical parser edges
austinywang Jul 24, 2026
f242cab
Fix multiline and lexical sleep detection
austinywang Jul 24, 2026
3606c59
test: cover deferred scopes and mixed syntax
austinywang Jul 24, 2026
df92b7a
Isolate deferred scopes and complete syntax masking
austinywang Jul 24, 2026
e3ab12a
test: cover continuation and scope parser edges
austinywang Jul 24, 2026
e498c75
Handle continuation and assignment parser edges
austinywang Jul 24, 2026
898fb7d
test: cover shell and binding parser boundaries
austinywang Jul 24, 2026
ada583c
Preserve lexical boundaries in determinism checks
austinywang Jul 24, 2026
e629dd2
test: cover expansion and Unicode parser edges
austinywang Jul 24, 2026
e3e8c77
Track shell expansions and Python source columns
austinywang Jul 24, 2026
9525c99
test: cover composed shell grammar cases
austinywang Jul 24, 2026
9487af1
Compose shell prefix and delimiter parsing
austinywang Jul 24, 2026
2800831
test: cover deferred and continued command state
austinywang Jul 24, 2026
b429d03
Resolve deferred bindings and continued shell state
austinywang Jul 24, 2026
c53f9d7
test: cover logical command and branch boundaries
austinywang Jul 24, 2026
ebffc1c
Track logical commands and causal expressions
austinywang Jul 24, 2026
9eb383e
test: cover executable token and break states
austinywang Jul 24, 2026
6e011e7
Require executable assertions and precise break exits
austinywang Jul 24, 2026
776bb7d
test: cover comment ordering and outer scope branches
austinywang Jul 24, 2026
9cf737d
Order JavaScript masking and merge scope chains
austinywang Jul 24, 2026
ec14e3e
test: cover comment and shell argument ambiguity
austinywang Jul 24, 2026
09ce026
Disambiguate comments and shell command boundaries
austinywang Jul 24, 2026
792640e
test: cover nested case and late binding grammar
austinywang Jul 24, 2026
a1f4832
Handle nested case and late closure bindings
austinywang Jul 24, 2026
35ce820
test: cover comment lines and shell grammar state
austinywang Jul 24, 2026
3032535
Preserve executable lines and shell grammar state
austinywang Jul 24, 2026
3d095b9
test: cover nested receivers and heredoc case grammar
austinywang Jul 24, 2026
d05ce90
Track executable assertions and nested shell grammar
austinywang Jul 24, 2026
cd7f2e0
test: cover AST ends and shell pattern continuations
austinywang Jul 24, 2026
e3b9206
Use AST call ends and shell case phases
austinywang Jul 24, 2026
7501660
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 24, 2026
1e1900c
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 25, 2026
3c46e38
test: clarify synthesized animation value
austinywang Jul 25, 2026
3ee350a
test: cover determinism review regressions
austinywang Jul 25, 2026
a33af91
Fix determinism review regressions
austinywang Jul 25, 2026
32d8efa
test: cover parse fallback shadowing
austinywang Jul 25, 2026
df4d64f
Keep determinism parsing on the validated Python
austinywang Jul 25, 2026
97101df
test: cover direct standard clock sleeps
austinywang Jul 26, 2026
cb72789
Detect direct standard clock sleeps
austinywang Jul 26, 2026
96f5541
test: cover deferred Python call ordering
austinywang Jul 26, 2026
4d5fcfe
Resolve deferred Python bindings at direct calls
austinywang Jul 26, 2026
bb204a1
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 26, 2026
ce83062
test: cover scoped clock binding order
austinywang Jul 26, 2026
23d2687
Resolve scoped clocks at causal call sites
austinywang Jul 26, 2026
49da76a
test: cover qualified clocks and star imports
austinywang Jul 26, 2026
48c9aa1
Track qualified clocks and trusted star imports
austinywang Jul 26, 2026
949d302
test: cover Swift member lookup scopes
austinywang Jul 26, 2026
15fc667
Model Swift member and callable scopes
austinywang Jul 26, 2026
a55c85b
test: cover closure and compound-call shadows
austinywang Jul 26, 2026
801c1ed
Preserve closure and compound binding scopes
austinywang Jul 26, 2026
e2fc41a
test: cover branch captures and shell polls
austinywang Jul 26, 2026
a795ef4
Merge branch and loop binding states
austinywang Jul 26, 2026
c3ebd49
test: cover timer aliases and mutable clocks
austinywang Jul 26, 2026
f26fe80
Resolve timer aliases and mutable clocks
austinywang Jul 26, 2026
504da6d
test: cover mixed timer alias scopes
austinywang Jul 26, 2026
964e47c
Resolve timer aliases per lexical scope
austinywang Jul 26, 2026
3ddf9f9
test: cover namespace and ordered imports
austinywang Jul 26, 2026
228216f
Track namespace timers and ordered imports
austinywang Jul 26, 2026
05dec6e
test: cover method shadows and case polls
austinywang Jul 26, 2026
8c9fd72
Respect case patterns and method shadows
austinywang Jul 26, 2026
b625a30
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 26, 2026
06755f1
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 26, 2026
01381e7
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 27, 2026
8af200e
test: wait for screenshot recovery condition
austinywang Jul 28, 2026
d8c473b
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
441c225
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
6e36ce7
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 28, 2026
29d80e1
test: cover determinism checker scope boundaries
austinywang Jul 28, 2026
1e75f7a
fix: preserve determinism checker scope identity
austinywang Jul 28, 2026
3c3e119
test: cover resolver alias and conditional scopes
austinywang Jul 28, 2026
800fdc4
fix: preserve resolver bindings across nested scopes
austinywang Jul 28, 2026
4604e6c
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
9f1bd12
test: cover switch var and shell sleep scopes
austinywang Jul 28, 2026
549dfc0
fix: preserve sleep shadow scopes
austinywang Jul 28, 2026
e1da2a3
test: cover remaining sleep scope boundaries
austinywang Jul 28, 2026
4ce0c66
fix: respect nested sleep binding scopes
austinywang Jul 28, 2026
d4e84b0
test: cover deferred and expression sleep scopes
austinywang Jul 28, 2026
04afcbe
fix: preserve deferred and expression sleep scopes
austinywang Jul 28, 2026
f19342f
test: cover remaining determinism binding edges
austinywang Jul 28, 2026
a9ce8ea
fix: preserve reachable determinism bindings
austinywang Jul 28, 2026
168517b
test: cover timer import and wrapper binding edges
austinywang Jul 28, 2026
35fd1a3
fix: classify timer imports and shell wrappers
austinywang Jul 28, 2026
9b23367
test: cover terminating and pattern binding scopes
austinywang Jul 28, 2026
b955169
fix: preserve continuing and pattern scopes
austinywang Jul 28, 2026
1ca58a6
test: cover match reachability and env wrappers
austinywang Jul 28, 2026
62fc32d
fix: preserve match and wrapper bindings
austinywang Jul 28, 2026
7bd783f
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
c0b64bf
test: cover terminal loops and exhaustive matches
austinywang Jul 28, 2026
1f86562
fix: handle terminal loops and exhaustive matches
austinywang Jul 28, 2026
5abf4e6
test: cover exhaustive match pattern variants
austinywang Jul 28, 2026
1270f95
test: cover terminal matches and try handlers
austinywang Jul 28, 2026
d20cbb8
fix: merge only continuing Python control flow
austinywang Jul 28, 2026
87adf2f
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
b3082cf
test: cover literal while reachability in determinism check
austinywang Jul 28, 2026
b24f814
fix: model catch and literal while reachability
austinywang Jul 28, 2026
85f4835
test: cover determinism checker review gaps
austinywang Jul 28, 2026
d9ddeb9
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
6819750
test: cover shell conditional binding merges
austinywang Jul 28, 2026
9093e0f
fix: preserve determinism checker control flow
austinywang Jul 28, 2026
b8a1052
test: cover reviewer determinism scope gaps
austinywang Jul 28, 2026
22e9edf
fix: resolve timer bindings across lexical scopes
austinywang Jul 28, 2026
6e6cc02
perf: bound determinism checker indexing
austinywang Jul 28, 2026
978b0ed
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 28, 2026
cb929a7
test: cover remaining timer binding gaps
austinywang Jul 28, 2026
7966b9f
Merge branch 'main' of https://github.com/manaflow-ai/cmux into issue…
austinywang Jul 29, 2026
d9c375e
fix: resolve remaining timer binding gaps
austinywang Jul 29, 2026
8729da1
test: cover destructured timer declarations
austinywang Jul 29, 2026
0267d89
fix: share timer destructuring semantics
austinywang Jul 29, 2026
afc421e
Merge remote-tracking branch 'origin/main' into issue-8529-workflow-g…
austinywang Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ extension CmxIrohRelayCredentialCoordinatorTests {
let initialRefresh = initialExpiry.addingTimeInterval(-60)
let replacementExpiry = fixture.now.addingTimeInterval(13 * 60)
let replacementRefresh = replacementExpiry.addingTimeInterval(-60)
let expectedInitialClockEvent = TestRelayClock.Event.sleep(initialRefresh)
let expectedReplacementClockEvent = TestRelayClock.Event.sleep(replacementRefresh)
let broker = TestRelayTokenBroker(steps: [
.response(try fixture.response(
tokens: ["ghi234", "jkl234"],
Expand All @@ -42,10 +40,10 @@ extension CmxIrohRelayCredentialCoordinatorTests {
expiresAt: initialExpiry
)
)
#expect(await clockEvents.next() == expectedInitialClockEvent)
#expect(await clockEvents.next() == .sleep(initialRefresh))

clock.advance(to: initialRefresh)
#expect(await clockEvents.next() == expectedReplacementClockEvent)
#expect(await clockEvents.next() == .sleep(replacementRefresh))

#expect(await broker.observedEndpointIDs() == [fixture.identity])
#expect(await endpoint.observedRelayUpdates().count == 2)
Expand Down
48 changes: 46 additions & 2 deletions scripts/check-test-determinism.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def to_dict(self) -> dict[str, object]:
_SLEEP_CALL = re.compile(
r"""(?x)
\btime\.sleep\s*\(
| \bsleep\s*\( # sleep(...) call (C/shell function form)
| \bsleep\s*\( # qualified or unqualified sleep(...) call
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
| \busleep\s*\(
| \bnanosleep\s*\(
| Thread\.sleep\s*\(
Expand All @@ -204,6 +204,12 @@ def to_dict(self) -> dict[str, object]:
"""
)

# Swift implicit-member values such as `.sleep(deadline)` can represent enum
# data in an assertion. A receiver (`clock.sleep`, `clock?.sleep`,
# `ContinuousClock().sleep`) prevents this match, so real qualified calls
# remain candidates.
_IMPLICIT_MEMBER_SLEEP_VALUE = re.compile(r"(?<![\w)\]?!>])\.sleep\s*\(")

# The shell BARE-COMMAND sleep form (`sleep 0.3`) has no parentheses, so it can
# only be recognized positionally. It is matched ONLY in shell files: in Swift /
# Python / TS the same character sequence is almost always a quoted string
Expand Down Expand Up @@ -446,7 +452,13 @@ def _sleep_in_loop(lines: list[str], idx: int) -> bool:
def detect_sleep_then_assert(lines: list[str], idx: int, path_suffix: str) -> bool:
"""Sleep on lines[idx] followed by an assertion within 3 non-blank lines."""
line = lines[idx]
is_sleep = bool(_SLEEP_CALL.search(line))
candidate_line = line
# Ignore only bare Swift implicit-member data inside an assertion. Explicit
# APIs such as Task.sleep, asyncio.sleep, and clock.sleep remain detectable
# even when the sleep itself is nested in an assertion expression.
if _is_assertion_line(line):
candidate_line = _IMPLICIT_MEMBER_SLEEP_VALUE.sub("", line)
is_sleep = bool(_SLEEP_CALL.search(candidate_line))
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if not is_sleep and path_suffix == ".sh":
is_sleep = bool(_SHELL_BARE_SLEEP.search(line))
if not is_sleep:
Expand Down Expand Up @@ -641,6 +653,29 @@ def _self_test() -> int:
"time.sleep(0.3)\nassert widget.is_rendered()\n",
{RULE_SLEEP_THEN_ASSERT},
),
(
"tests/free_sleep.py",
"sleep(0.3)\nassert widget.is_rendered()\n",
{RULE_SLEEP_THEN_ASSERT},
),
(
"Tests/QualifiedClockTests.swift",
"try await ContinuousClock().sleep(for: .milliseconds(300))\n"
"#expect(widget.isRendered)\n",
{RULE_SLEEP_THEN_ASSERT},
),
(
"tests/assert_sleep.py",
"assert await asyncio.sleep(0.3) is None\n"
"assert widget.is_rendered()\n",
{RULE_SLEEP_THEN_ASSERT},
),
(
"Tests/OptionalClockTests.swift",
"#expect(await clock?.sleep(for: .milliseconds(300)) == nil)\n"
"#expect(widget.isRendered)\n",
{RULE_SLEEP_THEN_ASSERT},
),
(
"cmuxUITests/f.swift",
"try await Task.sleep(nanoseconds: 300_000_000)\nXCTAssertTrue(view.exists)\n",
Expand Down Expand Up @@ -783,6 +818,15 @@ def _self_test() -> int:
" time.sleep(0.3)\n"
" _must('ok' in body, body)\n",
),
# A fake-clock event named `.sleep` is data, not a real delay. The
# following assertions consume causal AsyncStream signals directly.
(
"Packages/CmuxClock/Tests/VirtualClockTests.swift",
"#expect(await clockEvents.next() == .sleep(initialRefresh))\n"
"clock.advance(to: initialRefresh)\n"
"#expect(await clockEvents.next() == .sleep(replacementRefresh))\n"
"#expect(await broker.requests() == 1)\n",
),
]

failures: list[str] = []
Expand Down
Loading