Skip to content

Commit e5280e5

Browse files
SashaMITcursoragent
andcommitted
refactor(phase-2-globals): purge ambient global.* patterns + fix latent db-settings bug
Phase 2-Globals was promoted out of Phase 2-C scope when the survey revealed pc2Config was one of FOUR distinct (global as any).X patterns in pc2-node — and one of them was a real latent bug. Cleaned up 4 patterns: 1. (global as any).pc2Config — vestigial mutable cache, DELETED. Was only ever populated by the storage_limit POST handler; compute settings were never written to it so reads in WASMRuntime always returned undefined. Real source of truth is db (req.app.locals.db) and loaded Config (req.app.locals.config); the global was redundant. Removed write in api/storage.ts and 3 reads in api/resources.ts, api/info.ts, services/wasm/WASMRuntime.ts. 2. (global as any).db — LATENT BUG, FIXED. This global was NEVER SET anywhere in pc2-node/src (confirmed via exhaustive grep). The getDb() helpers in api/resources.ts and api/supernode.ts always returned undefined; db?.getSetting() reads silently failed; users who set storage_limit/max_concurrent_wasm/ max_memory_mb/wasm_timeout_ms via the API had their values accepted (db.setSetting works) but ignored on subsequent reads. The "Database settings override config file" code comment was false. Fixed by replacing both broken helpers with explicit req.app.locals.db as DatabaseManager lookups at 6 call sites. 3. (global as any).__filesystem — KEPT + DOCUMENTED. Set at server.ts:141, read at api/other.ts:882 as a deliberate defensive fallback for the Drivers tool-execution critical path. This is INTENTIONAL belt-and-suspenders, not ambient authority. Added explanatory comments at both sites so future audits won't misclassify it. 4. (global as any).ipfsStorage — CONSUMER PURGED. Single-write at bootstrap (index.ts:245) preserved as audit-permitted startup pattern. The consumer helper in api/supernode.ts deleted; call site now uses req.app.locals.ipfs as IPFSStorage. TypeScript caught 4 more pre-existing bugs during execution: - db.getSetting() returns string|undefined (SQLite TEXT), but the code in resources.ts:89-90 was treating max_concurrent_wasm and wasm_timeout_ms as numbers. Fixed via explicit parseInt() on read. - db.setSetting() expects a string value, but the POST handler was passing the parseInt'd numeric value at resources.ts:247 and :274. Fixed via explicit String() on write. These were silent under the old `any`-typed helpers and would have caused NaN propagation once the read path started working. This is the THIRD Phase 2 phase where TypeScript caught real bugs during execution (after 2-C's static-method and type-narrowing catches). The methodology pays for itself every time. Pre-flight db survey of local install confirmed zero existing user resource-settings — the bug-fix's user-visible blast radius is forward-looking only. No existing user behavior changes. Validation: - tsc --noEmit clean - npm run build:backend clean - npm run test:unit 7/7 in 52.6 ms - ReadLints zero errors on 7 modified files - Pre-flight db survey confirmed no existing settings affected Release-notes copy for v1.2.8.0 prepared in PHASE-2-GLOBALS-RELEASE-NOTES.md (do not paste prematurely; release manager owns assembly). After this commit, the audit's mechanical-pattern blocker #2 (ambient global singletons) is functionally complete for consumer modules in pc2-node/src. Remaining work is architectural, not mechanical. Held behind Mac launcher 48-72h soak gate before release-branch merge. See PHASE-2-GLOBALS-CLEANUP.md for the full execution log and CAPSULE_READINESS_REPORT.md §5.9 for audit-score impact. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f6050ab commit e5280e5

12 files changed

Lines changed: 304 additions & 62 deletions

File tree

.cursor/tasks/OPTIMISATION-AND-REFACTORING-2026-05/AUDIT_EXECUTIVE_SUMMARY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
>
1111
> **Phase 2-C executed (2026-05-18)**: global-singleton purge landed on feature branch. **27 of 37 audited ambient-singleton sites fully purged (73%)** across `getDatabase()` (15/17), `getWASMRuntime()` (5/13), `getUpdateService()` (7/7). The remaining 10 sites are either static methods (2, no `this`) or deep multi-layer WASM/dDRM helpers (8) — all explicitly marked with `Phase 2-C` or `Phase 2-D (deferred)` comments rather than left silently ambient. A previously-planned 4th cluster (`pc2Config` global) was promoted out into its own ticket once investigation revealed it's a 4-file pattern with runtime mutation. Validation: `tsc` clean, `build:backend` clean, `test:unit` 7/7, ReadLints zero errors on 14 modified files, **live dev-server `/api/health` returns identical pre-change `version: "1.2.7.14"`** proving the converted `req.app.locals.updateService.getCurrentVersion()` is exact behavior-equivalent. TypeScript caught two real errors during execution (static-method `this.db` access; optional-undefined narrowing) — validating the methodology a second time. Held behind Mac launcher soak gate. See `PHASE-2-C-SINGLETON-PURGE.md` "Execution log" + audit report §5.7.
1212
>
13-
> **Phase 2-D executed (2026-05-18 morning)**: sibling-orchestrator type-only conversions landed on feature branch. Original audit framing predicted a 3-hour "extract interfaces" structural job; post-2-C survey found that **most consumer sites already use the orchestrator class only as a type annotation** — TypeScript's structural typing means `import type { AIChatService }` IS the interface, no nominal `IAIChatService` extraction needed. Scope shrunk to **6 mechanical keyword changes across 6 files** (`server.ts`, `api/ai.ts`, `api/other.ts`, `gateway/ChannelBridge.ts`, `ContentIntelligenceService.ts`, `api/boson.ts`). **Result**: every modified file's compiled JS is **literally byte-identical** pre vs post (strongest validation outcome — stronger than 2-B's spot-check proof because every modified file matched, not just spot-checks). All gates green: `tsc` clean, `build:backend` clean, `test:unit` 7/7, ReadLints zero errors. The audit's mechanical-pattern blockers (#1 concrete-class consumer imports + #2 ambient global singletons) are now functionally exhausted for consumer modules in `pc2-node/src` — remaining work is architectural (mega-orchestrator splits, mutable-global lifecycle redesign), not mechanical. Held behind Mac launcher soak gate. See `PHASE-2-D-SIBLING-ORCHESTRATOR-TYPE-ONLY.md` "Execution log" + audit report §5.8.
14-
> **Updated**: 2026-05-18 morning.
13+
> **Phase 2-D executed (2026-05-18 morning)**: sibling-orchestrator type-only conversions landed on feature branch. Original audit framing predicted a 3-hour "extract interfaces" structural job; post-2-C survey found that **most consumer sites already use the orchestrator class only as a type annotation** — TypeScript's structural typing means `import type { AIChatService }` IS the interface, no nominal `IAIChatService` extraction needed. Scope shrunk to **6 mechanical keyword changes across 6 files** (`server.ts`, `api/ai.ts`, `api/other.ts`, `gateway/ChannelBridge.ts`, `ContentIntelligenceService.ts`, `api/boson.ts`). **Result**: every modified file's compiled JS is **literally byte-identical** pre vs post (strongest validation outcome — stronger than 2-B's spot-check proof because every modified file matched, not just spot-checks). All gates green: `tsc` clean, `build:backend` clean, `test:unit` 7/7, ReadLints zero errors. See `PHASE-2-D-SIBLING-ORCHESTRATOR-TYPE-ONLY.md` "Execution log" + audit report §5.8.
14+
>
15+
> **Phase 2-Globals executed (2026-05-18 midday)**: ambient `(global as any).X` cleanup landed on feature branch. Cleaned up 4 distinct patterns in pc2-node: (1) `pc2Config` deleted entirely as vestigial cache (db is real source of truth), (2) `global.db` latent bug fixed — was never set anywhere, so all `db?.getSetting()` calls in resources/supernode silently failed; now reads use `req.app.locals.db`, (3) `__filesystem` defensive-fallback documented with explanatory comments at producer + consumer (legitimate intentional global), (4) `ipfsStorage` consumer purged from supernode (bootstrap write at index.ts preserved as audit-permitted single-write). Pre-flight db survey of local install confirmed **zero existing user resource-settings** — bug-fix has forward-looking blast radius only. **TypeScript caught 4 more pre-existing type bugs during execution** (db.getSetting returns `string | undefined`, db.setSetting accepts `string` not `number`) — these were silent under `any` typing and would have caused NaN propagation once the read path started working. Fixed via explicit `parseInt()` / `String()` conversions. All gates green: `tsc` clean, `build:backend` clean, `test:unit` 7/7 in 52.6ms, ReadLints zero on 7 modified files. **The audit's mechanical-pattern blockers (#1 concrete-class consumer imports + #2 ambient global singletons) are now functionally exhausted for consumer modules in `pc2-node/src`** — remaining work is architectural (mega-orchestrator splits, deep-helper threading, ProposalStore extraction), not mechanical. See `PHASE-2-GLOBALS-CLEANUP.md` "Execution log" + audit report §5.9.
16+
> **Updated**: 2026-05-18 midday.
1517
1618
---
1719

.cursor/tasks/OPTIMISATION-AND-REFACTORING-2026-05/CAPSULE_READINESS_REPORT.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,85 @@ After Phase 2-E and the structural tickets above, any remaining work moves into
11091109

11101110
**Shipping**: held behind Mac-launcher 48-72h soak per `PHASE-2-PLAN.md` shipping gate.
11111111

1112+
### 5.9 Phase 2-Globals executed (2026-05-18 midday) — ambient `(global as any).X` cleanup (completes audit blocker #2 for consumer modules)
1113+
1114+
**Status**: shipped to feature branch `feat/t-1-telemetry-and-support`, awaiting CI green + review + Mac soak before release-branch merge.
1115+
1116+
**Promoted out of Phase 2-C and grew into a 4-pattern catalog with a real bug fix**
1117+
1118+
When `pc2Config` was scoped out of Phase 2-C in favor of a dedicated ticket, the survey for that ticket discovered three additional `(global as any).X` patterns in pc2-node and one of them was a real latent bug:
1119+
1120+
| # | Pattern | Action | Outcome |
1121+
|---|---|---|---|
1122+
| 1 | `pc2Config` mutable cache | **Delete entirely** | Was a vestigial cache only ever populated by storage_limit POST. The actual `Config` loaded from `config/loader.js` is on `app.locals.config`; the db-persisted user values are on `req.app.locals.db`. Removed `(global as any).pc2Config = {...}` write in `api/storage.ts`; removed all 3 reads in `api/resources.ts`, `api/info.ts`, `services/wasm/WASMRuntime.ts`. Cleaner architecture. |
1123+
| 2 | `(global as any).db` | **Fix latent bug** | This global was **never set anywhere in the codebase** — confirmed by exhaustive grep. The `getDb()` helpers in `api/resources.ts` and `api/supernode.ts` always returned `undefined`, so `db?.getSetting(...)` reads silently failed. Users who used the API to set `storage_limit` / `max_concurrent_wasm` / `max_memory_mb` / `wasm_timeout_ms` saw their writes accepted (via `db.setSetting()`) but the values were never honored on subsequent reads. The "Database settings override config file" comment in the code was false. **Fixed** by replacing both `getDb()` helpers with explicit `req.app.locals.db as DatabaseManager` lookups at 6 call sites. |
1124+
| 3 | `(global as any).__filesystem` | **Keep + document intent** | Set at `server.ts:141` and read at `api/other.ts:882` as a deliberate defensive fallback for the Drivers tool-execution critical path. Added explanatory comments at both sites identifying this as an audit-permitted "intentional belt-and-suspenders" pattern, not ambient authority. Future audits should not flag this. |
1125+
| 4 | `(global as any).ipfsStorage` | **Purge consumer; preserve bootstrap write** | Same pattern as 2-C — single-write at bootstrap (`index.ts:245`) is audit-permitted (equivalent to `setGlobalDatabase()`); the consumer helper in `api/supernode.ts` was deleted in favor of `req.app.locals.ipfs as IPFSStorage` at the call site. |
1126+
1127+
**Pre-flight db survey result** (mandatory per ticket because of behavioral change): the local install's `settings` table has 46 rows, zero of which match the resource-setting keys. Nobody has ever successfully set a resource limit on this install — consistent with the bug analysis (broken read path → users had no incentive to keep settings). The bug-fix's user-visible blast radius is **forward-looking only**.
1128+
1129+
### TypeScript caught 4 more pre-existing bugs during execution
1130+
1131+
When the `getDb()` / `getConfig()` helpers were replaced with explicit `DatabaseManager | undefined` / `Config | undefined` types, the compiler immediately surfaced 4 type errors that had been silent under the old `any`-typed helpers:
1132+
1133+
| Error site | Real issue |
1134+
|---|---|
1135+
| `resources.ts:89` (`maxConcurrentWasm`) | `db.getSetting()` returns `string \| undefined` (SQLite TEXT), not `number`. Old code treated it as the original numeric value; once the read path started working it would have caused NaN propagation. |
1136+
| `resources.ts:90` (`wasmTimeoutMs`) | Same. |
1137+
| `resources.ts:247` (`db.setSetting('max_concurrent_wasm', value)`) | `value` was `number` from `parseInt()`; `db.setSetting()` requires `string`. SQLite was implicitly coercing on bind, but the round-trip read would have returned a string the old code expected to be a number. |
1138+
| `resources.ts:274` (`db.setSetting('wasm_timeout_ms', value)`) | Same. |
1139+
1140+
Fixed by explicit `parseInt()` on read and `String()` on write. This is the **third Phase 2 phase where TypeScript caught real bugs during execution** (after 2-C's `this.db` static-method catch and the `updateService` type-narrowing catch). The pattern is consistent: **converting `any` to specific types surfaces latent bugs that would have manifested as runtime data corruption.** This is the methodology paying for itself, every time.
1141+
1142+
### Validation outcome (every gate green)
1143+
1144+
| Gate | Result |
1145+
|---|---|
1146+
| `tsc --noEmit` | ✅ clean (after fixing the 4 compiler-caught type errors) |
1147+
| `npm run build:backend` | ✅ clean |
1148+
| `npm run test:unit` | ✅ 7/7 in 52.6 ms |
1149+
| `ReadLints` on 7 modified files | ✅ 0 errors |
1150+
| Pre-flight db survey | ✅ zero existing user settings to be affected |
1151+
1152+
### Strategic note on what this completes
1153+
1154+
After Phase 2-Globals, the audit's **mechanical-pattern blocker #2 (ambient global singletons) is functionally complete for consumer modules in pc2-node/src**.
1155+
1156+
Combined progress since 2026-05-17:
1157+
- **Phase 2-A** (types extraction): 10 files
1158+
- **Phase 2-B** (concrete-class → type-only imports for storage classes): 29 files, 40 sites
1159+
- **Phase 2-C** (ambient module-singleton purge): 14 files, 27 sites
1160+
- **Phase 2-D** (sibling-orchestrator type-only conversions): 6 files
1161+
- **Phase 2-Globals** (4-pattern ambient global cleanup + latent bug fix): 7 files
1162+
- **Total**: 66 file-touches across 73+ specific call-site changes in **~6.5 hours of focused mechanical refactoring**
1163+
1164+
The remaining audit-derived work in `pc2-node/src` is no longer mechanical — it requires architectural decisions:
1165+
1166+
| Future ticket | Type | Estimated effort |
1167+
|---|---|---|
1168+
| **Phase 2-E** — split 3 C-class mega-orchestrators (`ConnectivityService`, `api/index.ts`, `api/storage.ts`) | Structural refactor with real design decisions | ~1-2 days |
1169+
| **Phase 2-D-helpers** (8 deep WASM/dDRM/IPFS helper sites deferred from 2-C) | Threading `wasmRuntime` through 5+ helper layers | ~2-3 hours, modest audit benefit |
1170+
| **AgentKitExecutor ProposalStore extraction** (deferred from 2-D) | Resolves static-method consumer pattern in `api/wallet.ts` | ~2-3 hours |
1171+
| **Optional WASMRuntime config-injection refactor** | Makes compute settings injectable from db at startup; opens path to runtime-mutable limits | ~1 hour |
1172+
1173+
After these structural items land, any remaining work moves into capsule-boundary definition and runtime capability tokens — i.e., the AGENTIC-PC2-MONETISATION migration design itself.
1174+
1175+
### Score impact
1176+
1177+
Estimated band shifts:
1178+
- `api/storage.ts`: B → B+ (one less audit blocker)
1179+
- `api/resources.ts`: B- → B+ (two blockers removed: pc2Config + global.db; plus the latent bug is fixed, plus 4 type bugs surfaced and fixed)
1180+
- `api/info.ts`: A- → A
1181+
- `services/wasm/WASMRuntime.ts`: B → B+ (one less ambient pull)
1182+
- `api/supernode.ts`: B- → B (two blockers removed: global.db + ipfsStorage)
1183+
- `server.ts` + `api/other.ts`: unchanged but explicit intent documented
1184+
1185+
Net: ~8-10 score points across 5 modules + 1 real user-visible correctness fix + 4 latent bugs surfaced by the compiler and fixed.
1186+
1187+
### Shipping
1188+
1189+
Held behind Mac launcher 48-72h soak gate per `PHASE-2-PLAN.md`. After the Mac release stabilizes, this can be merged to release alongside Phase 2-A/2-B/2-C/2-D.
1190+
11121191
### 5.6 What this audit tells us about the AGENTIC-PC2-MONETISATION strategy
11131192

11141193
After 160 modules across 11 batches (audit functionally complete at 98.2% coverage), the strategic picture is now stable and final:

.cursor/tasks/OPTIMISATION-AND-REFACTORING-2026-05/PHASE-2-GLOBALS-CLEANUP.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
**Task ID**: `PHASE-2-GLOBALS-CLEANUP`
44
**Created**: 2026-05-18
5-
**Status**: **Proposed** — awaiting Sasha sign-off
5+
**Status**: **EXECUTED on feature branch** (`feat/t-1-telemetry-and-support`, 2026-05-18 midday) — awaiting CI green + Sasha review for merge-gate sign-off
66
**Priority**: Medium (resolves audit Pattern #2 remainder; **also fixes one latent bug** — db-persisted resource settings have been silently ignored since `(global as any).db` is never set)
77
**Shipping gate**: Cannot **merge to release branch** until Mac launcher 48-72h soak completes per `RELEASE-ENGINEERING-V1280`. Coding on the feature branch is allowed.
8+
**Execution log**: see §"Execution log (2026-05-18 midday)" below.
89

910
> **TL;DR for non-technical sign-off**: see [`PHASE-2-GLOBALS-CHEAT-SHEET.md`](./PHASE-2-GLOBALS-CHEAT-SHEET.md) (2-minute read).
1011
@@ -202,4 +203,92 @@ Alternative: split into 4 PRs (one per global). Higher PR-shepherding cost; not
202203

203204
---
204205

206+
## Execution log (2026-05-18 midday)
207+
208+
### Sign-off decisions captured before execution
209+
210+
User approved both upfront via structured questions:
211+
1. **"Fix the bug AND ship with release-notes communication"** — chosen over narrow-scope or defer-entirely.
212+
2. **"Execute Phase 2-Globals now"** — same proven workflow as 2-C.
213+
214+
### Pre-flight db survey (mandatory pre-merge step per ticket §"Behavioral change")
215+
216+
Surveyed `/Users/mtk/Documents/Cursor/pc2.net/pc2-node/data/pc2.db`:
217+
- 46 total rows in `settings` table.
218+
- **Zero rows** match `storage_limit`, `max_concurrent_wasm`, `max_memory_mb`, or `wasm_timeout_ms` (exact or pattern match).
219+
- All 46 settings are per-user UI prefs (`taskbar_position`, `desktop_bg_url`, etc.).
220+
221+
**Interpretation**: nobody has ever successfully set a resource limit on this install. Consistent with the bug analysis — the read path was broken, so users had no reason to keep settings even if they tried to set them. The bug-fix's user-visible blast radius is **forward-looking only**; no existing user behavior changes.
222+
223+
### Brief tool-side incident
224+
225+
Three small file-read tool calls hung for ~28 min mid-session (no code damage — happened before the editing phase). Recovery: confirmed clean state via `git status`, resumed using the call-site map already in the ticket without further wider reads.
226+
227+
### What landed
228+
229+
All 4 steps applied:
230+
231+
**Step 1 — pc2Config delete (4 sites)**:
232+
- `api/storage.ts:263-272` — write block deleted, replaced with explanatory comment pointing at this ticket
233+
- `api/resources.ts:28-30``getConfig()` helper deleted; readers now use `req.app.locals.config as Config | undefined`
234+
- `api/info.ts:922``(global as any).pc2Config?.resources?.storage?.limit` fallback dropped; `db.getSetting('storage_limit')` is now the sole user-set source
235+
- `services/wasm/WASMRuntime.ts:1668` — dead `pc2Config?.resources?.compute` read removed; preserved identical behavior because the read always returned undefined (compute settings were never written to `pc2Config`)
236+
237+
**Step 2 — `(global as any).db` latent bug fix (6 sites)**:
238+
- `api/resources.ts:23-25``getDb()` helper deleted; 3 route handlers + `getConfiguredLimits()` now thread `req.app.locals.db as DatabaseManager | undefined`
239+
- `api/supernode.ts:16-18``getDb()` helper deleted; 2 route handlers now use `req.app.locals.db as DatabaseManager | undefined`
240+
- `getConfiguredLimits()` signature updated: now accepts `(db: DatabaseManager | undefined, config: Config | undefined)` as explicit parameters
241+
242+
**Step 3 — `__filesystem` defensive fallback documentation (2 comment additions, no code change)**:
243+
- `server.ts:141` — added 8-line explanatory comment block documenting the deliberate intent
244+
- `api/other.ts:882` — added 7-line explanatory comment block on the consumer side
245+
246+
**Step 4 — `(global as any).ipfsStorage` purge in `api/supernode.ts` (1 helper + 1 call site)**:
247+
- `api/supernode.ts:20-22``getIpfsStorage()` helper deleted; 1 call site now uses `req.app.locals.ipfs as IPFSStorage | undefined`
248+
- The bootstrap write at `index.ts:245` is preserved (audit-permitted single-write at startup)
249+
250+
### TypeScript caught 4 real pre-existing type bugs that were hidden behind `any`
251+
252+
This is the strongest methodology validation yet from Phase 2 — the compiler caught 4 errors that would-have-been latent bugs once the read path started working:
253+
254+
| Line | Error | Real-world impact |
255+
|---|---|---|
256+
| `resources.ts:89` | `dbMaxConcurrentWasm` is `string \| undefined` but assigned to `number` | Once the read path works, `Math.X(string)` would silently return NaN |
257+
| `resources.ts:90` | Same for `dbWasmTimeoutMs` | Same |
258+
| `resources.ts:247` | `db.setSetting('max_concurrent_wasm', value)` passes `number` to a function expecting `string` | SQLite was implicitly coercing on bind; now we explicitly stringify so write round-trips cleanly |
259+
| `resources.ts:274` | Same for `wasm_timeout_ms` setSetting | Same |
260+
261+
These are real bugs: `getSetting()` returns SQLite TEXT as string, and the old `any`-typed code was treating it as the original number — which would have caused silent NaN propagation once the read path started returning values. Fixed by `parseInt()` on read and `String()` on write.
262+
263+
This is the third Phase 2 phase where TypeScript caught real errors during execution (after 2-C's static-method `this.db` catch and the type-narrowing catch). The methodology pays for itself every single time.
264+
265+
### Validation results (every gate green)
266+
267+
| Gate | Result |
268+
|---|---|
269+
| `tsc --noEmit` | ✅ clean (after fixing 4 compiler-caught type errors above) |
270+
| `npm run build:backend` | ✅ clean |
271+
| `npm run test:unit` | ✅ 7/7 passing in 52.6 ms |
272+
| `ReadLints` on 7 modified files | ✅ 0 errors |
273+
| Pre-flight db survey | ✅ confirmed zero existing user settings to be affected |
274+
275+
### Strategic note on what this completes
276+
277+
After Phase 2-Globals, the audit's mechanical-pattern blocker #2 (ambient global singletons) is **functionally complete for consumer modules in `pc2-node/src`**:
278+
- Phase 2-C removed `getDatabase()`, `getWASMRuntime()`, `getUpdateService()` ambient module-singleton accessors.
279+
- Phase 2-Globals removed/documented the 4 `(global as any).X` patterns (pc2Config deleted, global.db fixed, __filesystem documented, ipfsStorage purged from consumer).
280+
281+
The only "ambient" pulls remaining in pc2-node/src consumer code are explicitly deferred or intentional:
282+
- 8 deep WASM/dDRM/IPFS helpers (Phase 2-D-helpers — would require threading wasmRuntime through 5+ layers)
283+
- 2 static-method consumers in `api/wallet.ts` (would require ProposalStore service extraction)
284+
- 1 defensive fallback in `api/other.ts` for the Drivers critical path (intentional, now documented)
285+
286+
After these are addressed, all remaining audit-derived work is architectural rather than mechanical.
287+
288+
### Commit reference
289+
290+
(Will be filled in after commit + push.)
291+
292+
---
293+
205294
*This ticket was promoted out of `PHASE-2-C-SINGLETON-PURGE.md` when investigation revealed `pc2Config` was just one instance of a wider `global.*` pattern with 4 distinct cases. Drafting this ticket separately let the right answer for each case be designed in one place rather than half-resolving each in Phase 2-C.*

0 commit comments

Comments
 (0)