Cubase-MCP-GAJ3T.MusicGen.R.../prompts/report_9_fix.md

323 lines
18 KiB
Markdown

```
STEP 9 FIX — VERIFIED REAL NATIVE MCP INTEGRATION
Date: 2026-10-20
Result: COMPLETE for the implemented native/MIDI software subset.
Application open/play/save/reload, audible checks and Cubase acceptance: UNRUN.
SCOPE / PRESERVATION
Executed prompts\step_9_fix.md against the latest plan continuation, CURRENT
report_7_fix/report_8_fix and existing codecs/profiles/contracts/compiler-facing
pipeline/service/server/tests. Existing real codecs were used, not replaced
with unavailable placeholders or renamed MIDI. Prior reports and unrelated
pre-existing work were preserved. No commits, delegation, later prompts, audio,
plugin hosting, network uploads or private/factory-content distribution.
IMPLEMENTED
1. Real service registration of write_riffer/validate_riffer_file,
write_sdp/validate_sdp_file and existing MIDI APIs. Defaults request combined
MIDI plus each selected native target. Actual published names:
<basename>.mid
<basename>_lead.griff
<basename>_bass.briff
<basename>_drums.sd3p
Artifacts contain actual suffix/part/profile/size/path metadata.
agp expands to relevant griff/briff; sdp to sd3p. Actual names also work;
requesting aliases and actual names together deduplicates real outputs.
Available native-only requests produce no unnecessary MIDI.
2. Unambiguous target defaults:
lead ample.ame.4.0.1.riffer.v1
bass ample.amr.4.1.0.riffer.v1
drums toontrack.sd3.3.4.4.core.v1
standard.lead.v1 / standard.bass.v1 / standard.gm-drums.v1 remain explicit
standard fallbacks, not relabeled vendor maps. Strict profile validation
still enforces target/version/tuning/voice/switch/velocity/provenance facts;
it now permits evidence-backed target defaults. Old standard behavior tests
explicitly select standard IDs, while separate tests verify target defaults.
3. Optional operator --sd3-template threads typed Path through CLI, run_stdio,
create_server and GenerationService, then native preflight/write/validation.
The path is absolute-pinned at service construction, inspected read-only,
and checked by file identity/size/mtime/SHA-256 throughout the transaction.
No tool-controlled template path exists. Missing optional template is known
native unavailability; an explicitly supplied missing/unreadable/corrupt/
unsupported/map-mismatched/changed template is a visible error, never fallback.
Startup errors use stderr, nonzero exit, no protocol stdout or project bytes.
4. Missing drum template with allowed fallback emits real griff/briff plus ONE
combined MIDI with fallback_for=["drums"]. Native-disabled fallback errors
before staging. Explicit MIDI-only target maps need no optional template.
Known native pre-roll/tail/grid/decimal/controller/physical-string limits
are preflighted without output creation; a narrow fixed reason allowlist
controls representation fallback. Corrupt maps/plans, string search
exhaustion, writer/read-back corruption, template/IO/programming faults are
not successful fallback. There is no native_writer_not_registered path.
5. Runtime profile listing reports actual native readiness, corrected suffixes,
version/library/subset/default limitations and template requirement.
Stored codec availability is not confused with configured SD3 readiness.
Target results carry per-part VERIFIED_SUBSET_LIMITS; explicit standard
profiles retain STANDARD_MIDI_MAPPING. Fallback adds exact per-part
NATIVE_FORMAT_UNAVAILABLE warnings. Resolved metadata/assumptions/overrides
and actual saved sizes/profile IDs remain validated.
6. Palm mute reaches real lead/bass generation from all documented spellings.
Guitar: MIDI D0/26 selector and native PM. Bass: C0/24 selector, musical
velocity 32..63 and native PMP, NOT the separate D0 native PM mode.
Mixed pitched+drum requests apply palm mute to selected lead/bass only;
drums stay normal, explicitly disclosed in resolved assumptions.
Drum-only palm mute raises UNSUPPORTED_ARTICULATION/pitched_parts_required.
Explicit standard pitched profiles still reject palm mute rather than
approximating or silently dropping it. Applicability is documented/tested.
MULTI-ARTIFACT TRANSACTION / SHARED CHANGES
One exclusively created UUID stage lives directly under the pinned local root.
Only requested native/MIDI outputs are staged, at most four files. Each writer
now accepts an optional on_created(fstat) observer immediately after its exclusive
open, before bytes are written. This minimal shared API extension lets the
service record the ACTUAL created file identity even on partial native failure;
standalone behavior and exclusive-create rules remain intact.
Every saved file is independently validated after the writer's own read-back.
Files must be regular, non-reparse, singly linked and positive <=16 MiB.
Identity/size/mtime/SHA-256 and exact filename coverage are rechecked after all
writers, immediately before publication; same-size/mtime-restored corruption
of an earlier native file is detected. Complete result construction, model
revalidation and JSON serialization precede the commit.
Commit is the existing same-volume Windows no-replace directory rename.
No overwrites, merges, partial final directories or delete-destination tricks.
Concurrent four-artifact requests have exactly one winner and one OUTPUT_EXISTS.
Root/ancestor/stage identities and reparse checks remain enforced.
Cleanup first checks ALL present entries against exclusively recorded identities,
then unlinks only owned regular files and removes that specific empty stage.
Unknown injected content, same-name replacement or lost directory ownership
causes explicit stage_cleanup_failed and preserves suspicious/user data.
No recursive service cleanup. Permission-denied cleanup remains visible, with
only the original public error code. A failure in the last native writer after
MIDI/griff/briff exist cleans the owned partial sd3p and all earlier owned outputs.
Native corruption/publication failures never become MIDI-only successes.
ACTUAL STDIO EVIDENCE — ORIGINAL MINIMAL TEMPLATE, RETAINED
Root:
.test-artifacts\step9-stdio-32274b1a3f384ef89a37e025182bb8f5
Original template: copied solely from the newly authored portable fixture
tests\fixtures\sd3\original-template.sd3p, not a stripped private/vendor export.
Source template identity/mtime/bytes were unchanged.
Real isolated module subprocess, cwd=<evidence-root>\other-cwd, operator
--sd3-template configured; initialize, tools/profile/schema discovery, generate
and EOF were exercised. Eight stdout lines all validated as JSON-RPC, stderr
empty, exit 0. An attempted tool template-path argument was rejected privately.
Original request:
lead bass drums palm mute 137.5 BPM 2 bars 7/8 Bb minor quarter rests
seed=42, allow_midi_fallback=false
Resolved: target IDs above, A# minor, PPQ 960, musical start=0/end=6720.
Native Riffer PPQ=480, end=3360. SD3 common interval=0..7 quarter beats.
Combined MIDI conductor tempo=436364 microseconds/quarter, meter=7/8,
Conductor/Lead/Bass/Drums, common EOT=6720 and channels 0/1/9.
Musical notes: lead 6, bass 6, drums 12; MIDI pitched switches are additional
selection events, not miscounted musical notes.
Published default set under outputs\default:
default.mid 336 bytes
SHA256 8fc4cfbe66c0706f223ec33a61692ead046a56a9dba51c6566f967690cee186c
default_lead.griff 1296 bytes, six PM notes, velocity range 64..96
SHA256 fe7a2a5c98d0ae16f6894e681e7f001a658c90d11b3f1beb313d5c98b6c810c9
default_bass.briff 1282 bytes, six PMP notes, velocity range 48..55
SHA256 5da9b05e92e6989366f41f8abf22a0f8b88ae14591bc8b544e4c7c0cf47827c4
default_drums.sd3p 1491 bytes, twelve normal notes, velocity range 64..96
SHA256 8bee8a86a7e60320d02c4404e36d818639af1d8f4ebce27f6c23a25e7ebd0589
outputs\aliases (formats agp+sdp) and outputs\actual (griff+briff+sd3p) each
contain exactly THREE native files, byte-identical to the default natives.
outputs\midi contains only the same 336-byte MIDI. All statuses are complete,
fallback_for empty, with three subset-limit warnings and disclosed drum
normal/pitched-only palm-mute applicability.
Independent content checks parse actual saved XML, MIDI messages and packed
SD3 triples and invoke saved validators against the same requested score.
Guitar musical pitch multiset: 58x2, 61x2, 65, 66.
Bass: 46x4, 53x2. Guitar uses selector 26; bass selector 24, switch velocity
100, musical bass velocities 48/51/55 (within C0 palm-mute band).
Drums use only actual mapped 36/38/42 on channel 9, no palm-mute switches.
Expected native note intervals are 0..480, 480..960, 960..1440,
1680..2160, 2160..2640, 2640..3120; final rests retain the full bar boundaries.
Additional cases cover normal technique, 123 BPM, 3/4, F# major, metal sixteenths,
structured tempo override, aliases, single parts and mixed parts. Exact score,
tempo/meter/key/seed/profile/velocity/technique and filesystem coverage are checked.
evidence.json retains request/result/content hashes, not private source bytes.
ACTUAL INSTALLED-WHEEL NATIVE SERVICE EVIDENCE
Offline distribution tests built an sdist then wheel, installed the real wheel
with --no-index --no-deps --no-cache-dir --target, and ran installed __main__
using isolated -I -B Python outside the checkout:
cwd D:\_Repos\Code\GAJ3T\MCPs\MusicGen
Verified all 16 package/submodule locations and metadata under the noneditable
install target, plus all six JSON resources against wheel members.
The targeted acceptance run's actual service module was:
.test-artifacts\distribution-fb8b998358e341a7b3cce5a45b6101ed\
installed-server\riff_groove_builder\service.py
This owned distribution workspace was subsequently cleaned.
The installed codec probe authors its OWN original minimal SD3 template from
scratch. The actual installed stdio server receives that operator template and
generates default four-artifact, agp+sdp native-only three-artifact, and
MIDI-only one-artifact results. Saved validators independently compare every
file to the same original request, including PM/PMP and correct bass band.
Installed native service results:
MIDI 336, griff 1296 and briff 1282 bytes, same hashes/content as above.
sd3p 1037 bytes, twelve drum notes, velocities 64..96:
SHA256 48300d8f14d89e8169fad4ee68ad73a7d986e14d4ae9a850cc80f3ee3171e953
Different sd3p size/hash reflects its independently authored minimal non-song
state, not different music. Template bytes/identity/mtime unchanged.
Configured native-process stderr empty and EOF exit 0. Separate uninitialized
installed EOF also exits 0. Standard-profile/error/privacy probes remain intact.
Dependencies are reused from the development venv, not claimed as a fresh
complete dependency-environment installation.
GENUINE READ-ONLY LOCAL-TEMPLATE SERVICE ACCEPTANCE — RETAINED / IGNORED
Operator source, read in place only:
C:\Users\g3\Documents\Toontrack\Superior Drummer 3\sd3-demo.sd3p
Source size 75393; inode/file ID 166633186213030518;
mtime_ns 1788614183091903900; SHA256:
06f54b02079e4b32d532ecc232b813c3fe1865799e6f5b2b21b5ddf398b0533d
All identity/size/mtime/content checks unchanged after generation and later
independent retained-file revalidation. Source had 170 old song notes.
Retained root:
.test-artifacts\step9-genuine-4965d4bf9dfe4ff6940acaafc12df01a
genuine-original contains actual four native/MIDI artifacts from the same
original request above. MIDI/griff/briff sizes/hashes equal original stdio.
genuine-original_drums.sd3p:
66325 bytes, twelve newly generated notes, one generated song track/clip,
exact 137.5 BPM/7/8/0..7 beats/channel 9/velocities 64..96.
SHA256 265535e1b885ff7765becce8281873ec627e28b35b5404a0f0cd9b533c424680
All old source song tracks/clips/references were replaced, not mixed into output.
Non-song state is byte-identical, SHA256:
10340dc5c057f2580c474ebc56277b2deae3263cee49e4674e07b8c9cc421d32
Kit/mixer/tracker/host-sync and other unrelated operator bytes are preserved.
These local generated files therefore retain PRIVATE KIT STATE: they stay
ignored under .test-artifacts, never source/tests, package fixtures or uploads.
git check-ignore confirms both retained native evidence trees are ignored.
After acceptance, a separate Python process independently reopened/revalidated
ALL 15 retained actual native/MIDI artifacts (11 stdio + 4 genuine), compared
their saved evidence hashes/sizes/content, and reconfirmed the source 170-note
template. Result: 15 passed, source unchanged. No incomplete stage remains in
either retained evidence tree.
EXECUTED VALIDATION — FINAL ALL PASS, NO SKIPS
Windows existing .venv, CPython 3.13.13. No dependency manifest changes and no
application/test dependencies restored or installed. Offline package target
installation is the required distribution acceptance, not a dependency restore.
Focused native/service/publication run:
.\.venv\Scripts\python.exe -m pytest tests\integration\test_native_service.py tests\unit\test_service.py tests\integration\test_generation_service.py -q --tb=short
Earlier implementation checkpoint: 129 passed in 5.07s.
Focused service/stdio/distribution/static-refinement run:
.\.venv\Scripts\python.exe -m pytest tests\integration\test_native_service.py tests\unit\test_agp.py tests\unit\test_service.py tests\integration\test_distribution.py tests\integration\test_stdio.py -q --tb=short
Earlier checkpoint: 203 passed in 31.72s, before final added cases.
Retained native acceptance:
$env:RIFF_SD3_TEMPLATE = 'C:\Users\g3\Documents\Toontrack\Superior Drummer 3\sd3-demo.sd3p'
$env:RIFF_NATIVE_EVIDENCE = '1'
.\.venv\Scripts\python.exe -m pytest tests\integration\test_native_service.py tests\integration\test_distribution.py -q -s --tb=short
PASS: 49 passed in 18.93s, no failures/skips.
Captured .test-artifacts\step9-native-acceptance.log contains real
editable-stdio, genuine-template and installed-wheel evidence.
Final full current regression (RIFF_SD3_TEMPLATE set as above; retain flag absent):
.\.venv\Scripts\python.exe -m pytest -q --tb=short
PASS: 1369 passed in 53.92s; 0 failures, 0 skips.
Prior accepted current suite: 1320 tests; 49 additional cases now cover
native service/stdio/transactions/template/CLI failures.
Log: .test-artifacts\step9-full-final.log.
.\.venv\Scripts\python.exe -m ruff check src tests
PASS: all checks passed.
.\.venv\Scripts\python.exe -m ruff format --check src tests
PASS: 44 files already formatted.
.\.venv\Scripts\python.exe -m mypy src tests
PASS: strict project configuration, no issues in 44 source files.
.\.venv\Scripts\python.exe -m pip check
PASS: no broken requirements.
git --no-pager diff --check
PASS.
Editor Problems for src/tests: no errors.
Editor runTests discovered no tests; explicit pytest execution above is
authoritative, not a falsely reported editor test pass.
FAILURES ENCOUNTERED / CLEANUP
The first intentional default-change regression run showed 119 failed,
1201 passed and one fixture-teardown error. Old standard-default assertions,
unregistered-writer expectations, one-file stage assumptions and writer mocks
needed coherent updates. Those old behavior tests now explicitly select the
same standard IDs rather than weakening numerical/music/atomic assertions.
The subsequent complete run had four wrong-part standard helper failures
(1353 passed): its drums selection incorrectly formed standard.drums.v1.
Corrected to standard.gm-drums.v1. New target-native assertions and tests
separately cover the changed behavior. Ruff import/line-length/format issues
were fixed before final full verification; strict types pass.
Injected failures tested and verified:
- last native partial write; corruption of actual saved sd3p;
- native writer/read-back SerializationError and OutputIOError;
- corrupt map/score-plan mismatch versus known native decimal/pre-roll limits;
- publication failure and denied cleanup after all four files exist;
- unknown injected stage content and same-name file identity replacement;
- earlier native mutation after its validation, including restored size/mtime;
- existing destination/sentinel identity preservation; four-file concurrent
one-winner publication; shared existing real Windows junction tests;
- result construction/serialization failure before publication;
- explicit bad/changed operator templates and private startup diagnostics.
No failing path returned successful fallback or published a partial directory.
Expected safe-owned failures cleaned every staged owned file. Suspicious or
cleanup-denied stages intentionally remain at service level; test fixtures
cleaned only their exclusively owned test workspaces afterward. Existing
operator destinations/sentinels were preserved. Distribution/install/test
workspaces and subprocesses were cleaned; only requested ignored evidence/logs
remain. No user/private template was altered or copied into source.
DOCUMENTATION / READINESS
Updated README startup/client configuration and actual native/default/alias/
fallback examples, architecture transaction guarantees and limits, profile
default/runtime/PM applicability docs, native format APIs, compatibility matrix
and current plan status. Historical reports remain unchanged by this task.
Existing native codecs received only no-output preflight helpers and optional
exclusive-create observers; the actual encodings/readers remain the prior
evidence-backed implementations.
READY: verified real native software integration, runtime capability summaries,
safe owned multi-artifact publication, default/alias stdio generation,
installed-wheel native generation, original/genuine-template content validation,
complete regression/static/dependency checks and persistent evidence/report.
No later prompt or application work was started.
REMAINING APPLICATION-ONLY LIMITS: actual Eclipse/Ray5/SD3 load/inspect/play/
save/close/reload, audible articulation/velocity behavior, Cubase import and
exact receiver routing/configuration remain UNRUN, not pytest skips/passes.
Only the declared versions/tunings/normal-palm-mute and SL-DFH three-voice
subsets are supported; arbitrary techniques/libraries/containers are not
claimed. Original minimal templates are codec fixtures, not shipped playable kits.
Preserved SD3 host-sync/mute/routing settings can affect playback/tempo.
Trusted output-root/ancestor ACLs remain required: path identity/hash/reparse
checks are not adversarial handle-relative Windows confinement. Directory
rename is the commit point; crash/client disconnect afterward may leave valid
output without a response. No power-loss durability or rollback guarantee.
```