Skip to content

Add core validation, generation, slicing, feature extraction, and workspace metadata - #2

Merged
PhysShell merged 1 commit into
claude/music-core-cli-setup-C2zXhfrom
codex/-1
May 18, 2026
Merged

Add core validation, generation, slicing, feature extraction, and workspace metadata#2
PhysShell merged 1 commit into
claude/music-core-cli-setup-C2zXhfrom
codex/-1

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Motivation

  • Provide robust, validated core musical types and helpers so higher-level components can reason about pitches, durations, tempos, and time signatures safely.
  • Add deterministic phrase generation, tick-range slicing, and phrase-level feature extraction to support scheduling, analysis, and generation workflows.
  • Unify workspace metadata (readme, keywords, categories) across workspace members for packaging and registry consumption.

Description

  • Extend core::event with ValidationError, MIDI_7_BIT_MAX, constructors and checked operations (Pitch::new, Velocity::new, Tempo::new, TimeSignature::new, Ticks::checked_add/checked_sub), Bar::duration, Phrase::duration, and make Event::duration a const fn, plus many unit tests covering validation and aggregation.
  • Add core::feature implementing phrase_features which computes counts, total duration, pitch and velocity spans and returns PhraseFeatures with tests.
  • Add core::generate implementing deterministic generate_repeating_phrase, bar_duration_ticks, request/ pattern types, validation, and tests for generation edge cases.
  • Add core::slice implementing TickRange, TimedEvent, timed_bar_events, timed_phrase_events, and slice_phrase_events with associated tests for slicing and absolute timing.
  • Export new modules from core::lib, update package manifests (Cargo.toml files) to include readme, keywords, and categories workspace metadata and enable workspace propagation, and add a generated Cargo.lock.

Testing

  • Ran unit tests for the core package with cargo test -p griff-core verifying event, feature, generate, and slice behaviors and edge cases, and all tests passed.
  • Ran workspace tests with cargo test --workspace to ensure integration across members and packaging metadata changes, and the test suite completed successfully.

Codex Task

@PhysShell
PhysShell merged commit 6e71956 into claude/music-core-cli-setup-C2zXh May 18, 2026
PhysShell pushed a commit that referenced this pull request Jun 3, 2026
The follow-up P2 commit re-blessed both 80x20 terminal goldens by hand because
its environment could not fetch crates (ratatui CONNECT 403), so the tests never
ran. The guessed frames were one column off on the section-band row: under the
new ceiling-division `fit`, the Solo section marker shifts by one column, which
the blind re-bless did not capture, and both characterization tests failed.

Regenerated both goldens from the actual rendered output and verified the full
preview suite (50 passed) and `cargo test --workspace` green, with fmt/clippy
clean. The code fixes themselves (#1 right-edge note skip, #2 ceiling fit, #3
all-voice bar classification) were correct and compile; only the goldens were
wrong.

https://claude.ai/code/session_016RxVPiPMnFjyV8HmepFWAT
PhysShell pushed a commit that referenced this pull request Jun 21, 2026
…stence)

Promotes the web curation dock that ADR-0024/0026 deferred ("web curation —
later") to a concrete architecture over the shared UI core:

- extract griff-ui-core (ADR-0016's "when egui arrives" step); the piano-roll
  keeps the strict Scene/Intent boundary, the dock is deliberately domain-aware
- egui as Scene renderer #2 (eframe, native + wasm), absorbing the M1 playground
- OPFS *.chunk.json tree + in-wasm manifest fold — browser corpus == CLI files
- RightsInfo.redistributable as a typed export gate, shared with the CLI
- ADR-0025 wasm-bindgen toolchain reused unchanged; native-first slice plan;
  JS front retired only at capture-parity

Status: Proposed. Registered in the ADR index.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
PhysShell added a commit that referenced this pull request Jul 29, 2026
…-circuit

Regressions for the second exact-head re-review (fail against 6375e8b):

#1 the whole artifact JSON graph must reject foreign fields, not only the plan
   root — rogue fields planted at every depth:
   - ledger_rejects_unknown_field_at_root / _in_batch / _in_event
   - ledger_rejects_unknown_field_in_action_payload (proves the *actual* serde
     version denies inside an internally-tagged variant, not just the attribute)
   - ledger_rejects_unknown_field_in_split_target
   - plan_rejects_unknown_field_in_embedded_batch
   (plan_rejects_unknown_field_in_assignment already passes — Assignment is
   strict — kept as boundary coverage.)

#2 verify_plan must refuse a structurally invalid embedded batch *before* digest,
   fingerprint, or replay:
   - verify_plan_short_circuits_on_invalid_batch asserts only the structural
     refusal is returned, never UnknownDecisionSource / PlanDigestMismatch /
     DecisionDigestMismatch / DecisionProjectionMismatch.

#3 an intra-batch duplicate event_id must be emitted exactly once:
   - intra_batch_duplicate_event_id_emitted_once (validate_ledger currently
     double-counts it via validate_batch + its own pass).

Logic unchanged, so these are RED.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012T7SRMiXmZe5v1imtrKMPi
PhysShell added a commit that referenced this pull request Jul 29, 2026
#1 strict JSON across the whole artifact graph. deny_unknown_fields now also on
   DecisionsLedger, DecisionBatch, DecisionEvent, Action (internally tagged; the
   serde 1.0.229 in the lockfile denies rogue fields inside a variant payload
   while still accepting the `kind` tag — proven by
   ledger_rejects_unknown_field_in_action_payload), and SplitTarget. A foreign
   field at any depth is now rejected, not silently discarded before digesting.

#2 verify_plan short-circuits a structurally invalid embedded batch:
   validate_batch(&plan.decision_batch)? runs first, so an invalid ordinal or a
   duplicate event_id refuses before any digest, fingerprint, or replay — the
   removed mid-function validate_batch no longer let those run.

#3 an intra-batch duplicate event_id is emitted exactly once. validate_batch's
   positional check is split out (batch_order_errors); validate_ledger runs that
   per batch plus a single ledger-wide event_id uniqueness pass, so a duplicate
   (intra- or cross-batch) is reported once, not twice. Standalone validate_batch
   keeps its ordering + intra-batch-uniqueness contract.

Includes an incidental rustfmt pass over the RED tests added in the previous
commit. 45/45 tests pass; clippy (all=deny, pedantic=warn) and fmt clean under nix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012T7SRMiXmZe5v1imtrKMPi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant