S16 Phase 3, slice 2: griff swang expand — law 1 by construction - #119
Conversation
The program's export owns the only musical output; an inspection command does not get a second path to own. Expansion-time diagnostics follow $1.5: NodePath for structural (node root for the whole-grid check), the source word's span for score-borne facts, the owning word's span for time-domain errors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
parse_with_spans returns the Program plus the four locations $1.5's layers render expansion-time diagnostics at: the quoted kernel literal, the unit and tail values, the quoted source literal. A side table, not AST fields — Program equality and the roundtrip law stay span-free. Two failing tests: the spans slice the reference source to the owning words, and both entry points are one parser. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
parse_with_spans threads the four owning-word spans out of the existing descent (the tokens were already in hand and thrown away); parse() becomes its span-dropping wrapper. 53/53. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
…rt renders them compile_pattern_flaws is the same pipeline returning PatternFlaw — each variant named by the vocabulary site that owns the fix (kernel, unit, score geometry, density, the budget with its NodePath intact, the lowering, the silent expansion and window). compile_pattern becomes its transport renderer: into_transport() reproduces today's codes, flags, and messages byte-for-byte, so $1.5's 'core emits pure data, frontends render' finally holds where it was being violated. No behavior change; all 19 transport contract tests untouched and green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
…cations Five failing tests: the program equivalent to a Phase-2 CLI command produces a byte-identical expansion JSON (one compiler, one artifact); a structural budget breach is SWG0201 at 'node root' — the NodePath is the location; a unit that does not divide the 7/8 bar is SWG0301 at the unit word on line 7, not at a flag that no longer exists; the silent --bars window and the rejected tail speak program vocabulary — 'bars' and 'rest_pad', no retired flags, no transport spellings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
expand parses with the span table, loads the program's own source
score, and drives the same compile_pattern_flaws the transport drives
— so law 1's byte parity is a property of construction, and the test
proves it end to end against --emit-rhythm-expansion. The artifact
goes to stdout: export owns the only musical output.
Flaws render at $1.5's layers: SWG0201/0202 carry their NodePath
('node root' for the whole-grid check, dotted indices otherwise);
SWG0304/0305 sit at the source word; unit flaws at the unit value;
the rejected tail at the tail value, advising the program's own
rest_pad; the silent window speaks 'bars' — no retired flags, no
transport spellings. 11/11 CLI, the wall clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
📝 WalkthroughWalkthroughSwang gains span-aware parsing, typed rhythm compilation failures, and a new ChangesSwang expansion flow
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49b6e7b439
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…executable The spec said 'the source word's span' while the implementation stored the value's — the review resolved the ambiguity in the value's favor: the path literal identifies the offending score, and the keyword never changes (unit and tail already point at values). The spec now says 'the quoted source value's span', and the one uncovered branch of the expansion layer gets its executable verdict: a meter-change MIDI (4/4 to 7/8 at bar 1, encoded independently in the test) drives SWG0304 to exactly <file>:9:16 — the opening quote of the source path — with no INPUT and no transport flags in sight. The rhythm_pattern module doc also stops claiming errors leave only as PatternDiagnostics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
|
Blocker closed at head 40fe6c3, one docs+test commit as prescribed:
No other changes: no path-resolution semantics, no fuzzing, no generation integration. Gate: fmt/clippy clean, the only local failure remains the known locale golden. |
What
The second Phase 3 slice:
griff swang expandruns a program's pattern pipeline up tomap_rhythmand prints the canonicalgriff.pattern-expansionJSON to stdout (the program'sexportowns the only musical output; an inspection command does not get a second path to own — spec updated first).Strict red→green per commit:
docs(swang): the expand contract — stdout, and expansion-time diagnostic locations by §1.5's layers.test(swang): red+ green —parse_with_spans: a side table with the four owning-word spans (kernel literal,unit,tail,source). Not AST fields:Programequality and the roundtrip law stay span-free;parse()becomes the span-dropping wrapper. One parser, two entry points.refactor(cli):compile_pattern_flaws→PatternFlaw— the pattern compiler now fails as typed data named by the vocabulary site that owns the fix (kernel / unit / score geometry / density / budget-with-NodePath/ lowering / silent expansion / silent window).compile_patternbecomes its transport renderer:into_transport()reproduces today's codes, flags, and messages byte-for-byte. §1.5's "core emits pure data, frontends render" now holds where it was being violated. No behavior change — all 19 transport contract tests untouched.test(cli): red+ green — five laws forexpand:--emit-rhythm-expansionoutput, and guaranteed by construction (both frontends drive the samecompile_pattern_flaws).error[SWG0201] (<file>: node root): …— the whole-grid check breaks at the root; dotted child indices otherwise.sourcevalue, time-domain at the owning value: a unit that does not divide the 7/8 bar isSWG0301at<file>:7:<col>— the unit value's span, not a flag that no longer exists.barswindow and the rejected tail advisebarsandrest_pad— no--rhythm-*, norest-pad.Law status after this slice
Fuzz targets (ADR-0010) follow
build— the last Phase 3 slice.Known local-only failure:
missing_file_goldenon Russian-locale Windows (pre-existing).After merge
Phase 3 slice 3 red:
griff swang build— law 5: understrategy autobyte-parity withgriff generateat the same seeds; under a named strategy, the first ranked candidate of that strategy from the unchanged ranked set, written to the program's ownexport.🤖 Generated with Claude Code
https://claude.ai/code/session_01NkqJUU6d1sW1RAfvyHrqVM
Summary by CodeRabbit
New Features
griff swang expandto compile rhythm patterns and print the canonical expansion JSON to stdout.Documentation
check | fmt | expand | buildbehavior and where diagnostics point.Bug Fixes
swang expandoutput matches existing generation transport results.