diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 871c4955a..c9c70d513 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -66,6 +66,11 @@ jobs: timeout-minutes: 50 steps: - uses: actions/checkout@v4 + - name: M2.5 active production owner collision guard (cheap / existing runner) + if: ${{ github.event_name == 'pull_request' }} + env: + GH_TOKEN: ${{ github.token }} + run: node scripts/check_workstream_ownership.mjs - name: Cheap canonical Console v6 puzzle socket gate (no JUCE) run: node scripts/check_console_puzzle.mjs - name: Stop incomplete integrated product promotion before JUCE checkout diff --git a/.github/workflows/ui-smoke.yml b/.github/workflows/ui-smoke.yml index c04be840b..88b3e0c7f 100644 --- a/.github/workflows/ui-smoke.yml +++ b/.github/workflows/ui-smoke.yml @@ -20,6 +20,7 @@ on: - 'tests/wire_main_native_handoff_contract.test.cjs' - 'tests/ci_workflow_efficiency_test.mjs' - 'tests/approved_native_m2_contract.test.cjs' + - 'scripts/check_workstream_ownership.mjs' - 'scripts/build_ui_css.py' - '.github/workflows/ui-smoke.yml' - '.github/workflows/pages-publish.yml' @@ -30,6 +31,7 @@ on: - 'site/**' - 'AR-MIX-Live-FX-Host-Standalone-v0.3.html' - 'scripts/build_pages.py' + - 'scripts/check_workstream_ownership.mjs' - 'scripts/build_ui_css.py' - 'tests/*.py' - 'tests/gui_workflow_contract_test.mjs' @@ -64,6 +66,11 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.12" + - name: M2.5 active production owner collision guard (cheap / existing runner) + if: ${{ github.event_name == 'pull_request' }} + env: + GH_TOKEN: ${{ github.token }} + run: node scripts/check_workstream_ownership.mjs - name: Cheap canonical Console v6 puzzle socket gate run: node scripts/check_console_puzzle.mjs - name: Stop incomplete integrated product promotion before browser setup @@ -79,7 +86,7 @@ jobs: node --check web/plugin-ui.js node --check web/mixer-io.js node --check web/mixer-layout.js - node --test tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs tests/approved_native_m2_contract.test.cjs + node --test tests/workstream_ownership_guard.test.mjs tests/gui_workflow_contract_test.mjs tests/plugin_ui_contract_test.mjs tests/ci_workflow_efficiency_test.mjs tests/fx_drag_reorder_contract_test.mjs tests/mixer_io_operator_contract_test.mjs tests/mixer_shell_contract_test.mjs tests/approved_native_m2_contract.test.cjs - name: Validate approved GUI checkpoint and single publisher run: python tests/gui_baseline_lock_test.py - name: CSS V28 zero-regression source-order recovery (every GUI CI run) diff --git a/AGENTS.md b/AGENTS.md index 6c65e2fcb..41a969525 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,3 +30,7 @@ The archival `docs/GUI_BASELINE_LOCK_2026-10-25.md` remains available only for r - [Smart Audio Engine Implementation Blueprint](docs/SMART_AUDIO_ENGINE_IMPLEMENTATION_BLUEPRINT.md) - [Dry physical crackle #15](https://github.com/masarray/arsonmix/issues/15) These remain for device-clock, render-discontinuity and hardware FAT engineering only. Their old GUI v0.8 descriptions do not override the sole **/preview/** GUI. + +## M2.5 — mandatory cross-thread ownership (issue #399) + +**Before coding:** inspect current `main`, PR owner branches and [M2.5 reconciliation ledger](https://github.com/masarray/arsonmix/issues/399). Do NOT create another GUI/native bridge/PCM/release-gate implementation while an open PR owns that subsystem. ENGINE #266 is the **sole** PCM/VST3 owner; #396 owns native GUI IIFE/gesture fixes; #398 owns release admission; #270 owns FAT-only evidence. #395's parallel M2 transport is superseded by merged #394 and must not be integrated as another controller. #393's GUI source migration must not overwrite approved M2 bridge. New PRs are checked for active owner conflicts by `scripts/check_workstream_ownership.mjs` (no extra runner), enforced from PR #400. Check exact HEAD and communicate by comments on issue #399. Do not claim the checker detects unsaved actions in other chat threads. diff --git a/docs/workstreams/M2_5_RECONCILIATION.md b/docs/workstreams/M2_5_RECONCILIATION.md new file mode 100644 index 000000000..82eab2fc9 --- /dev/null +++ b/docs/workstreams/M2_5_RECONCILIATION.md @@ -0,0 +1,35 @@ +# M2.5 — REPOSITORY / ARCHITECTURE RECONCILIATION + +**Authoritative progress ledger:** https://github.com/masarray/arsonmix/issues/399 +**Baseline:** `main@c1a11afd145380a944c9844937ccb6a97b5e0557` (M2 #394 merged, one approved /preview/). +**Purpose:** prevent concurrent ChatGPT threads from creating competing GUI, bridge, native PCM, or FAT implementations. + +## Ownership (one authoring branch per runtime subsystem) + +| Runtime scope | Sole active owner | Work retained | Conflict disposition | +|---|---|---|---| +| GUI visible DOM/CSS/PNG | Approved /preview/ source, GUI #393 | only existing visual, no redesign | #393 consolidation deferred until joined native stable; port without overwriting current bridge | +| GUI↔native accepted state | M2 #394 merged; #396 repairs original IIFE/gesture | one `approved-native-contract.js`, one `approved-native-bridge.js` | #395 alternate M2 controller redundant; preserve unique validations, retire duplicate producer | +| JUCE callback, PCM graph, VST3 lease | #266 only (WIRE #387 absorbed) | dynamic ChannelId/EdgeId PCM; CH1 10CH+4AUX compatibility | FAT #270 and WASAPI #251 must not bulk overwrite engine | +| Pre-release admission | #398 | canonical /preview/ & callback gates | no competing puzzle/release check | +| Windows UAT/FAT | #270 testing only + #15 physical rig | exact joined SHA Windows bundle/PCM/VST3/device measurements | no engine or GUI implementation owned by FAT | +| WASAPI reliability | #251 after #266 cutover | 0 FX dry path crackle evidence | do not parallel-edit `LiveAudioEngine.h` | +| FactoryFX sibling plugin packaging | #225 | signed/manifests/release watch | no engine callback or GUI replacement | + +## How threads coordinate + +1. **Before editing:** read `main`, `AGENTS.md`, issue #399, open PRs, and exact current HEAD. If a PR owns your files/domain, contribute there or add a handoff; **do not create another production path**. +2. **Every PR:** identify one owner, base SHA, changed production domains, native GUI parity, current CI, and the PR it supersedes. +3. **Merge order:** unique GUI scope correction #396 → integrate #266 on CURRENT main (with Main.cpp event handlers and M2 native asset producer retained) → #398 source/release gate → #270 FAT-only evidence. #393 byte-identical source cleanup can follow sound cutover. Order may change based on tests, never by bulk merge. +4. **At merge:** verify exact-head Windows + Chromium, graph/ACK/snapshot test, rejected/stale PCM behavior, no second callback/renderer. Hardware certification is independent. Close or explicitly mark superseded work after its unique tests are ported. +5. **CI efficiency:** `scripts/check_workstream_ownership.mjs` is a cheap step in existing workflows (no new runners). PR ≤ #399 gets actionable warnings; new PR ≥ #400 fails if it overlaps an OPEN owner's production domain. Workflow/CMake shared junctions are warnings requiring manual review, not an artificial blocker. + +For live auditing on a PR checkout: +```sh +node scripts/check_workstream_ownership.mjs +node --test tests/workstream_ownership_guard.test.mjs +``` + +**Limits:** CI detects cross-PR workstream overlap, not actual concurrent unsaved edits in another ChatGPT session. Branch protection/rulesets require GitHub repository admin access; passing CI alone cannot enforce merging on an unprotected `main`. + +**Definition of done:** current baseline, unambiguous active owners, no duplicate bridge owner, exact-head qualified joined engine+GUI, FAT still PENDING until hardware evidence. No GUI changes for M2.5. diff --git a/scripts/check_workstream_ownership.mjs b/scripts/check_workstream_ownership.mjs new file mode 100644 index 000000000..7ac01d74c --- /dev/null +++ b/scripts/check_workstream_ownership.mjs @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// M2.5: fail *new* PRs that duplicate the LIVE implementation owner. +// This is a cheap control-plane check, never a DSP implementation. +// Existing PRs <= #399 are advisory until their unique work is absorbed. +import {readFileSync} from 'node:fs'; +import {fileURLToPath} from 'node:url'; + +export const POLICY_ISSUE=399; +export const STRICT_FROM_PR=400; + +// Shared junction files (CMake/workflows) require review, but are not an +// automatic rejection: GUI, engine and FAT genuinely have to meet here. +const SHARED=/^(?:\.github\/workflows\/|CMakeLists\.txt$|scripts\/(?:package_native_windows|verify_native_windows_artifact)\.ps1$)/; +const REGIONS=[ + ['engine', /^(?:engine\/|src\/(?:LiveAudioEngine|LiveDryRoutingLab|ConsoleLiveBridgeV6|ApprovedNativeV8Projection|NativeVerifiedSourcePatch|NativeDryShowRecall|NativeLiveShowCapture|NativeShowSaveWorker)\.(?:h|cpp)$)/], + ['host', /^src\/(?:Main|ApprovedConsoleNativeTransportV6|ApprovedConsoleM2Snapshot)\.(?:h|cpp)$/], + ['native-gui-bridge', /^(?:web\/approved-native-(?:bridge|contract|m2-state)\.js|scripts\/build_approved_native_gui\.py)$/], + ['approved-gui', /^(?:site\/preview(?:\/|-v2\/|-buttons\/)|scripts\/build_pages\.py$)/], + ['release-admission', /^scripts\/(?:check_console_puzzle|check_approved_native_gui_release)\.mjs$/], + ['hardware-fat', /^scripts\/(?:collect_hardware_fat_windows\.ps1|console_v6_fat_gate\.mjs)$/], +]; +const FORBIDDEN_NEW=/^web\/(?:console-native\.(?:html|css|js)|index\.html)$/; + +export function region(path) { + for(const [label,re] of REGIONS)if(re.test(path))return label; + return null; +} +function filesOf(pr) { + return (pr.files||[]).map(v=>typeof v==='string'?{filename:v,status:'modified'}:v) + .filter(v=>typeof v?.filename==='string'); +} +export function auditWorkstreams(current, openPrs) { + const files=filesOf(current), ours=new Set(files.map(f=>f.filename)); + const mine=new Map(); + for(const f of files) { + const label=region(f.filename); + if(label) { + if(!mine.has(label))mine.set(label,[]); + mine.get(label).push(f.filename); + } + } + const hard=[], advisory=[]; + for(const f of files) { + if(FORBIDDEN_NEW.test(f.filename) && f.status!=='removed') + hard.push({reason:'rejected-alternative-GUI',file:f.filename,other:null}); + } + for(const other of openPrs) { + if(other.number===current.number || other.state==='closed')continue; + const theirs=filesOf(other),otherRegions=new Map(); + for(const f of theirs) { + const label=region(f.filename); + if(label) { + if(!otherRegions.has(label))otherRegions.set(label,[]); + otherRegions.get(label).push(f.filename); + } + // Renames can be a hidden transfer of a protected path. + if(typeof f.previous_filename==='string') { + const previous=region(f.previous_filename); + if(previous) { + if(!otherRegions.has(previous))otherRegions.set(previous,[]); + otherRegions.get(previous).push(f.previous_filename); + } + } + } + for(const [label,paths] of mine) { + if(otherRegions.has(label))hard.push({ + reason:'duplicate-'+label,file:paths[0],other:other.number, + overlapping:otherRegions.get(label)[0], + }); + } + const otherFiles=new Set(theirs.flatMap(f=>[f.filename,f.previous_filename].filter(Boolean))); + for(const path of ours) { + if(SHARED.test(path)&&otherFiles.has(path)) + advisory.push({reason:'shared-merge-junction',file:path,other:other.number}); + } + } + return {hard,advisory,enforced:Number(current.number)>=STRICT_FROM_PR}; +} +async function json(url,token) { + const response=await fetch(url,{headers:{ + 'Accept':'application/vnd.github+json', + 'User-Agent':'ArSonMix-M2.5-ownership-check', + ...(token?{'Authorization':'Bearer '+token}:{}) + },signal:AbortSignal.timeout(18000)}); + if(!response.ok)throw Error('GitHub PR metadata unavailable: HTTP '+response.status+ + ' / '+url.split('?')[0]); + return response.json(); +} +async function remotePRs(repo,token) { + const root='https://api.github.com/repos/'+repo; + const prs=await json(root+'/pulls?state=open&per_page=100',token); + if(prs.length===100)throw Error('Cannot certify overlap: >99 open PRs (pagination required)'); + return Promise.all(prs.map(async pr=>{ + const files=[]; + for(let page=1;page<=5;page++) { + const a=await json(root+'/pulls/'+pr.number+'/files?per_page=100&page='+page,token); + files.push(...a.map(f=>({filename:f.filename,status:f.status, + previous_filename:f.previous_filename}))); + if(a.length<100)break; + if(page===5)throw Error('PR #'+pr.number+' exceeds 500 changed files'); + } + return {number:pr.number,title:pr.title,state:pr.state,files}; + })); +} +export async function main() { + if(process.argv.includes('--test-fixture')) { + const at=process.argv.indexOf('--test-fixture'); + const bundle=JSON.parse(readFileSync(process.argv[at+1],'utf8')); + const out=auditWorkstreams(bundle.current,bundle.open); + console.log(JSON.stringify(out,null,2)); + if(out.enforced&&out.hard.length)process.exitCode=1; + return; + } + const eventPath=process.env.GITHUB_EVENT_PATH; + if(!eventPath){console.log('M2.5 ownership check: no PR event, skipping.');return;} + const event=JSON.parse(readFileSync(eventPath,'utf8')); + const number=event.pull_request?.number; + if(!Number.isInteger(number)){console.log('M2.5: non-PR event; skip.');return;} + const repo=process.env.GITHUB_REPOSITORY; + if(!/^[\w.-]+\/[\w.-]+$/.test(repo||''))throw Error('Invalid GITHUB_REPOSITORY'); + const prs=await remotePRs(repo,process.env.GH_TOKEN||process.env.GITHUB_TOKEN); + const current=prs.find(x=>x.number===number); + if(!current)throw Error('Cannot certify overlap: current PR #'+number+' not in open PRs'); + const report=auditWorkstreams(current,prs); + const notify=(severity,entry)=>{ + const text='M2.5 '+entry.reason+' '+entry.file+ + (entry.other?' vs PR #'+entry.other+' ('+entry.overlapping+')':'')+ + ' · see #'+POLICY_ISSUE; + console.log('::'+severity+'::'+text); + }; + for(const item of report.advisory)notify('warning',item); + for(const item of report.hard)notify(report.enforced?'error':'warning',item); + console.log('M2.5 #'+number+': '+report.hard.length+' production ownership conflicts, '+ + report.advisory.length+' shared junctions; '+ + (report.enforced?'STRICT':'ADVISORY (legacy PR)')+ + '; no new workflow, no extra runner.'); + if(report.enforced&&report.hard.length)process.exitCode=1; +} +if(process.argv[1]&&fileURLToPath(import.meta.url)===process.argv[1]) { + main().catch(err=>{console.error('::error::M2.5 ownership check: '+err.message);process.exitCode=1;}); +} diff --git a/tests/workstream_ownership_guard.test.mjs b/tests/workstream_ownership_guard.test.mjs new file mode 100644 index 000000000..a8ed596d9 --- /dev/null +++ b/tests/workstream_ownership_guard.test.mjs @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: AGPL-3.0-only +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {auditWorkstreams,region,STRICT_FROM_PR,POLICY_ISSUE} + from '../scripts/check_workstream_ownership.mjs'; +const pr=(number,files,state='open')=>({number,files,state}); +test('M2.5 recognizes ALL existing runtime owner boundaries',()=>{ + assert.equal(POLICY_ISSUE,399);assert.equal(STRICT_FROM_PR,400); + for(const [file,owner] of [ + ['engine/core/DynamicAcceptedSession.h','engine'], + ['src/LiveAudioEngine.h','engine'], + ['src/ConsoleLiveBridgeV6.h','engine'], + ['src/Main.cpp','host'], + ['web/approved-native-contract.js','native-gui-bridge'], + ['web/approved-native-bridge.js','native-gui-bridge'], + ['scripts/build_approved_native_gui.py','native-gui-bridge'], + ['site/preview-v2/index.html','approved-gui'], + ['site/preview/index.html','approved-gui'], + ['scripts/build_pages.py','approved-gui'], + ['scripts/check_console_puzzle.mjs','release-admission'], + ['scripts/collect_hardware_fat_windows.ps1','hardware-fat'], + ['tests/new_file_test.cpp',null], + ['docs/workstreams/M2_5_RECONCILIATION.md',null] + ])assert.equal(region(file),owner,file); +}); +test('new PR cannot create second native bridge while #396/#395 still own it',()=>{ + const now=pr(400,['web/approved-native-bridge.js']); + const open=[pr(396,['web/approved-native-bridge.js']), + pr(395,['web/approved-native-m2-state.js'])]; + const result=auditWorkstreams(now,open); + assert.equal(result.enforced,true); + assert.equal(result.hard.length,2); + assert.ok(result.hard.every(x=>x.reason==='duplicate-native-gui-bridge')); +}); +test('same engine DOMAIN, even distinct files, collides with #266',()=>{ + const out=auditWorkstreams(pr(401,['engine/core/NewAudioCallback.h']),[ + pr(266,['src/LiveAudioEngine.h','engine/core/DynamicAcceptedSession.h']), + pr(270,['engine/core/PreparedMixerBlock.h']) + ]); + assert.deepEqual(out.hard.map(x=>x.other),[266,270]); +}); +test('legacy PRs get actionable warnings, not endless CI cancellations',()=>{ + const out=auditWorkstreams(pr(396,['web/approved-native-bridge.js']),[ + pr(395,['web/approved-native-bridge.js']) + ]); + assert.equal(out.enforced,false);assert.equal(out.hard.length,1); +}); +test('coordinating docs/workflow overlap is review-only, not another engine owner',()=>{ + const out=auditWorkstreams(pr(400,[ + '.github/workflows/p1-windows.yml','AGENTS.md', + 'docs/workstreams/M2_5_RECONCILIATION.md' + ]),[ + pr(266,['.github/workflows/p1-windows.yml','src/LiveAudioEngine.h']), + pr(393,['.github/workflows/ui-smoke.yml']) + ]); + assert.equal(out.enforced,true); + assert.equal(out.hard.length,0); + assert.equal(out.advisory.length,1); +}); +test('retired closed PR no longer blocks real native work',()=>{ + const out=auditWorkstreams(pr(401,['web/approved-native-bridge.js']),[ + pr(395,['web/approved-native-bridge.js'],'closed') + ]); + assert.equal(out.hard.length,0); +}); +test('new alternate console renderer is rejected; deletion is allowed',()=>{ + const alt='web/console-native.html'; + assert.equal(auditWorkstreams(pr(401,[{filename:alt,status:'added'}]),[]).hard.length,1); + assert.equal(auditWorkstreams(pr(401,[{filename:alt,status:'removed'}]),[]).hard.length,0); +}); +test('renamed protected path cannot bypass domain collision',()=>{ + const out=auditWorkstreams(pr(401,['site/preview/index.html']),[ + pr(393,[{filename:'archive/preview-old.html',previous_filename:'site/preview-v2/index.html', + status:'renamed'}]) + ]); + assert.equal(out.hard.length,1); +});