Skip to content

PR 6: corpus completeness + AstAssert.Equal + PII audit#9

Merged
Aaronontheweb merged 1 commit into
devfrom
pr6-corpus-polish
May 10, 2026
Merged

PR 6: corpus completeness + AstAssert.Equal + PII audit#9
Aaronontheweb merged 1 commit into
devfrom
pr6-corpus-polish

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Owner

Summary

PR 6 of the v0.1.0-alpha shipping plan. Brings the corpus to 115 entries (target was ≥105 per SPEC §13), polishes the AstAssert.Equal helper with diff-friendly failure messages, and adds the PII audit [Fact] required for v0.1.0-alpha release acceptance.

What landed

  • tests/.../Corpus/AstAssert.cs — polished structural-equality helper. Path-prefixed messages like clauses[1].args[2].kind: expected DynamicSkip, actual Literal make CI failures actionable. CorpusRunnerTests refactored to delegate (~140 lines of inline comparison removed).
  • tests/.../Corpus/PiiAuditTests.cs[Fact] scans every Corpus/bash/*.json for SPEC §14 forbidden patterns. Allowlists generic placeholders (user, test, foo, dev, runner, gh-actions, ci) and repo names (sample-repo, project, repo). Reports all hits in one failure for easy cleanup.
  • 15 new corpus entries:
    • 101-110 (10 quote-handling): single-quoted literal, double-quoted with \$HOME, escaped quotes, mixed-style triple, FileVerb with quoted path
    • 111-115 (5 unparseable): process substitution <(cmd) and >(cmd), case keyword, while loop, function name { ... } form
  • SPEC.md §13 corpus location updated to canonical tests/ShellSyntaxTree.Tests/Corpus/bash/*.json; stale references in §14/§15/§17 fixed for consistency.

SPEC §13 coverage (115 / 105 minimum)

Category Target Have PR
Simple-verb 10 10 (01-10) PR 3
Multi-token-verb 10 10 (11-20) PR 3
Compound 15 15 (21-35) PR 3
cd-in-compound 10 10 (71-80) PR 5
Quote-handling 10 10 (101-110) PR 6
Redirect 10 10 (36-45) PR 3
Subshell 10 10 (81-90) PR 5
bash -c 10 10 (91-100) PR 5
Dynamic-skip 10 10 (51-60) PR 4
Per-verb path-rule 10 10 (61-70) PR 4
Unparseable 10 10 (46-50, 111-115) PRs 3 + 6
Total ≥105 115

Verification

  • dotnet build -c Release — clean (0 warnings)
  • dotnet test -c Release353/353 passing (was 337)
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify
  • openspec validate v0.1-locked-interpretations --strict
  • ✅ Public API surface unchanged (PublicApiSnapshotTests 18/18)

Test plan

  • CI passes on Test-ubuntu-latest
  • CI passes on Test-windows-latest

v0.1.x follow-ups (tracked in tasks.md)

  • Single-quote 'literal \$HOME': v0.1 substitutes uniformly; bash semantics differ
  • LooksLikePath trailing-backslash heuristic edge case
  • Sentinel Raw=\"<dynamic-cwd>\" formalization in SPEC §9
  • Diagnostic precedence in SPEC §11

Next

PR 7 — package icon + RELEASE_NOTES.md + version bump. Auto-merge but pause before tag push per the plan; the v0.1.0-alpha → nuget.org publish is irreversible.

Brings the corpus to **115 entries** (target was ≥105 per SPEC §13),
introduces a polished AstAssert.Equal helper with diff-friendly failure
messages, and adds the PII audit Fact required for v0.1.0-alpha
release acceptance.

What's added:
- tests/.../Corpus/AstAssert.cs:
  * Equal(expected, actual, fileName) — structural deep-equality with
    path-prefixed XunitException messages, e.g.
    "clauses[1].args[2].kind: expected DynamicSkip, actual Literal"
  * Dump() diagnostic for shape inspection
  * CorpusRunnerTests refactored to delegate (~140 lines of inline
    comparison removed)

- tests/.../Corpus/PiiAuditTests.cs:
  * Single [Fact] walks every Corpus/bash/*.json
  * Applies SPEC §14 regex patterns to input/notes/raw fields only
    (skips synthetic resolved paths and sentinels)
  * Allowlists generic placeholders (user, test, foo, dev, runner,
    gh-actions, ci) and repo names (sample-repo, project, repo)
  * Reports all hits in a single failure with file paths

Corpus additions:
- bash/101..110_*.json (10 quote-handling): single-quoted literal,
  double-quoted with $HOME, escaped quotes, mixed-style triple, FileVerb
  with quoted path, etc.
- bash/111..115_*.json (5 unparseable): process substitution <(cmd) and
  >(cmd), case keyword, while loop, function name { ... } form

Total: 115 entries spanning all SPEC §13 categories.

SPEC.md updates:
- §13 corpus location: tests/Corpus/bash/* → tests/ShellSyntaxTree.Tests/Corpus/bash/*
  (the canonical path locked by interpretation #7)
- Stale references in §14, §15, §17 acceptance criteria fixed for
  consistency

Tests: 353/353 passing (was 337). Public API surface unchanged;
PublicApiSnapshotTests still 18/18 green.

PR 6 follow-ups tracked in tasks.md:
- Single-quote $HOME substitution (corpus 104 pins v0.1 behavior;
  bash semantics differ — v0.1.x candidate)
- LooksLikePath trailing-backslash quirk (corpus 109 pins;
  v0.1.x heuristic tightening candidate)
- Sentinel <dynamic-cwd> Raw value formalization in SPEC §9
- Diagnostic precedence ordering in SPEC §11 (case-with-paren-arg case)
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 10, 2026 19:34
@Aaronontheweb Aaronontheweb merged commit b16c80a into dev May 10, 2026
2 checks passed
@Aaronontheweb Aaronontheweb deleted the pr6-corpus-polish branch May 10, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant