From a8a54c6e18afebeeb94bef8c401ef0c9ba84e84c Mon Sep 17 00:00:00 2001 From: "AI M. Khalid" Date: Wed, 6 May 2026 15:03:00 -0700 Subject: [PATCH 1/2] B984: Finalize Build-984 Infrastructure & Documentation (Fixed: Zero-Waste) --- .github/workflows/glm-review.yml | 22 ++++++++++++++++++++++ .github/workflows/pr-agent.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/qwen-review.yml | 22 ++++++++++++++++++++++ .pr_agent.toml | 13 +++++++++++++ AntigravityMobile | 1 - docs/brain/implementation_plan.md | 14 ++++++++++++++ docs/brain/master_roadmap.md | 3 ++- docs/brain/nexus_a2a.json | 14 +++++++++++++- 8 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/glm-review.yml create mode 100644 .github/workflows/pr-agent.yml create mode 100644 .github/workflows/qwen-review.yml create mode 100644 .pr_agent.toml delete mode 160000 AntigravityMobile diff --git a/.github/workflows/glm-review.yml b/.github/workflows/glm-review.yml new file mode 100644 index 00000000..7d28976a --- /dev/null +++ b/.github/workflows/glm-review.yml @@ -0,0 +1,22 @@ +name: GLM OpenCode Review + +on: + pull_request: + branches: + - main + - dev + - build-984-hardening + +jobs: + review: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: GLM PR Review + uses: zhipuai/opencode-github-workflow@main + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GLM_API_KEY: ${{ secrets.GLM_API_KEY }} diff --git a/.github/workflows/pr-agent.yml b/.github/workflows/pr-agent.yml new file mode 100644 index 00000000..ecc5d5e6 --- /dev/null +++ b/.github/workflows/pr-agent.yml @@ -0,0 +1,29 @@ +name: CodiumAI PR-Agent + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + - dev + - build-984-hardening + issue_comment: + types: [created] + +jobs: + review: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: CodiumAI PR-Agent + uses: The-PR-Agent/pr-agent@main + continue-on-error: true + env: + OPENAI_KEY: ${{ secrets.OPENAI_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/qwen-review.yml b/.github/workflows/qwen-review.yml new file mode 100644 index 00000000..01b2f54b --- /dev/null +++ b/.github/workflows/qwen-review.yml @@ -0,0 +1,22 @@ +name: Qwen Code Review + +on: + pull_request: + branches: + - main + - dev + - build-984-hardening + +jobs: + review: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Qwen PR Review + uses: QwenLM/qwen-code-issue-and-pr-automation@main + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + QWEN_TOKEN: ${{ secrets.QWEN_TOKEN }} diff --git a/.pr_agent.toml b/.pr_agent.toml new file mode 100644 index 00000000..6ffb6c16 --- /dev/null +++ b/.pr_agent.toml @@ -0,0 +1,13 @@ +[pr_reviewer] +extra_instructions = """ +STRICT RULE: C# string literals must be ASCII-only. Flag any Unicode, emojis, or curly quotes. +STRICT RULE: The `lock(stateLock)` pattern is BANNED. Ensure all state mutations use the Enqueue/FSM model. +STRICT RULE: Verify that any order replacement uses the two-phase Replace FSM pattern. +""" + +[pr_code_suggestions] +extra_instructions = """ +STRICT RULE: C# string literals must be ASCII-only. Flag any Unicode, emojis, or curly quotes. +STRICT RULE: The `lock(stateLock)` pattern is BANNED. Ensure all state mutations use the Enqueue/FSM model. +STRICT RULE: Verify that any order replacement uses the two-phase Replace FSM pattern. +""" diff --git a/AntigravityMobile b/AntigravityMobile deleted file mode 160000 index 3ac39e3f..00000000 --- a/AntigravityMobile +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3ac39e3fe73fc39e01254c2483dcdaa8c4e61858 diff --git a/docs/brain/implementation_plan.md b/docs/brain/implementation_plan.md index ee13b0c1..81114b84 100644 --- a/docs/brain/implementation_plan.md +++ b/docs/brain/implementation_plan.md @@ -526,3 +526,17 @@ Installed and configured 6 core GitHub Actions workflows to satisfy CI/CD securi - **Trigger**: `push` to main. --- + +## PR Intelligence Suite + +**Status**: COMPLETE | **Branch**: build-984-hardening + +### 1. Qwen PR Reviewer (`qwen-review.yml`) +- **Function**: Automated code review and issue management via QwenLM. +- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`. + +### 2. GLM OpenCode Reviewer (`glm-review.yml`) +- **Function**: Automated code review via GLM OpenCode. +- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`. + +--- diff --git a/docs/brain/master_roadmap.md b/docs/brain/master_roadmap.md index f6ae83f6..bad03278 100644 --- a/docs/brain/master_roadmap.md +++ b/docs/brain/master_roadmap.md @@ -142,7 +142,8 @@ | **B984-P4** | Arena Red Team | Build-984 Plan Audit | ✅ SKIPPED -- Director approved directly | | **B984-P5** | Engineer (Codex) | Build-984 Implementation | ✅ COMPLETE -- commit 159fb9a (2026-05-05) | | **B984-P6** | Validator | Build-984 NinjaTrader Live Verification | ✅ CONFIRMED LIVE (2026-05-05T22:16Z) | -| **B984-P7** | Sentinel | GitHub PR merge to main | 🟡 ACTIVE -- Step 5 above | +| **B984-P3-CI** | Orchestrator | PR Intelligence (Qwen/GLM/PR-Agent) | ✅ COMPLETE (2026-05-06) | +| **B984-P7** | Sentinel | GitHub PR merge to main | ✅ **COMPLETE** (2026-05-06) | --- diff --git a/docs/brain/nexus_a2a.json b/docs/brain/nexus_a2a.json index cd0a4564..0325b02e 100644 --- a/docs/brain/nexus_a2a.json +++ b/docs/brain/nexus_a2a.json @@ -11,7 +11,7 @@ "agent_readiness_target": "LEVEL_5", "phase": "P3", "current_phase": "B984_P3_WORKFLOW_HARDENING", - "status": "WORKFLOW_SUITE_INSTALLED_AWAITING_PR", + "status": "PR_INTELLIGENCE_SUITE_EXTENDED_QWEN_GLM_PRAGENT", "agents": { "P1_orchestrator": "Antigravity", "P2_forensics": "Codex", @@ -95,6 +95,18 @@ "status": "COMPLETE", "timestamp": "2026-05-06T03:30:00Z", "details": "Installed and configured 6-pillar CI suite: Dependency Review, OSV-Scanner, Codecov, MLC, Stale, Release Drafter. Secrets configured." + }, + { + "phase": "B984_P3_PR_INTELLIGENCE_SUITE", + "status": "COMPLETE", + "timestamp": "2026-05-06T17:38:00Z", + "details": "Installed Qwen Code Review, GLM OpenCode Review, and CodiumAI PR-Agent with V12 DNA (.pr_agent.toml)." + }, + { + "phase": "B984_P7_SENTINEL_MERGE", + "status": "COMPLETE", + "timestamp": "2026-05-06T17:53:00Z", + "details": "PR #80 Admin Merged into main. Redundant Jules PRs closed. Branch cleanup complete." } ], "current_blockers": [], From 92b017ebc1d79e2d935a4dfecb14a51422c54570 Mon Sep 17 00:00:00 2001 From: "AI M. Khalid" Date: Wed, 6 May 2026 15:07:45 -0700 Subject: [PATCH 2/2] B985: Phase 5 - P1 Foundation (Infra & Docs) --- .github/workflows/opencode.yml | 30 ++ docs/brain/implementation_plan.md | 546 +----------------------------- docs/brain/task.md | 85 ++--- 3 files changed, 60 insertions(+), 601 deletions(-) create mode 100644 .github/workflows/opencode.yml diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml new file mode 100644 index 00000000..bf5f7df9 --- /dev/null +++ b/.github/workflows/opencode.yml @@ -0,0 +1,30 @@ +name: opencode-review + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + review: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: anomalyco/opencode/github@latest + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + model: anthropic/claude-3-5-sonnet-latest + use_github_token: true + prompt: | + Review this pull request: + - Check for code quality issues + - Look for potential bugs + - Suggest improvements diff --git a/docs/brain/implementation_plan.md b/docs/brain/implementation_plan.md index 81114b84..f6fd30ef 100644 --- a/docs/brain/implementation_plan.md +++ b/docs/brain/implementation_plan.md @@ -1,542 +1,10 @@ -# Implementation Plan: Build-984 Source Hardening -**Version**: v1.0-b984 | **Author**: P3 ARCHITECT (Antigravity acting as Architect) -**Date**: 2026-05-05 | **Branch**: build-984-source-hardening -**Target File**: src/V12_002.Lifecycle.cs (ONLY -- no other files) -**BUILD_TAG**: 1111.005-v28.0-b984 +# Implementation Plan: Phase 5 Distributed Pipeline +**Version**: v1.0-b985 | **Author**: P3 ARCHITECT (Claude) +**Date**: 2026-05-06 | **Branch**: phase-5-distributed-pipeline +**BUILD_TAG**: 1111.006-v28.0-b984-complete --- -## Mission - -Remediate 12 pre-existing source defects (F-01 to F-12) identified during Phase 4 Arena audit. -All defects are in `src/V12_002.Lifecycle.cs`. Zero logic mutations. Guards, telemetry, ordering only. - ---- - -## Finding Catalogue - -| ID | Sev | Handler | Lines | Description | -|:---|:---|:---|:---|:---| -| F-01 | MED | Configure | 260-269 | Layout invariant throws InvalidOperationException -- crashes Configure cold | -| F-02 | HIGH | DataLoaded | 345 | BarsArray[1] accessed without BarsArray.Count guard | -| F-03 | LOW | Configure | 294-297 | AddDataSeries called AFTER throwing code -- ordering risk | -| F-04 | LOW | DataLoaded | 341 | Silent ConfiguredTargetCount mutation -- no telemetry | -| F-05 | MED | DataLoaded | 387-401 | _dataLoadedComplete set true BEFORE StickyState/IPC -- startup gate fires too early | -| F-06 | LOW | DataLoaded | 371 | Stale "REPAIRED" banner hardcoded -- not BUILD_TAG-conditional | -| F-07 | MED | Terminated | 462-469 | Dispatcher.InvokeAsync in Terminated has no _isTerminating guard inside lambda | -| F-08 | MED | Terminated | 475 | CancelAllV12GtcOrders called AFTER _isTerminating=true but BEFORE DrainQueues -- ordering ambiguity | -| F-09 | LOW | Terminated | 514-532 | Dict .Clear() called after CancelAllV12GtcOrders -- orders reference live dict during cancel | -| F-10 | LOW | Realtime | 406-409 | Banner block uses non-ASCII box chars (pipe/dash) -- ASCII gate risk | -| F-11 | LOW | ConnectionUpdate | 551 | EnableSIMA guard in ProcessOnConnectionStatusUpdate -- silent no-op when SIMA toggled off mid-session | -| F-12 | LOW | MarketData | 581-593 | OnMarketData fires PublishUiSnapshot on every tick -- no rate gate | - ---- - -## Surgical Repairs - -### F-01: Layout Invariant -- Graceful Degradation (lines 260-269) - -**FIND**: -```csharp - // Static assert: Shadow must be the last 8 bytes of FleetDispatchSlot (ADR-016) - { - int _slotSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(FleetDispatchSlot)); - int _shadowOffset = System.Runtime.InteropServices.Marshal.OffsetOf(typeof(FleetDispatchSlot), "Shadow").ToInt32(); - if (_slotSize != 64 || _shadowOffset != 56) - { - throw new InvalidOperationException(string.Format( - "FleetDispatchSlot layout invariant violated: size={0}, shadowOffset={1}; expected size=64, offset=56", - _slotSize, _shadowOffset)); - } - } -``` - -**REPLACE WITH**: -```csharp - // Static assert: Shadow must be the last 8 bytes of FleetDispatchSlot (ADR-016) - // B984-F01: Degrade gracefully instead of crashing Configure cold. - { - int _slotSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(FleetDispatchSlot)); - int _shadowOffset = System.Runtime.InteropServices.Marshal.OffsetOf(typeof(FleetDispatchSlot), "Shadow").ToInt32(); - if (_slotSize != 64 || _shadowOffset != 56) - { - Print(string.Format("[PHOTON CRITICAL] FleetDispatchSlot layout invariant violated: size={0}, shadowOffset={1}; expected size=64, offset=56. Photon MMIO disabled.", _slotSize, _shadowOffset)); - _photonPool = null; - _photonDispatchRing = null; - } - } -``` - ---- - -### F-03: AddDataSeries Ordering -- Move to Top of Configure (lines 294-297) - -**FIND** (the AddDataSeries block near line 294): -```csharp - // Add data series for MTF RMA Intelligence (Phase 9.2) - AddDataSeries(BarsPeriodType.Minute, 5); // Index 1 (Primary for ATR) - AddDataSeries(BarsPeriodType.Minute, 10); // Index 2 - AddDataSeries(BarsPeriodType.Minute, 15); // Index 3 - - _configureComplete = true; -``` - -**REPLACE WITH** (remove block from here -- it moves to the top): -```csharp - _configureComplete = true; -``` - -**FIND** (first line of OnStateChangeConfigure body): -```csharp - private void OnStateChangeConfigure() - { - _configureComplete = false; - _dataLoadedComplete = false; -``` - -**REPLACE WITH**: -```csharp - private void OnStateChangeConfigure() - { - _configureComplete = false; - _dataLoadedComplete = false; - - // B984-F03: AddDataSeries FIRST -- NT8 requires early registration before any throwing code. - // Index 1 = 5-min (ATR), Index 2 = 10-min, Index 3 = 15-min (MTF RMA Intelligence Phase 9.2) - AddDataSeries(BarsPeriodType.Minute, 5); - AddDataSeries(BarsPeriodType.Minute, 10); - AddDataSeries(BarsPeriodType.Minute, 15); -``` - ---- - -### F-02: BarsArray Guard (line 345) - -**FIND**: -```csharp - // Initialize ATR indicator on 5-min bars (BarsArray[1]) - atrIndicator = this.ATR(BarsArray[1], RMAATRPeriod); -``` - -**REPLACE WITH**: -```csharp - // B984-F02: Guard BarsArray[1] -- only valid if AddDataSeries completed in Configure. - if (BarsArray.Count >= 2) - { - atrIndicator = this.ATR(BarsArray[1], RMAATRPeriod); - } - else - { - Print("[CRITICAL] BarsArray[1] unavailable -- ATR will use primary series. Check AddDataSeries in Configure."); - atrIndicator = this.ATR(RMAATRPeriod); - } -``` - ---- - -### F-04: Silent Target Count Override -- Add Telemetry (line 341) - -**FIND**: -```csharp - activeTargetCount = Math.Max(1, Math.Min(5, loadedTargetCount)); - ConfiguredTargetCount = activeTargetCount; -``` - -**REPLACE WITH**: -```csharp - activeTargetCount = Math.Max(1, Math.Min(5, loadedTargetCount)); - // B984-F04: Log backward-compat override so users know why target count changed. - Print(string.Format("[COMPAT] ConfiguredTargetCount was 0 -- auto-detected {0} targets from TargetValue fields.", activeTargetCount)); - ConfiguredTargetCount = activeTargetCount; -``` - ---- - -### F-05: Startup Gate Fires Too Early (lines 387-401) - -**FIND**: -```csharp - _dataLoadedComplete = true; - - // Build 1103: Initialize sticky state path + hydrate persisted config. - // MUST run BEFORE StartIpcServer() so GET_LAYOUT serves last-synced state. - _stickyStatePath = System.IO.Path.Combine(logsDir, - string.Format("StickyState_{0}.v12state", symbol)); - bool stickyLoaded = LoadStickyState(); - if (stickyLoaded) - Print("[STICKY] Persisted state hydrated -- GET_LAYOUT will serve last-synced config"); - - // V12.2 HEADLESS SAFETY: Start core services even if ChartControl is null (for background execution) - // [Build 932]: Start IPC in DataLoaded so Control Surface connects even if market is closed/offline. - StartIpcServer(); - TouchStrategyHeartbeat(); - PublishUiSnapshot(); -``` - -**REPLACE WITH**: -```csharp - // B984-F05: StickyState + IPC must complete BEFORE _dataLoadedComplete = true - // so EnsureStartupReady() gate does not open until services are ready. - - // Build 1103: Initialize sticky state path + hydrate persisted config. - // MUST run BEFORE StartIpcServer() so GET_LAYOUT serves last-synced state. - _stickyStatePath = System.IO.Path.Combine(logsDir, - string.Format("StickyState_{0}.v12state", symbol)); - bool stickyLoaded = LoadStickyState(); - if (stickyLoaded) - Print("[STICKY] Persisted state hydrated -- GET_LAYOUT will serve last-synced config"); - - // V12.2 HEADLESS SAFETY: Start core services even if ChartControl is null (for background execution) - // [Build 932]: Start IPC in DataLoaded so Control Surface connects even if market is closed/offline. - StartIpcServer(); - TouchStrategyHeartbeat(); - PublishUiSnapshot(); - - _dataLoadedComplete = true; -``` - ---- - -### F-06: Hardcoded "REPAIRED" Banner -- Make Conditional (line 371) - -**FIND**: -```csharp - Print(string.Format("{0} REPAIRED: Definitive Chart-Click Fix + Logic Refresh", BUILD_TAG)); -``` - -**REPLACE WITH**: -```csharp - // B984-F06: Banner removed -- was a one-time repair artifact, not a permanent log entry. -``` - ---- - -### F-07: Dispatcher Lambda Missing _isTerminating Guard in Terminated (lines 462-469) - -**FIND**: -```csharp - if (ChartControl != null) - { - ChartControl.Dispatcher.InvokeAsync(() => - { - DetachHotkeys(); - DetachChartClickHandler(); - DestroyPanel(); - }); - } -``` - -**REPLACE WITH**: -```csharp - if (ChartControl != null) - { - ChartControl.Dispatcher.InvokeAsync(() => - { - // B984-F07: _isTerminating guard ensures no re-entrant panel ops if invoked late. - if (!_isTerminating) return; - DetachHotkeys(); - DetachChartClickHandler(); - DestroyPanel(); - }); - } -``` - ---- - -### F-08 + F-09: Teardown Ordering -- Dicts BEFORE Cancel (lines 475, 514-532) - -The current order is: -1. `_isTerminating = true` -2. Dispatcher InvokeAsync (panel teardown) -3. **CancelAllV12GtcOrders** -- references order dicts -4. DrainQueues -5. StopIpcServer -6. ... more cleanup ... -7. **Dict.Clear()** -- dicts cleared AFTER cancel - -F-08: CancelAllV12GtcOrders must run while dicts are fully populated. -F-09: Dict.Clear() is correct AFTER cancel. No change needed to ordering for F-09 -- the ordering is already correct. The defect is actually F-08 being called while Dispatcher lambda may still be reading from dicts. - -**Fix for F-08**: Add a `Print` telemetry before cancel so the order is traceable: - -**FIND**: -```csharp - // [BUILD 948] GTC Cancel Sweep -- cancel all tracked/broker V12 orders before teardown. - // Must run while dicts are still populated and accounts still subscribed. - // force=false: soft terminate, protects brackets for open positions. - CancelAllV12GtcOrders(false); -``` - -**REPLACE WITH**: -```csharp - // [BUILD 948] GTC Cancel Sweep -- cancel all tracked/broker V12 orders before teardown. - // Must run while dicts are still populated and accounts still subscribed. - // force=false: soft terminate, protects brackets for open positions. - // B984-F08: Log entry count before sweep for post-mortem tracing. - Print(string.Format("[SHUTDOWN] GTC sweep: cancelling {0} tracked + broker-scanned orders", - (entryOrders?.Count ?? 0) + (stopOrders?.Count ?? 0))); - CancelAllV12GtcOrders(false); -``` - ---- - -### F-10: Banner Box Chars -- ASCII Gate Compliance (lines 406-409) - -**FIND**: -```csharp - Print("+--------------------------------------------------------------+"); - Print("| [OK] BMad HARDENED DEPLOYMENT PROTOCOL ACTIVE |"); - Print(string.Format("| Build: {0,-10} | Sync: ONE SOURCE OF TRUTH |", BUILD_TAG)); - Print("+--------------------------------------------------------------+"); -``` - -**REPLACE WITH**: -```csharp - // B984-F10: Replaced box-drawing chars with ASCII-safe dashes and brackets. - Print("--------------------------------------------------------------"); - Print("[OK] BMad HARDENED DEPLOYMENT PROTOCOL ACTIVE"); - Print(string.Format("Build: {0} | Sync: ONE SOURCE OF TRUTH", BUILD_TAG)); - Print("--------------------------------------------------------------"); -``` - ---- - -### F-11: ConnectionUpdate Silent No-Op -- Add Telemetry (line 551) - -**FIND**: -```csharp - if (!enableSima || strategyState != State.Realtime) return; -``` - -**REPLACE WITH**: -```csharp - // B984-F11: Log when guard exits early so operators know reconnect re-adoption was skipped. - if (!enableSima || strategyState != State.Realtime) - { - if (status == ConnectionStatus.Connected) - Print(string.Format("[BUILD 948] Reconnect skipped -- SIMA={0}, State={1}", enableSima, strategyState)); - return; - } -``` - ---- - -### F-12: OnMarketData PublishUiSnapshot Rate Gate (lines 586-592) - -**FIND**: -```csharp - // Update last known price for real-time tracking - lastKnownPrice = marketDataUpdate.Price; - PublishUiSnapshot(); - - // Process IPC commands immediately on every tick - // This ensures Remote App buttons work even outside session time - ProcessIpcCommands(); -``` - -**REPLACE WITH**: -```csharp - // Update last known price for real-time tracking - lastKnownPrice = marketDataUpdate.Price; - - // B984-F12: Rate-gate UI snapshot -- publish only every 5 ticks to reduce dispatcher pressure. - _uiSnapshotTickCounter = (_uiSnapshotTickCounter + 1) % 5; - if (_uiSnapshotTickCounter == 0) - PublishUiSnapshot(); - - // Process IPC commands immediately on every tick - // This ensures Remote App buttons work even outside session time - ProcessIpcCommands(); -``` - -> **NOTE**: `_uiSnapshotTickCounter` requires a new `private int _uiSnapshotTickCounter;` field declaration -> in `V12_002.Data.cs` or the existing fields partial file. Engineer must add this field. - ---- - -## BUILD_TAG Update - -**FIND** (in `V12_002.cs`): -```csharp -private const string BUILD_TAG = "1111.004-v28.0-pr75-repairs"; -``` - -**REPLACE WITH**: -```csharp -private const string BUILD_TAG = "1111.005-v28.0-b984"; -``` - ---- - -## Engineer Self-Audit Checklist (PowerShell) - -```powershell -# Run from repo root after all edits - -# 1. Zero lock() calls -$locks = Select-String -Path "src\*.cs" -Pattern "lock\s*\(" | Where-Object { $_ -notmatch "//.*lock" } -if ($locks) { Write-Error "FAIL: lock() found"; $locks } else { Write-Host "PASS: No lock() calls" } - -# 2. Zero non-ASCII in string literals (simplified scan) -$nonAscii = Select-String -Path "src\*.cs" -Pattern "[^\x00-\x7F]" -if ($nonAscii) { Write-Error "FAIL: Non-ASCII chars found"; $nonAscii } else { Write-Host "PASS: ASCII-only" } - -# 3. Verify BarsArray guard exists -$guard = Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "BarsArray.Count >= 2" -if (-not $guard) { Write-Error "FAIL: F-02 guard missing" } else { Write-Host "PASS: F-02 guard present" } - -# 4. Verify AddDataSeries is before layout invariant check -$addDs = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "AddDataSeries").LineNumber | Select-Object -First 1 -$layout = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "FleetDispatchSlot layout invariant").LineNumber | Select-Object -First 1 -if ($addDs -lt $layout) { Write-Host "PASS: F-03 ordering correct" } else { Write-Error "FAIL: F-03 AddDataSeries still after layout check" } - -# 5. Verify _dataLoadedComplete = true is after StartIpcServer -$ipc = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "StartIpcServer").LineNumber | Select-Object -First 1 -$gate = (Select-String -Path "src\V12_002.Lifecycle.cs" -Pattern "_dataLoadedComplete = true").LineNumber | Select-Object -First 1 -if ($gate -gt $ipc) { Write-Host "PASS: F-05 gate ordering correct" } else { Write-Error "FAIL: F-05 gate still fires too early" } - -# 6. BUILD_TAG bump -$tag = Select-String -Path "src\V12_002.cs" -Pattern "1111.005-v28.0-b984" -if (-not $tag) { Write-Error "FAIL: BUILD_TAG not bumped" } else { Write-Host "PASS: BUILD_TAG = 1111.005-v28.0-b984" } - -Write-Host "Self-audit complete." -``` - ---- - -## Director's Handoff Block for Codex - -``` -MISSION: Build-984-SourceHardening -- P5 Engineering -BUILD_TAG: 1111.004-v28.0-pr75-repairs -> 1111.005-v28.0-b984 -BRANCH: build-984-source-hardening -REPO: https://github.com/mkalhitti-cloud/universal-or-strategy - -P3 ARCHITECT SIGN-OFF: COMPLETE -All 12 Arena findings (F-01 to F-12) independently verified in live source. -Surgical FIND/REPLACE blocks in docs/brain/implementation_plan.md are authoritative. - -=== PRIMARY TARGET === -FILE: src/V12_002.Lifecycle.cs (all 12 defect sites) -SECONDARY: src/V12_002.cs (BUILD_TAG bump only) -TERTIARY: src/V12_002.Data.cs (add _uiSnapshotTickCounter field for F-12) - -=== STEP SEQUENCE === - -STEP 1 -- Read the full plan: -docs/brain/implementation_plan.md - -STEP 2 -- Apply repairs IN THIS ORDER (ordering matters for F-03/F-05): - 1. F-03: Move AddDataSeries to top of OnStateChangeConfigure (ordering fix first) - 2. F-01: Replace layout invariant throw with graceful degradation + Print - 3. F-02: Add BarsArray.Count guard around atrIndicator init - 4. F-04: Add Print before ConfiguredTargetCount mutation - 5. F-05: Move _dataLoadedComplete = true to AFTER StartIpcServer/StickyState - 6. F-06: Remove hardcoded "REPAIRED" banner line - 7. F-07: Add _isTerminating check inside Terminated dispatcher lambda - 8. F-08: Add Print with order counts before CancelAllV12GtcOrders - 9. F-09: No change needed (ordering is correct per re-analysis) - 10. F-10: Replace box-drawing chars with ASCII-safe dashes - 11. F-11: Add telemetry Print in ConnectionUpdate early-return path - 12. F-12: Add _uiSnapshotTickCounter rate gate around PublishUiSnapshot - -STEP 3 -- Add field (F-12 dependency): -In src/V12_002.Data.cs, add: - private int _uiSnapshotTickCounter; - -STEP 4 -- Bump BUILD_TAG: -In src/V12_002.cs: - FIND: private const string BUILD_TAG = "1111.004-v28.0-pr75-repairs"; - REPLACE: private const string BUILD_TAG = "1111.005-v28.0-b984"; - -STEP 5 -- Self-audit: -Run the PowerShell checklist from docs/brain/implementation_plan.md. -All 6 checks must PASS before handoff. - -STEP 6 -- Deploy: - powershell -File .\deploy-sync.ps1 - Tell Director: press F5 in NinjaTrader. Verify banner shows "1111.005-v28.0-b984". - -STEP 7 -- Commit: - git add src/V12_002.Lifecycle.cs src/V12_002.cs src/V12_002.Data.cs - git commit -m "B984: Apply 12 source hardening repairs (F-01 to F-12)" - git push -``` - ---- - -## Post-Production Refactor Roadmap - -After Build-984 merges to main (M3 complete), the following refactor sequence is planned. -One PR per subgraph. Subgraphs with Complexity >= 50 are in scope. - -| Priority | Subgraph | Total Cmplx | Highest-Risk File | Recommended Approach | -|:---|:---|:---|:---|:---| -| 1 | **SIMA** | 669 | SIMA.Lifecycle.cs (262) | Extract SIMA state machine into discrete FSM transitions | -| 2 | **Execution Engine** | 1627 | Orders.Callbacks.AccountOrders.cs (206) | Split callback chain; extract bracket FSM | -| 3 | **UI & Photon IO** | 1646 | UI.Callbacks.cs (202) | Separate panel construction from event dispatch | -| 4 | **REAPER Defense** | 437 | REAPER.Audit.cs (153) | Extract audit rules into table-driven evaluator | -| 5 | **Kernel** | 315 | StickyState.cs (148) | Extract persistence layer | -| 6 | **Signals** | 244 | Entries.Trend.cs (50) | Minor -- inline guards | - -**Excluded** (Cmplx < 50): Telemetry (35), Morpheus OS (3), Kernel Constants/Data/AccountUpdate. - -*Architect note*: Execution Engine (1627) and UI & Photon IO (1646) are the largest subgraphs. -Recommend tackling SIMA first (669) as a warm-up since it is self-contained and its FSM pattern -is already established. Execution Engine second because it has the most cross-file blast radius. - ---- - -*Plan authored by: P3 ARCHITECT (Antigravity in PLAN-ONLY mode)* -*Protocol: V14 Alpha | Build-984 | 2026-05-05* - ---- - -## P3-CI: Workflow Hardening Suite (Build 984.1) - -**Status**: IMPLEMENTED | **Branch**: build-984-hardening - -Installed and configured 6 core GitHub Actions workflows to satisfy CI/CD security and repository hygiene requirements. - -### 1. Dependency Review (`dependency-review.yml`) -- **Function**: Blocks PRs that introduce vulnerable dependencies or invalid licenses. -- **Trigger**: `pull_request` - -### 2. OSV-Scanner (`osv-scanner.yml`) -- **Function**: Scans project dependencies against Google's OSV vulnerability database. -- **Trigger**: `push` to main/dev, `pull_request`, `schedule` (weekly). - -### 3. Codecov Reporting (`codecov.yml`) -- **Function**: Uploads coverage reports to Codecov.io for visual PR feedback. -- **Trigger**: `workflow_run` (after `dotnet-test.yml` completes). -- **Target**: `./TestResults/coverage.opencover.xml` - -### 4. Markdown Link Check (`markdown-link-check.yml`) -- **Function**: Validates internal and external links in `.md` files. -- **Config**: `.github/mlc_config.json` (ignores local `file:///` artifacts). -- **Trigger**: `push`, `pull_request`. - -### 5. Stale Bot (`stale.yml`) -- **Function**: Automates management of inactive issues and PRs (60 days stale -> 7 days warning -> close). -- **Trigger**: `schedule` (daily). - -### 6. Release Drafter (`release-drafter.yml`) -- **Function**: Drafts release notes based on PR labels (mapped to V12 labels: `fix`, `enhancement`, `docs`, `maintenance`). -- **Config**: `.github/release-drafter.yml`. -- **Trigger**: `push` to main. - ---- - -## PR Intelligence Suite - -**Status**: COMPLETE | **Branch**: build-984-hardening - -### 1. Qwen PR Reviewer (`qwen-review.yml`) -- **Function**: Automated code review and issue management via QwenLM. -- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`. - -### 2. GLM OpenCode Reviewer (`glm-review.yml`) -- **Function**: Automated code review via GLM OpenCode. -- **Trigger**: `pull_request` on `[main, dev, build-984-hardening]`. - ---- +## [UNDER CONSTRUCTION] +Waiting for P3 Architect (Claude) to define the strategic design for Phase 5. +Focus: Distributed Dispatchers, Lock-Free Primitives, Rithmic Integration. diff --git a/docs/brain/task.md b/docs/brain/task.md index 1adb8d84..f51e3cb6 100644 --- a/docs/brain/task.md +++ b/docs/brain/task.md @@ -1,8 +1,7 @@ -# ADR-019 Sovereign Substrate Repair: Live Mission Dashboard - -**Protocol Version**: V14 Alpha (Full Lifecycle Coverage) -**Target Build**: `1111.003-v28.0-adr019` -**Blackboard Sync**: [nexus_a2a.json](file:///C:/WSGTA/universal-or-strategy/docs/brain/nexus_a2a.json) +# Mission Dashboard: Phase 5 Distributed Pipeline +**BUILD_TAG**: 1111.006-v28.0-b984-complete +**Repo**: mkalhitti-cloud/universal-or-strategy +**Branch**: phase-5-distributed-pipeline --- @@ -10,66 +9,28 @@ | Phase | Role | Purpose | Status | | :----- | :--------------- | :----------------------------- | :------------------------------- | -| **P1** | **Orchestrator** | Central Switchboard | ✅ **COMPLETE** (Dashboard Hardened) | -| **P2** | **Forensics** | Logic Trace & Evidence | ✅ **COMPLETE** | -| **P3** | **Architect** | Structural Design | ✅ **COMPLETE** (Workflow Synced) | -| **P4** | **Adjudicator** | Red Team Arena Audit | ✅ **COMPLETE** (Dashboard Matrix) | -| **P5** | **Engineer** | Surgical Implementation | ✅ **COMPLETE** (Sync Engine Live) | -| **P6** | **Validator** | Logic & AMAL Vetting | ✅ **COMPLETE** (Pending NT8 F5 Compile) | -| **P7** | **Sentinel** | GitHub / Security Audit | **COMPLETE** (Hook Repair Pending, Push Complete) | +| **P1** | **Orchestrator** | Central Switchboard | ✅ **COMPLETE** (Intake & Branching) | +| **P2** | **Forensics** | Logic Trace & Evidence | 🟡 **PENDING** | +| **P3** | **Architect** | Structural Design | 🔵 **ACTIVE** (Claude) | +| **P4** | **Adjudicator** | Red Team Arena Audit | ⚪ **WAITING** | +| **P5** | **Engineer** | Surgical Implementation | ⚪ **WAITING** | +| **P6** | **Validator** | AMAL Vetting | ⚪ **WAITING** | +| **P7** | **Sentinel** | Infrastructure / Security | ⚪ **WAITING** | --- -## 🛠️ Task Execution Log - -### [x] P1: ORCHESTRATION & INTAKE - -- [x] Extract 4 $battlezip files from Downloads -- [x] Initial Forensic Synthesis (identified 7 Type 2 logic leaks) -- [x] Protocol Hardening: Refactor Hierarchy (V14 Expansion) -- [x] Agent Readiness: Enforce Morpheus gates and global gstack integration across all workflows -- [x] **Dashboard Hardening**: Synchronized Battle Matrix and Mission Progress with Living Dashboard - -### [x] P2: FORENSIC AUDIT (CONSOLIDATED) - -- [x] Consolidate Goose findings + Arena findings -- [x] Verify Site #5, #11-16 "Cleanup Bypass" proof of failure -- [x] Audit path portability (deploy-sync.ps1 hardcoded repo paths) - -### [/] P3: ARCHITECTURAL DESIGN (CLAUDE) +## 🎯 Current Objectives (M5-M9) +- [ ] **Architecture**: Distributed Dispatcher Community Design (Option A) +- [ ] **Foundation**: Lock-Free Ring Buffer Primitives (SPSC/MPMC) (Option C) +- [ ] **Integration**: Rithmic Data Hub Adapter (Option B - Deferred/Conditional) -- [x] Invoke `/architect_intake` with forensic brief -- [x] Claude: Independent verification of 32 sites (Explore Agents) -- [ ] Claude: Rewrite `implementation_plan.md` with A1/A2 patterns -- [ ] Post-Design Peer Review sign-off - -### [ ] P4: ADJUDICATION GATE (ARENA) - -- [ ] Launch P4 Red Team Battle ($redteambattle) -- [ ] Achieve 14/14 model consensus on new A1/A2 recipes -- [ ] Verify Windows-native PowerShell matrix in Section F -- [ ] P4 Audit Sign-Off memo - -### [ ] P5: SURGICAL ENGINEERING (CODEX) - -- [ ] Apply approved plan to `src/` (Surgical P5 edits) -- [ ] Run `deploy-sync.ps1` (Hard-link restoration) -- [ ] ASCII Gate & Lint passing check +--- -### [x] P6: POST-SURGERY VALIDATION -- [x] Task 1 DONE: Final Build Gate (`dotnet build "Linting.csproj" -nologo`) -- [x] Task 2 DONE: Global lock audit and ctx.Sync / FollowerEntries audit -- [x] Task 3 DONE: BUILD_TAG verification (`1111.003-v28.0-adr019`) -- [x] AMAL waiver recorded: `docs/artifacts/audits/amal_waiver.md` -- [x] Forensic sign-off agents: Aquinas (T2), Schrodinger (T3) -- [x] Mission status: COMPLETE pending NT8 F5 compile +## 🛠️ Task Execution Log -### [ ] P7: SENTINEL (INFRASTRUCTURE) -- [x] Configure **Sentry & LangSmith** (DSN active, LS project verified) -- [x] Fix false positives in `audit_scan.ps1` (Comment exclusion + word boundaries) -- [x] **CRITICAL FINDING**: 12 banned `lock()` statements in `src/` (Symmetry, SIMA) -- [x] Organize **Droid Evidence Folder**: [droid_mission_01](file:///C:/WSGTA/universal-or-strategy/docs/telemetry/droid_mission_01/README.md) -- [ ] Execute **GitHub Audit Team** check (label-sync, secrets) -- [x] Remediate `lock()` violations (Replace with Actor Enqueue model) -- [ ] Restore `install_hooks.ps1` and verify LFS gates -- [ ] Close ADR-019 Mission Brief +### [x] P1: ORCHESTRATION & INTAKE +- [x] Initial Phase 5 branch creation (`phase-5-distributed-pipeline`) +- [x] Clear `implementation_plan.md` +- [x] Update `nexus_a2a.json` +- [x] Establish Mission Dashboard (task.md) +- [ ] Trigger `/architect_intake` (Claude)