Skip to content

Commit 5dc670d

Browse files
committed
test: complete PowerShell v0.3 design corpus
1 parent 8c00fb4 commit 5dc670d

39 files changed

Lines changed: 7451 additions & 3 deletions

File tree

IMPLEMENTATION_PLAN.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ priorities.
574574
authored `Set-Alias Env:...` invocation.
575575
The generator-owned executable corpus now supports per-entry initial-
576576
state mode and includes the promoted Parallel and remote/session cases.
577+
It now contains exact generated expectations for 84 of the 90 PowerShell
578+
design cases. Four intentionally deferred condition/deferred-action cases
579+
remain parked. Two stable cases remain implementation work rather than
580+
being mislabeled as corpus-complete: bounded-loop dynamic invocation
581+
still fails atomically, and local `Invoke-Command -AsJob` still needs to
582+
reject its invalid parameter-set combination. Direct generated cases for
583+
`Measure-Command`, `Trace-Command`, and `ForEach-Object
584+
-RemainingScripts` fill the remaining stable receiver-catalog evidence
585+
without renumbering the existing corpus.
577586
Stable v0.3 stops at the delivered Start-Job, Parallel, and remote/session
578587
boundaries. Optional-module Start-ThreadJob and exact deferred
579588
breakpoint/event/completion actions are post-v0.3 catalog work; unknown

openspec/changes/v0-3-structured-shell-analysis/tasks.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
- [ ] 1.10 Promote every design case for a stable-v0.3 construct into the
1313
executable corpus as its production parser slice lands. Retain future-scope
1414
design cases as non-gating evidence rather than release work.
15+
- PowerShell now has exact generated expectations for 84 of 90 design cases.
16+
Four future-scope cases remain non-gating. The stable bounded-loop dynamic
17+
invocation and invalid local `Invoke-Command -AsJob` cases remain pending
18+
production corrections and are not marked as promoted.
1519
- [x] 1.11 Correct the PowerShell script-block boundary and lock the additive
1620
execution-region node, origin/phase/timing/cardinality facts, authored-versus-semantic
1721
ordering, command projection, and independent shell-state analysis contract
@@ -270,8 +274,10 @@
270274
- [ ] 7.6 Add adversarial cases for object-valued iterables, mutation, dynamic invocation, splatting, and cap overflow.
271275
- [ ] 7.7 Add PowerShell corpus entries, live `pwsh` oracle coverage, and Netclaw integration cases.
272276
- `PwshCorpusTool` now supports case-specific `PwshInitialStateMode`; keep
273-
promoting the remaining stable execution-region and adversarial cases into
274-
its generated manifest, then add the Netclaw PowerShell policy matrix.
277+
promoting the two remaining stable cases into its generated manifest after
278+
their production corrections, then complete the Netclaw PowerShell policy
279+
matrix. Exact generated cases now cover `Measure-Command`, `Trace-Command`,
280+
and `ForEach-Object -RemainingScripts` directly.
275281
- [x] 7.8 Implement the additive `PwshDialect` API, PowerShell 7 compatibility
276282
default, unknown-value safe-fail, Windows PowerShell 5.1 pipeline-chain
277283
rejection, dialect-specific alias and execution-region metadata, and static
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
{
2+
"name": "V03 design simple command substitution",
3+
"input": "Remove-Item $(Get-Item target.txt)",
4+
"powerShellInitialStateMode": "IsolatedNonInteractiveNoProfile",
5+
"expected": {
6+
"isUnparseable": false,
7+
"clauses": [
8+
{
9+
"operator": "None",
10+
"verb": [
11+
"Get-Item"
12+
],
13+
"args": [
14+
{
15+
"raw": "target.txt",
16+
"kind": "Literal",
17+
"isPath": true,
18+
"resolved": "C:/work/target.txt"
19+
}
20+
],
21+
"redirects": [],
22+
"elements": [
23+
{
24+
"raw": "Get-Item",
25+
"value": "Get-Item",
26+
"role": "Verb",
27+
"sourceStart": 14,
28+
"sourceLength": 8,
29+
"precedingVerbElementCount": 0,
30+
"kind": "Literal",
31+
"isFlag": false,
32+
"isPath": false
33+
},
34+
{
35+
"raw": "target.txt",
36+
"value": "target.txt",
37+
"role": "Argument",
38+
"sourceStart": 23,
39+
"sourceLength": 10,
40+
"precedingVerbElementCount": 1,
41+
"kind": "Literal",
42+
"isFlag": false,
43+
"isPath": true,
44+
"resolved": "C:/work/target.txt"
45+
}
46+
]
47+
},
48+
{
49+
"operator": "None",
50+
"verb": [
51+
"Remove-Item"
52+
],
53+
"args": [
54+
{
55+
"raw": "$(Get-Item target.txt)",
56+
"kind": "DynamicSkip",
57+
"isPath": false
58+
}
59+
],
60+
"redirects": [],
61+
"elements": [
62+
{
63+
"raw": "Remove-Item",
64+
"value": "Remove-Item",
65+
"role": "Verb",
66+
"sourceStart": 0,
67+
"sourceLength": 11,
68+
"precedingVerbElementCount": 0,
69+
"kind": "Literal",
70+
"isFlag": false,
71+
"isPath": false
72+
},
73+
{
74+
"raw": "$(Get-Item target.txt)",
75+
"value": "$(Get-Item target.txt)",
76+
"role": "Argument",
77+
"sourceStart": 12,
78+
"sourceLength": 22,
79+
"precedingVerbElementCount": 1,
80+
"kind": "DynamicSkip",
81+
"isFlag": false,
82+
"isPath": false
83+
}
84+
]
85+
}
86+
],
87+
"syntax": [
88+
{
89+
"kind": "Block",
90+
"parentIndex": null,
91+
"region": "Unknown",
92+
"childIndex": null,
93+
"sourceStart": 0,
94+
"sourceLength": 34,
95+
"clauseIndex": null,
96+
"groupKind": null,
97+
"listOperator": null
98+
},
99+
{
100+
"kind": "SimpleCommand",
101+
"parentIndex": 0,
102+
"region": "Root",
103+
"childIndex": 0,
104+
"sourceStart": 0,
105+
"sourceLength": 34,
106+
"clauseIndex": 1,
107+
"groupKind": null,
108+
"listOperator": null
109+
},
110+
{
111+
"kind": "CommandSubstitution",
112+
"parentIndex": 1,
113+
"region": "Substitution",
114+
"childIndex": 0,
115+
"sourceStart": 12,
116+
"sourceLength": 22,
117+
"clauseIndex": null,
118+
"groupKind": null,
119+
"listOperator": null
120+
},
121+
{
122+
"kind": "Block",
123+
"parentIndex": 2,
124+
"region": "Substitution",
125+
"childIndex": 0,
126+
"sourceStart": 14,
127+
"sourceLength": 19,
128+
"clauseIndex": null,
129+
"groupKind": null,
130+
"listOperator": null
131+
},
132+
{
133+
"kind": "SimpleCommand",
134+
"parentIndex": 3,
135+
"region": "Statement",
136+
"childIndex": 0,
137+
"sourceStart": 14,
138+
"sourceLength": 19,
139+
"clauseIndex": 0,
140+
"groupKind": null,
141+
"listOperator": null
142+
}
143+
],
144+
"commands": [
145+
{
146+
"clauseIndex": 0,
147+
"immediateRole": "Substitution",
148+
"isComplete": true,
149+
"ancestry": [
150+
{
151+
"ancestorKind": "Block",
152+
"region": "Root",
153+
"childIndex": 0,
154+
"sourceStart": 0,
155+
"sourceLength": 34
156+
},
157+
{
158+
"ancestorKind": "CommandSubstitution",
159+
"region": "Substitution",
160+
"childIndex": 0,
161+
"sourceStart": 12,
162+
"sourceLength": 22
163+
},
164+
{
165+
"ancestorKind": "Block",
166+
"region": "Statement",
167+
"childIndex": 0,
168+
"sourceStart": 14,
169+
"sourceLength": 19
170+
}
171+
],
172+
"effectiveArguments": [],
173+
"workingDirectory": {
174+
"kind": "Exact",
175+
"values": [
176+
"C:/work"
177+
],
178+
"pattern": null,
179+
"coveringDirectory": null
180+
}
181+
},
182+
{
183+
"clauseIndex": 1,
184+
"immediateRole": "Ordinary",
185+
"isComplete": true,
186+
"ancestry": [
187+
{
188+
"ancestorKind": "Block",
189+
"region": "Root",
190+
"childIndex": 0,
191+
"sourceStart": 0,
192+
"sourceLength": 34
193+
}
194+
],
195+
"effectiveArguments": [
196+
{
197+
"clauseElementIndex": 1,
198+
"value": {
199+
"kind": "Unknown",
200+
"values": [],
201+
"pattern": null,
202+
"coveringDirectory": null
203+
}
204+
}
205+
],
206+
"workingDirectory": {
207+
"kind": "Exact",
208+
"values": [
209+
"C:/work"
210+
],
211+
"pattern": null,
212+
"coveringDirectory": null
213+
}
214+
}
215+
]
216+
},
217+
"notes": "Promotes stable design case pwsh-simple-command-substitution."
218+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"name": "V03 design literal substitution spellings",
3+
"input": "Write-Output \u0027$(Get-Date)\u0027 \u0022literal \u0060$(Get-Location)\u0022",
4+
"powerShellInitialStateMode": "IsolatedNonInteractiveNoProfile",
5+
"expected": {
6+
"isUnparseable": false,
7+
"clauses": [
8+
{
9+
"operator": "None",
10+
"verb": [
11+
"Write-Output"
12+
],
13+
"args": [
14+
{
15+
"raw": "\u0027$(Get-Date)\u0027",
16+
"kind": "Literal",
17+
"isPath": false
18+
},
19+
{
20+
"raw": "\u0022literal \u0060$(Get-Location)\u0022",
21+
"kind": "Literal",
22+
"isPath": false
23+
}
24+
],
25+
"redirects": [],
26+
"elements": [
27+
{
28+
"raw": "Write-Output",
29+
"value": "Write-Output",
30+
"role": "Verb",
31+
"sourceStart": 0,
32+
"sourceLength": 12,
33+
"precedingVerbElementCount": 0,
34+
"kind": "Literal",
35+
"isFlag": false,
36+
"isPath": false
37+
},
38+
{
39+
"raw": "\u0027$(Get-Date)\u0027",
40+
"value": "$(Get-Date)",
41+
"role": "Argument",
42+
"sourceStart": 13,
43+
"sourceLength": 13,
44+
"precedingVerbElementCount": 1,
45+
"kind": "Literal",
46+
"isFlag": false,
47+
"isPath": false
48+
},
49+
{
50+
"raw": "\u0022literal \u0060$(Get-Location)\u0022",
51+
"value": "literal $(Get-Location)",
52+
"role": "Argument",
53+
"sourceStart": 27,
54+
"sourceLength": 26,
55+
"precedingVerbElementCount": 1,
56+
"kind": "Literal",
57+
"isFlag": false,
58+
"isPath": false
59+
}
60+
]
61+
}
62+
],
63+
"syntax": [
64+
{
65+
"kind": "Block",
66+
"parentIndex": null,
67+
"region": "Unknown",
68+
"childIndex": null,
69+
"sourceStart": 0,
70+
"sourceLength": 53,
71+
"clauseIndex": null,
72+
"groupKind": null,
73+
"listOperator": null
74+
},
75+
{
76+
"kind": "SimpleCommand",
77+
"parentIndex": 0,
78+
"region": "Root",
79+
"childIndex": 0,
80+
"sourceStart": 0,
81+
"sourceLength": 53,
82+
"clauseIndex": 0,
83+
"groupKind": null,
84+
"listOperator": null
85+
}
86+
],
87+
"commands": [
88+
{
89+
"clauseIndex": 0,
90+
"immediateRole": "Ordinary",
91+
"isComplete": true,
92+
"ancestry": [
93+
{
94+
"ancestorKind": "Block",
95+
"region": "Root",
96+
"childIndex": 0,
97+
"sourceStart": 0,
98+
"sourceLength": 53
99+
}
100+
],
101+
"effectiveArguments": [],
102+
"workingDirectory": {
103+
"kind": "Exact",
104+
"values": [
105+
"C:/work"
106+
],
107+
"pattern": null,
108+
"coveringDirectory": null
109+
}
110+
}
111+
]
112+
},
113+
"notes": "Promotes stable design case pwsh-literal-substitution-spellings."
114+
}

0 commit comments

Comments
 (0)