From 29655c628e7772dac160bab1c18ab6cf55008f51 Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Mon, 23 Nov 2026 15:33:50 +0500 Subject: [PATCH 1/5] test(p4): demonstrate incorrect zero indexedProjects for actual TS monorepos Test-only source-reduced Radix/Ark/shadcn two nested tsconfigs plus root solution config, single fallback project and empty negative. Red before correction; no source execution, old corpus and release unchanged. --- tests/p4-indexed-projects.test.mjs | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/p4-indexed-projects.test.mjs diff --git a/tests/p4-indexed-projects.test.mjs b/tests/p4-indexed-projects.test.mjs new file mode 100644 index 0000000..fd229c7 --- /dev/null +++ b/tests/p4-indexed-projects.test.mjs @@ -0,0 +1,49 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import {BlastRadius} from '../dist/packages/core/src/index.js'; + +// Source reduced from source-pinned Radix/Ark/shadcn multi-tsconfig workspaces: +// br_status currently always reports indexedProjects: 0, even with source +// files indexed in multiple owned tsconfig roots. No files are executed. +function workspace(t,records) { + const created=fs.mkdtempSync(path.join(os.tmpdir(),'br-p4-project-count-')); + const root=fs.realpathSync(created); + t.after(()=>fs.rmSync(created,{recursive:true,force:true,maxRetries:6,retryDelay:100})); + for(const [p,body] of records){ + const abs=path.join(root,p); + fs.mkdirSync(path.dirname(abs),{recursive:true}); + fs.writeFileSync(abs,body); + } + return root; +} +function count(t,entries){ + const root=workspace(t,entries),br=new BlastRadius(root); + try { + const graph=br.index(); + return {graph,state:br.status()}; + } finally {br.close();} +} +test('P4: two nested project owners count as exactly two indexed projects, not zero or three',t=>{ + const r=count(t,[ + ['tsconfig.json',JSON.stringify({files:[],references:[{path:'./apps/web'},{path:'./packages/ui'}]})], + ['apps/web/tsconfig.json',JSON.stringify({compilerOptions:{jsx:'react-jsx'},include:['src']})], + ['apps/web/src/page.tsx',"export const Page=()=>null;"], + ['packages/ui/tsconfig.json',JSON.stringify({compilerOptions:{declaration:true},include:['src']})], + ['packages/ui/src/Widget.ts',"export const Widget=()=>1;"] + ]); + assert.equal(r.graph.facts.length,2); + assert.equal(r.state.indexedProjects,2,'root solution config must not be counted as third source-owning project'); +}); +test('P4: source files with no explicit tsconfig belong to one fallback project',t=>{ + const r=count(t,[['src/main.ts',"export const main=42;"],['src/util.ts',"export const extra=7;"]]); + assert.equal(r.graph.facts.length,2); + assert.equal(r.state.indexedProjects,1); +}); +test('P4 negative: no indexed sources must report zero projects, not invent one',t=>{ + const r=count(t,[['tsconfig.json',JSON.stringify({files:[]})]]); + assert.equal(r.graph.facts.length,0); + assert.equal(r.state.indexedProjects,0); +}); From 7e649e621e26bf82c13d059f48160cbc42ff87c2 Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Mon, 23 Nov 2026 15:38:57 +0500 Subject: [PATCH 2/5] fix(p4): report real indexed TS project roots through Core and live MCP Preserve original red two-monorepo and fallback checks, count nearest tsconfig roots without empty solution configs, add official MCP SDK status assertion. Document verified OpenCode V2 local stdio config and limits; no release or dependencies changed. --- docs/MCP_SETUP.md | 37 +++++++++++++++++++++++++++- docs/evidence/P4_INDEXED_PROJECTS.md | 7 ++++++ packages/core/src/index.ts | 18 ++++++++++++-- tests/protocol/mcp-stdio.test.mjs | 1 + 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 docs/evidence/P4_INDEXED_PROJECTS.md diff --git a/docs/MCP_SETUP.md b/docs/MCP_SETUP.md index 3fbd061..793d080 100644 --- a/docs/MCP_SETUP.md +++ b/docs/MCP_SETUP.md @@ -1,6 +1,6 @@ # MCP setup — source preview -**Prerequisite:** `npm install && npm run build` inside the BlastRadius source checkout. Installations must contain the declared `@modelcontextprotocol/sdk` runtime dependency. Use your real absolute paths. This server has one trust boundary: the single workspace passed as `--root`. +**Prerequisite:** `npm ci --ignore-scripts --no-audit --no-fund` then `npm run build` inside the BlastRadius source checkout. Installations must contain the declared `@modelcontextprotocol/sdk` runtime dependency. Use your real absolute paths. This server has one trust boundary: the single workspace passed as `--root`. ## Codex (`~/.codex/config.toml`) @@ -30,3 +30,38 @@ For clients expecting `mcpServers`, place that entry under the `mcpServers` key. `br_status` tells whether a local index is available (a cached status can be `possibly_stale`). `br_resolve_symbol` resolves an explicitly named file symbol, `br_impact` walks reverse dependencies, `br_analyze_diff` compares Git snapshots, and `br_explain` describes the latest finding. Run the Skill from `skills/blastradius/SKILL.md` before/after refactors. **Status:** Five schemas and an explicit runtime input validator have 20 passing local contract tests. A real SDK stdio smoke (initialize → tools/list → sequential tools/call → invalid input rejection → workspace confinement → Git diff → snapshot-bound explain → shutdown) is checked into `tests/protocol/mcp-stdio.test.mjs` and is required by CI through `npm run test:mcp`. It **has not run locally** because this environment cannot install the official SDK from npm. Until an actual CI result is green, MCP interoperability remains unverified; use the CLI as the locally tested interface. + +## OpenCode V2 — local stdio (Windows and other desktops) + +OpenCode **V2** uses `mcp.servers.`, not V1's direct `mcp.`, and uses `disabled` (default false), **not** `enabled`. This format follows the [official current OpenCode MCP documentation](https://opencode.ai/docs/mcp-servers). Configure it in your **project's** `opencode.jsonc`, not a global file, and use actual absolute paths (forward slashes also work for Windows Node paths): + +```json +{ + "$schema": "https://opencode.ai/config.json", + "mcp": { + "servers": { + "blastradius": { + "type": "local", + "command": [ + "node", + "C:/work/BlastRadius/dist/packages/cli/src/main.js", + "mcp", + "--stdio", + "--root", + "C:/work/my-react-app" + ], + "protocol": "legacy", + "codemode": false + } + } + } +} +``` + +Then restart the client and use `opencode mcp list` to check its connected status. `protocol: legacy` matches the official MCP SDK initialize handshake in this development preview; `codemode: false` exposes the five tools directly. The local process receives no new credentials, does not require an HTTP endpoint, and will index **only** the explicit `--root`. Do not use `npx blastradius`: this preview remains private/unpublished. If running OpenCode V1, consult its version-specific configuration syntax instead of pasting a V2 server stanza. + +This documents the official configuration shape, **not an independent OpenCode V2 executable acceptance test**. The real official MCP SDK stdio smoke in the full CI verifies initialize/tools/call/errors/shutdown; actual OpenCode Desktop, Codex, Cursor and Claude end-client integrations still require client-specific tests before claiming universal support. + +## Project count semantics + +After `br_impact` or another indexing call, `br_status.indexedProjects` is the number of distinct source-owning nearest `tsconfig.json` directories in the in-process indexed snapshot; sources with no owner share one fallback project. An empty root solution/references-only config is not counted as an additional project. Before indexing, a persisted `possibly_stale` graph does not claim an independently verified project count. This is not a claim that TS project references are completely semantically modeled. diff --git a/docs/evidence/P4_INDEXED_PROJECTS.md b/docs/evidence/P4_INDEXED_PROJECTS.md new file mode 100644 index 0000000..9a67624 --- /dev/null +++ b/docs/evidence/P4_INDEXED_PROJECTS.md @@ -0,0 +1,7 @@ +# P4 — truthful indexedProjects in MCP status + +Original source-backed issue: the public CLI/Core/MCP status returned hardcoded `indexedProjects:0` even after indexing Radix/Ark/shadcn-style workspaces. Tests-only PR #25 `29655c628e7772dac160bab1c18ab6cf55008f51`, [Ubuntu Node22 first RED #45157247554](https://github.com/levencode-labs/blastradius/actions/runs/45157247554), job 137633228794: nested tsconfigs expected 2 got 0; tsconfig-free source expected 1 got 0; empty-source negative 0 remained PASS. No source execution, original independent corpus unchanged. + +The fix counts nearest source-owning `tsconfig.json` roots only after indexing or diff, with one fallback for unconfigured source and zero for empty source; the root solution config with no own source does not invent a third project. `status` reuses the in-memory indexing count without additional filesystem scan and does not claim a precise count for persisted-but-not-current snapshots. Live official SDK stdio smoke asserts the count. This does not add complete project references semantics, and neither validates every supported client application. + +OpenCode V2 example in `docs/MCP_SETUP.md` matches [official current V2 MCP documentation](https://opencode.ai/docs/mcp-servers) (`mcp.servers`, `disabled`, `protocol=legacy`), no global or credential changes. Release remains disabled, `private:true`, version `0.0.1-dev`. Full 8 OS/Node, byte parity, independent source/Knip and merge SHA gates required. diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index cea67e2..5125c25 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -15,6 +15,19 @@ export {analyzeFile} from './analyzer.js'; export class BlastRadius{ readonly root:string;readonly cache:GraphCache; private current?:Snapshot; + private currentProjectCount=0; + // Count nearest source-owning tsconfig roots; do not confuse an empty + // solution tsconfig with another independently indexed project. + private projectCount(files:Map,graph:Snapshot):number{ + const configs=[...files.keys()].filter(f=>f==='tsconfig.json'||f.endsWith('/tsconfig.json')) + .map(f=>path.posix.dirname(f)).sort((a,b)=>b.length-a.length); + const owners=new Set(); + for(const f of graph.facts){ + const owner=configs.find(dir=>dir==='.'||f.file.startsWith(dir+'/'))||''; + owners.add(owner); + } + return owners.size; + } constructor(root:string=process.cwd()) {this.root=realpathSync(path.resolve(root));this.cache=new GraphCache(this.root);} private graphFor(files:Map,config:Config,extraDiagnostics:Snapshot['diagnostics']=[],force=false):Snapshot{ const cached=force?undefined:this.cache.getSnapshot(snapshotId(files,config)); @@ -31,9 +44,10 @@ export class BlastRadius{ const config=readConfig(this.root); const scanned=scanWorkspace(this.root,config); const graph=this.graphFor(scanned.files,config,scanned.diagnostics,force); + this.currentProjectCount=this.projectCount(scanned.files,graph); this.current=graph;return graph; } - status(){const g=this.current||this.cache.getLatest();return {schemaVersion:1,status:g?(this.current?'ready':'possibly_stale'):'not_indexed',indexedFiles:g?.facts.length||0,indexedProjects:0,graphVersion:g?.id||null,coverage:g?.coverage||{complete:false,unresolvedImports:0,dynamicEdges:0,unsupportedFiles:0}};} + status(){const g=this.current||this.cache.getLatest();return {schemaVersion:1,status:g?(this.current?'ready':'possibly_stale'):'not_indexed',indexedFiles:g?.facts.length||0,indexedProjects:this.current?this.currentProjectCount:0,graphVersion:g?.id||null,coverage:g?.coverage||{complete:false,unresolvedImports:0,dynamicEdges:0,unsupportedFiles:0}};} resolveSymbol(file:string,name:string){const rel=safeFilePath(this.root,file);const g=this.index();const matches=g.nodes.filter(n=>n.kind==='SYMBOL'&&n.file===rel&&n.name===name);return {schemaVersion:1,status:matches.length===1?'resolved':matches.length?'ambiguous':'not_found',snapshot:g.id,symbol:matches.length===1?matches[0]:undefined,candidates:matches.length!==1?matches:undefined};} impact(request:ImpactRequest):ImpactResult{ const graph=this.index();return impact(graph,{...request,target:{...request.target,file:safeFilePath(this.root,request.target.file)}}); @@ -52,7 +66,7 @@ export class BlastRadius{ const before=this.graphFor(beforeFiles,beforeConfig); const after=this.graphFor(next.files,afterConfig,next.diagnostics); const result=analyzeDiff(before,after,changed,limit,mode); - this.cache.saveReport(result);this.current=after;return result; + this.cache.saveReport(result);this.currentProjectCount=this.projectCount(next.files,after);this.current=after;return result; } explain(findingId:string,expectedSnapshot?:string){const r=this.cache.getReport();if(expectedSnapshot&&r?.snapshot!==expectedSnapshot)throw new Error('SNAPSHOT_STALE: finding belongs to a different snapshot');const f=r?.findings.find(x=>x.id===findingId);if(!f)throw new Error('Finding not found; run diff first'); const before=r&&this.cache.getSnapshot(r.baseline);const nodes=new Map(before?.nodes.map(n=>[n.id,n])); diff --git a/tests/protocol/mcp-stdio.test.mjs b/tests/protocol/mcp-stdio.test.mjs index 78fbbe5..1737c02 100644 --- a/tests/protocol/mcp-stdio.test.mjs +++ b/tests/protocol/mcp-stdio.test.mjs @@ -81,5 +81,6 @@ test('MCP stdio: initialize, list, sequential call, schema rejection, path isola stage('status-after:begin'); const after=decode(await client.callTool({name:'br_status',arguments:{}})); assert.ok(after.graphVersion); + assert.equal(after.indexedProjects,1,'live SDK br_status must report the one source-owning fallback project'); stage('assertions:done'); }); From 751f41e43b5968a694ccd23a71413b8a8ba6bec5 Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Mon, 23 Nov 2026 15:43:26 +0500 Subject: [PATCH 3/5] docs(p2): record verified UNKNOWN boundaries without making deletion or route claims --- docs/evidence/P2_REMAINING_UNKNOWN.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/evidence/P2_REMAINING_UNKNOWN.md diff --git a/docs/evidence/P2_REMAINING_UNKNOWN.md b/docs/evidence/P2_REMAINING_UNKNOWN.md new file mode 100644 index 0000000..6568114 --- /dev/null +++ b/docs/evidence/P2_REMAINING_UNKNOWN.md @@ -0,0 +1,23 @@ +# P2 — remaining semantic UNKNOWN classes (no invented fixes) + +This document is an explicit boundary inventory, **not** proof that all TS/JS/React features are supported or safe for dead-code deletion. Engine fixes to date are source-backed and scoped; do not convert these unknown relations into true negatives. + +| Class | Exact source example / observed boundary | Required independent proof before extending analyzer | +| --- | --- | --- | +| React component factories / HOC and prop spread | [Radix primitives at `eb3a2b7091293e27df8f9ba906632d8daa3d81a3`](https://github.com/radix-ui/primitives/blob/eb3a2b7091293e27df8f9ba906632d8daa3d81a3/packages/react/primitive/src/primitive.tsx): `NODES.reduce`, `React.forwardRef`, runtime ``; [dialog test at same SHA](https://github.com/radix-ui/primitives/blob/eb3a2b7091293e27df8f9ba906632d8daa3d81a3/packages/react/dialog/src/dialog.test.tsx): `` | Preserve `POSSIBLE_PROP_USAGE` and uncertain dynamic member dispatch; separate source-backed before/after + positive/negative controls for each statically *provable* value-flow subset | +| Computed runtime imports | [React Router at `9916920a490c018eb78d7cc8c55a0efd6e9feac9`](https://github.com/remix-run/react-router/blob/9916920a490c018eb78d7cc8c55a0efd6e9feac9/packages/react-router/lib/dom/ssr/route-discovery.ts): `import(/* @vite-ignore */ manifest.url)` | Runtime URL is not source-exact; retain `DYNAMIC_IMPORT_UNRESOLVED` and `possible_dynamic`, do not guess target from nearby files | +| React Router configuration and nontrivial Next routes | React Router's runtime route discovery/manifest and Next App Router interception/parallel slots are beyond the current file-pattern adapter | Independent route-to-entry oracle + negative controls for grouped/parallel/intercepting routes; an unproven affected screen remains UNKNOWN | +| Module evaluation side effects | [SWR at `8148ef012fd5b317d1e8ec2da4b2ca0673f63c0f`](https://github.com/vercel/swr/blob/8148ef012fd5b317d1e8ec2da4b2ca0673f63c0f/src/_internal/index.ts) executes `setupDevTools()` at top level | Runtime side effects, plugin registration and public API require effects-root evidence; a test-only or apparently unused export cannot be auto-deleted | +| Package condition mapping | TanStack Form `5de1a8de01e3d63a0e5225a7e659a384f3a0effb` and React Hook Form `8d7bd6c2c774fd9b4310e8cbc07d36ce1cacf736` declare dist-only package exports. PR #21 closed a false verified dist-to-src fallback | Complex runtime conditions, `browser`, type-vs-runtime and unpublished dist-source equivalence remain UNKNOWN unless the exact declared target and environment are proved | +| TypeScript project references and workspace ownership | Radix `eb3a2b7` uses `pnpm-workspace.yaml` and `@repo/typescript-config/react-library.json` extends `./base.json`; PR #19 models the uniquely owned subset | Multi-config projects, incomplete external references, ambiguous workspace owner/negation and compiler-excluded source must not silently generate a verified edge | + +## Independently observed unknown coverage + +First P7 source-frozen score at [Actions run #45155575563](https://github.com/levencode-labs/blastradius/actions/runs/45155575563), SHA `b9b53cc053bf0978c50d86a463ddcdc8d677ec1b`: + +- P7 specifically: **5310 of 10124** attempted named imports were external or independently unresolved (**52.45%**), outside the 4814 eligible pair denominator. Other omitted imports: **1093**. +- Diagnostic counts across its three projects: **24285 unresolved import observations, 21150 dynamic possibilities, 4192 unsupported/incomplete**. These are diagnostic events, not independent sample denominators. +- **0/3 P7 graphs complete.** Despite 0 FP/FN on 18 manually labeled and 4814 eligible compiler-resolvable relations, no universal recall, runtime graph completeness, side-effect safety or deletion authorization is established. +- A later performance optimizer informed by this P7 evaluation means this cohort must be declared **exposed for future release conclusions**. Select and freeze a new independent P8 before claiming release-level blind post-change accuracy. + +Follow-up engineering gates: retain the exact source cases and original red reports, reduce one supported semantic class at a time with strict negative controls, test all 8 OS/Node cells plus byte parity, independently score pre-frozen sources without relabeling, and reaccept the exact merge SHA. Do not publish `v0.1.0` or automate deletion from these partial graphs. From a8ed165112bf76f356e00daf70d06dc9b8fd700e Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Mon, 23 Nov 2026 16:03:39 +0500 Subject: [PATCH 4/5] docs(p4): bring EN/RU guides, agent Skill and release gates up to actual P7/P3 evidence Preserve exact P7 first-score 15-source metrics and UNKNOWN denominators, original P3 red and repeated 5k/50k synthetic performance in dated acceptance ledger. Clarify client-specific and legal blockers; explain safe CACHE_BUSY behavior. Keep private 0.0.1-dev and no publication. --- README.md | 8 ++++---- README.ru.md | 6 +++++- docs/ACCEPTANCE.md | 15 +++++++++++++++ docs/PUBLICATION_STATUS.md | 6 ++++++ skills/blastradius/SKILL.md | 2 ++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6e5ca1a..65306af 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Local impact analysis · Git differential orphan detection · CLI + MCP + Agent -> **Development preview (0.0.1-dev), not a v0.1.0 release.** The 30 curated goldens, 120 baseline tests and live official MCP SDK stdio have passed hosted CI. A frozen npm v3 lock, provenance/license metadata check and repeatable packed-consumer smoke are now tracked by [P1](docs/P1_SUPPLY_CHAIN.md). Real-project accuracy, complete TypeChecker semantics and license-text/NOTICE sign-off remain open. Never auto-delete orphan findings. +> **Development preview (0.0.1-dev), not a v0.1.0 release.** The original 30 goldens and live official MCP SDK stdio have passed hosted CI, with additional pinned public-source regressions and a separate first-score independent corpus. Test counts and the exact SHA gates are recorded in [Acceptance](docs/ACCEPTANCE.md); do not infer graph completeness from a green scoped oracle. A frozen npm v3 lock, provenance/license metadata check and repeatable packed-consumer smoke are now tracked by [P1](docs/P1_SUPPLY_CHAIN.md). Real-project accuracy, complete TypeChecker semantics and license-text/NOTICE sign-off remain open. Never auto-delete orphan findings. BlastRadius helps coding agents and developers answer two questions **before and after a refactor**: @@ -77,7 +77,7 @@ These are not proof that either declaration can safely be deleted. External cons ### Independent public-source evaluation -The [pinned independent source/Knip study](docs/evidence/P2_PUBLIC_ACCURACY.md) reproduces and fixes 13 missed static bindings in real usehooks-ts and Next.js source, then scores **215 true-positive and 5 true-negative relations with no FP/FN among 220 compiler-resolvable pairs**. The full projects nevertheless have **incomplete/unknown graph coverage**; these metrics must not be generalized or treated as authorization to remove code. See the [before/after evidence](docs/evidence/p2-public-post-fix.json) and limitations before interpreting the result. +The historical [three-project accuracy study](docs/evidence/P2_PUBLIC_ACCURACY.md) found 13 missed bindings and fixed them. A later **15-repository source-pinned evaluation** on the first-score P7 SHA `b9b53cc053bf0978c50d86a463ddcdc8d677ec1b` measured **70 TP, 46 TN, 0 FP/FN among 116 independently annotated references**, and **8749 TP, 30 TN, 0 FP/FN among 8779 compiler-resolvable named-import pairs**; the 18 P7 labels were frozen in a separate earlier commit. P7 alone had **5310 external or unresolved imports out of 10124 attempted** and all three entire graphs were incomplete. The complete 15-repo evaluation remains a *curated static subset*, not a representative precision/recall estimate or code-deletion authorization. See [P7 evidence](docs/evidence/P7_FIRST_SCORE.md) and [UNKNOWN boundaries](docs/evidence/P2_REMAINING_UNKNOWN.md). ## Implementation status @@ -86,10 +86,10 @@ The [pinned independent source/Knip study](docs/evidence/P2_PUBLIC_ACCURACY.md) | TypeScript AST, static imports, exports, barrels | Basic graph and resolution implemented | Compiler-backed semantic identity, ambiguity and more workspaces | | React and Next.js | JSX references/props and App/Pages route patterns | Advanced HOCs, redirects, special routes, richer prop spreads | | Git differential orphan analysis | HEAD/index/worktree, broken references, affected route/test summary and test/story classification | Git rename identity, complex public API/side-effect cases | -| SQLite | Persistent graphs, file facts, transactional writes, forced rebuild and cache symlink protection | Process concurrency, hardening and migration matrix | +| SQLite | Persistent graphs, file facts, transactional writes and symlink protection; source-backed SQLite lock classification regression in PR #23 | More concurrent process modes, cancellation/crash recovery and migration matrix | | CLI | Core commands with JSON | Full pagination and stricter input contracts | | MCP and Skill | Five input-validated tools, snapshot-bound explain and agent Skill; official SDK stdio PASS in all 8 CI cells | Additional clients/resources, formal response contract and integration breadth | -| Acceptance | 120 P2 baseline tests + 30 hand-labeled goldens + 8 TypeChecker oracles and 8-cell CI PASS | Real-world pinned precision/recall, richer semantic model, repeatable performance and v0.1.0 release review | +| Acceptance | 30 golden fixtures, official SDK CI, 15 SHA-pinned public-source evaluation with explicit UNKNOWN; 5k/50k repeated synthetic profiles from a separate exact PR SHA | Real monorepo repeated p50/p95, complete graph coverage boundaries, independent post-change untouched holdout, legal review, v0.1.0 release decision | The full [requirements and acceptance matrix](docs/ACCEPTANCE.md) distinguishes tests that ran locally from targets and unverified behaviors. diff --git a/README.ru.md b/README.ru.md index 7846215..035337c 100644 --- a/README.ru.md +++ b/README.ru.md @@ -42,8 +42,12 @@ node dist/packages/cli/src/main.js diff --base HEAD --root /absolute/path/to/pro ## Текущий статус -Основной граф TS/JS, CLI, MCP и Skill доступны в исходниках. **30 формальных golden-сценариев и 120 базовых тестов проходят**, а [CI на Linux, Windows и macOS (8/8)](https://github.com/levencode-labs/blastradius/actions/runs/45003627005) подтвердила настоящий MCP stdio на Node 22/24. [P1](docs/P1_SUPPLY_CHAIN.md) добавляет зафиксированный `package-lock.json`, неизменяемый `npm ci`, проверку лицензий зависимостей и реальную сборку/установку npm-архива. Остаются независимые измерения точности на реальных проектах, сложная семантика TypeChecker, проверка юридических текстов лицензий и релизная приёмка; автоматически удалять найденный код нельзя. +Основной граф TS/JS, CLI, MCP и Skill доступны в исходниках. **30 формальных golden-сценариев и реальный MCP stdio** подтверждены в CI Linux/Windows/macOS на Node 22/24. Последняя независимая выборка из 15 Git-SHA-закреплённых репозиториев дала 70 TP / 46 TN по 116 ручным меткам и 8749 TP / 30 TN по 8779 разрешимым TypeScript-связям, без наблюдаемых FP/FN в этом ограниченном наборе. Однако все сложные графы могут оставаться неполными, а только в P7 **5310 из 10124** попыток импортов не вошли в проверяемую область. Это не разрешение удалять код автоматически. [P1](docs/P1_SUPPLY_CHAIN.md) добавляет зафиксированный `package-lock.json`, неизменяемый `npm ci`, проверку лицензий зависимостей и реальную сборку/установку npm-архива. Остаются независимые измерения точности на реальных проектах, сложная семантика TypeChecker, проверка юридических текстов лицензий и релизная приёмка; автоматически удалять найденный код нельзя. ## Лицензия Исходный код проекта — MIT; перед публикацией npm нужна проверка всех зависимостей и платформ. + +## Проверяемые границы и скорость + +Подробные [итоги P7 и приёмочные ограничения](docs/ACCEPTANCE.md) показывают, что наличие `UNKNOWN` не означает отсутствие зависимостей. Сложные React HOC/spread, динамический React Router, `side effects` и условные package exports нельзя превращать в гарантированно безопасное удаление. Выполнены отдельные синтетические измерения **5000 × 3** и **50000 × 3** файлов (p50/p95 времени и RSS), но повторяемость на реальных монорепозиториях и полный audit/NOTICE ещё открыты. Подключение к OpenCode V2 в режиме stdio описано в [MCP_SETUP.md](docs/MCP_SETUP.md); настоящая интеграция с его установленным Desktop-клиентом отдельно не подтверждена. diff --git a/docs/ACCEPTANCE.md b/docs/ACCEPTANCE.md index 3fc7f95..f8c1bd4 100644 --- a/docs/ACCEPTANCE.md +++ b/docs/ACCEPTANCE.md @@ -36,3 +36,18 @@ A read-only study at three exact pinned TypeScript/React/Next.js Git SHAs and Kn | Performance | One synthetic 5,001-file timing in old preview | Repeat p50/p95, RSS and cold/warm updates on real repositories, 50k-file evaluation | **No task may reduce the CI matrix after a failure to manufacture a pass. No release, tag, or npm publication is part of P1.** + +## P6/P7 independent-source expansion — accepted preview evidence (2026-11-23) + +- The first P6 source freeze `d7fecd7fd88fbb610292cbfe5ace7490df89904b` preserved 9 old sources/80 labels and added three sources/18 pre-picked labels. Original [RED CI #45031866212](https://github.com/levencode-labs/blastradius/actions/runs/45031866212) had 4 manual and 23 compiler-resolvable FNs from pnpm-owned workspace tsconfig. Separate regression-first fix PR #19; accepted P6 post-fix merge `abf5f93239c415ad7b31d1d4e32c774b9f520fab` [9/9 OS/Node + parity](https://github.com/levencode-labs/blastradius/actions/runs/45034364022) and [independent oracle/Knip](https://github.com/levencode-labs/blastradius/actions/runs/45034364047). P6 became **exposed**, not pristine. +- The **new pristine P7** exact source SHAs (TanStack Query `0827cf2c`, Ark UI `844114ee`, shadcn-ui `bfa64ff4`) and **18 manual labels** were committed before scoring in source-only PR #20, original SHA `f22405477cc3db4c34c5076196a2179400988905`. First scoring on `b9b53cc053bf0978c50d86a463ddcdc8d677ec1b`: [independent action #45155575563](https://github.com/levencode-labs/blastradius/actions/runs/45155575563), retained report artifact **14808372815**. P7: 12 TP/6 TN manual, 4809 TP/5 TN eligible named-import pairs; 0 FP/FN in both restricted units. **5310/10124 attempted named bindings excluded as external/unresolved**, 0/3 complete graphs. Original three Knip 6.45.1 mutations unchanged. +- Combined 15 public SHA pins/116 manual labels = **70 TP, 46 TN, 0 FP/FN**; 8779 independently compiler-resolvable named-import pairs = **8749 TP, 30 TN, 0 FP/FN**. These counts are intentionally NOT population estimates. No unknown source is treated as TN or safe-to-delete. PR #22 merged as `d3aa2273070159cba37e019cbbf7a17ea8082615`, [9/9 merge-SHA CI](https://github.com/levencode-labs/blastradius/actions/runs/45158415745), [independent oracle/Knip](https://github.com/levencode-labs/blastradius/actions/runs/45158415723) PASS. +- An optimization inspired by P7 graph timing is in PR #24: the P7 cohort must therefore be considered **exposed for subsequent post-change release claims**, even though its original independent first score remains valid for the prior engine. A fresh untouched P8 source-only freeze is in PR #26 with no scores at freeze time. Do not backfill labels from the analyzer. + +## Preliminary performance and concurrency (not v0.1.0 acceptance) + +- Real original P7 cold index (one run each): 2194 source files/13.7 s, 5006/84.7 s, 4426/96.4 s. The quadratic directory-resolution defect was reproduced with **160000 key enumerations** for 400 indexed files/200 proved imports in original [PR #24 RED CI #45156809769](https://github.com/levencode-labs/blastradius/actions/runs/45156809769). New algorithm indexes directories once per snapshot; no accuracy or UNKNOWN narrowing is authorized. +- On isolated performance candidate `cd41d0b31f7e8c592dba364537e9d2a368a11c6c` [exact GitHub Actions #45161031819](https://github.com/levencode-labs/blastradius/actions/runs/45161031819), 3 synthetic samples at each size: 5000 files cold p50/p95 **956/1302 ms**, warm **64/70 ms**, one-source-edit **301/318 ms**, peak RSS **264 MiB**; 50000 files cold **7895/8010 ms**, warm **723/750 ms**, edit **3239/3271 ms**, peak **865 MiB**. All 5001/50001 graph files were indexed. These are **three synthetic import-chain samples**, not representative real-repo p95, and the optimizer PR must separately pass full CI and merge SHA. +- A real SQLite cross-process write lock was misreported as cache corruption in original [PR #23 RED #45156045867](https://github.com/levencode-labs/blastradius/actions/runs/45156045867). Scoped repair distinguishes `CACHE_BUSY` from actual corruption and retains Windows/macOS path safeguards. This does NOT prove multi-writer performance, cancellation recovery, database integrity under crashes or complete migration compatibility. + +**Still OPEN for first npm release:** complete license text/NOTICE and provenance review, client-specific OpenCode/Codex/Cursor/Claude integration beyond official SDK stdio smoke, real monorepo cold/warm/update p50/p95, concurrency/cancel recovery, semantic hard cases including dynamic import/React props/route config and external consumers, and an independent post-change blind holdout. Keep `private:true`, `0.0.1-dev`; do not create any release, tag, or npm publication. diff --git a/docs/PUBLICATION_STATUS.md b/docs/PUBLICATION_STATUS.md index ff2e067..afd3a96 100644 --- a/docs/PUBLICATION_STATUS.md +++ b/docs/PUBLICATION_STATUS.md @@ -22,3 +22,9 @@ The unchanged eight-cell CI matrix uses `npm ci --ignore-scripts --no-audit --no ## Remaining blockers for v0.1.0 Independent pinned real-project precision/recall, broader semantic coverage, monorepo/concurrency benchmarks, complete third-party license-text/NOTICE and security provenance review, package-manager/toolchain version provenance, and formal final release acceptance. Results from one SHA must not be attributed to another. All eight CI cells remain mandatory even after a failed attempt. + +## Updated public evidence and release prohibition (2026-11-23) + +The latest independently accepted source evaluation is [PR #22](https://github.com/levencode-labs/blastradius/pull/22) at merge SHA `d3aa2273070159cba37e019cbbf7a17ea8082615` ([8 platform + byte-parity action](https://github.com/levencode-labs/blastradius/actions/runs/45158415745), [15-pinned-source TypeChecker/Knip action](https://github.com/levencode-labs/blastradius/actions/runs/45158415723), both PASS). Scope is 116 independently annotated static pairs and 8779 compiler-resolvable direct named-import pairs, with 0 observed FP/FN **only inside these eligible denominators**; 0/3 pristine P7 full graphs complete. See [latest acceptance and unknown gates](ACCEPTANCE.md). + +P3/P4 source changes are under separate exact CI and must not inherit this accepted P7 SHA's result. Candidate improvements include concurrent SQLite lock error classification, large-source directory-index optimization, synthetic 5k/50k profiling and truthful MCP `indexedProjects`; each requires exact PR-SHA eight-cell push/PR plus package byte parity, independent source/Knip and merge-SHA retesting. A separate P8 source-only cohort is frozen before first evaluation for post-change release checks. None of these checks authorizes `v0.1.0` or automatic deletion; full dependency license texts, NOTICE and runtime/client behavior remain unaccepted. diff --git a/skills/blastradius/SKILL.md b/skills/blastradius/SKILL.md index d9399a8..15fdf95 100644 --- a/skills/blastradius/SKILL.md +++ b/skills/blastradius/SKILL.md @@ -28,4 +28,6 @@ Use this Skill when an agent plans to delete a feature, rename or move a module, - Never treat `verified` as proof of runtime safety, or `no known consumers` as proof of no consumers. - If coverage is incomplete or any dynamic dependency can reach a candidate, report UNKNOWN/review and do not claim a safe deletion. - Keep project sources local. BlastRadius analyses are read-only except its own cache and an explicitly requested `init` config file. +- An indexing status of `possibly_stale` is not proof that the current working tree was analyzed. An `indexedProjects` count is a scope summary, not full TypeScript project-reference coverage. +- A `CACHE_BUSY` response means concurrent SQLite activity: retry after the other local process finishes; **do not delete the cache database to resolve a lock**. True `CACHE_CORRUPTED` remains a separate diagnostic requiring user-controlled backup/recovery. - MCP clients must mount only trusted local workspaces; never grant a remote agent arbitrary command execution via this Skill. From 6fff1ace363d9c8cbe0cea5ed978549caa65a9b4 Mon Sep 17 00:00:00 2001 From: AlexanderLevenskikh Date: Mon, 23 Nov 2026 16:10:24 +0500 Subject: [PATCH 5/5] docs(p4): reconcile current acceptance table with 15-project accuracy and 50k profiling Replace stale first-stage open gates with exact proven byte parity, source-pinned P7 precision scope, synthetic 5000/50000 p50/p95 and bounded SQLite lock regression. Keep full post-change blind holdout, real-monorepo speed, client integration, NOTICE and release still unaccepted. --- docs/ACCEPTANCE.md | 12 ++++++------ docs/PUBLICATION_STATUS.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/ACCEPTANCE.md b/docs/ACCEPTANCE.md index f8c1bd4..040b078 100644 --- a/docs/ACCEPTANCE.md +++ b/docs/ACCEPTANCE.md @@ -25,15 +25,15 @@ A read-only study at three exact pinned TypeScript/React/Next.js Git SHAs and Kn | Area | Verified preview evidence | Remaining v0.1.0 work | | --- | --- | --- | -| Symbol graph | Imports/aliases/barrels, TypeScript paths, JSX, distinct export bindings; 8 independent TypeChecker alias checks | Fully semantic symbol identity, overload/merged declarations, multiple tsconfig/project refs, richer namespace cases | +| Symbol graph | Scoped overload/type-value/namespace cases, safe bounded import expressions, workspace-owned pnpm tsconfig and exact conditional exports; compiler oracles | Full TS project references, external/public consumers, advanced HOC/prop value flow, dynamic runtime identity | | Impact and routes | React JSX, Next App/Pages and layout relationships, `apps/*` and `packages/*` Next roots | React Router, HOC/spread prop flow, interception routes and arbitrary bundler extensions | | Differential analysis | Git HEAD/index/worktree, newly orphaned unchanged exports, public API transitions, unambiguous unchanged-source rename, uncertainty warnings | Edited-file rename fingerprints, arbitrary dynamic imports, complete package API boundary matrix and external consumer evidence | | Conservative deletion | Side-effect and public API protection, unknown coverage handling, manual candidate review | Expand effect corpus, dynamic/plugin entry point policies; no automatic deletion in MVP | -| Persistent cache | SQLite snapshots and invalidation, symlink and corruption protections | Multiple concurrent processes, crash/cancel recovery, long-running project memory profiles | -| CLI and MCP | 78 baseline tests, five MCP tools, live stdio E2E on previously checked CI SHA | Full audited flags/compatibility matrix and formal response schema/documentation stability | -| Accuracy | All 30 curated goldens and 8 TypeChecker checks; 0 FP/FN on **39 annotated assertions only** | Independent pinned public-repository corpora, unbiased labeling, precision ≥95% / recall ≥90% with unknown coverage disclosed | -| Reproducibility | npm lockfile v3 (98 SHA-512-integrity packages), clean `npm ci` on 8 OS/Node cells, strict SPDX metadata inventory and repeated real npm pack + consumer smoke in P1 | 8-cell cross-OS tarball SHA equality (mandatory P1 aggregation), full license text/NOTICE review, security provenance and independent release approvals | -| Performance | One synthetic 5,001-file timing in old preview | Repeat p50/p95, RSS and cold/warm updates on real repositories, 50k-file evaluation | +| Persistent cache | SQLite snapshots/invalidation, symlink/corruption boundaries; real cross-process BUSY-vs-CORRUPTED source-backed recovery regression | Simultaneous write policies, crash/cancel recovery, schema migration compatibility and long-running profiles | +| CLI and MCP | Five validated MCP tools, official SDK stdio E2E on 8 OS/Node cells, source-bounded JSON schemas; indexed-project status regression in P4 candidate | Client-specific OpenCode/Codex/Cursor/Claude E2E, stable response/schema contracts and broader tool UX | +| Accuracy | 30 curated goldens plus 15 SHA-pinned public projects (116 manual and 8779 compiler-resolvable pairs, 0 observed FP/FN in those eligible units) | Unbiased representative sampling, after-change pristine holdout, explicit dynamic/external UNKNOWN and whole-graph limitations | +| Reproducibility | npm lock v3 with 98 exact SHA-512 package locations, frozen `npm ci`, installed SPDX metadata and pack+consumer smoke; **8-cell cross-OS byte parity PASS** on accepted SHAs | Full source-license texts/NOTICE and redistribution audit, security/build provenance and independent release approvals | +| Performance | Exact P3 candidate has 5000 × 3 and 50000 × 3 cold/warm/one-edit synthetic p50/p95 and RSS; algorithmic 160000-key RED evidence | Post-merge independent repeatable real monorepo p50/p95, multi-process contention and memory soak | **No task may reduce the CI matrix after a failure to manufacture a pass. No release, tag, or npm publication is part of P1.** diff --git a/docs/PUBLICATION_STATUS.md b/docs/PUBLICATION_STATUS.md index afd3a96..dc4f5b7 100644 --- a/docs/PUBLICATION_STATUS.md +++ b/docs/PUBLICATION_STATUS.md @@ -11,11 +11,11 @@ - npm v3 lockfile with **98 exact third-party package locations**, each from the public npm registry with SHA-512 integrity. Verified SHA-256: `6ed4a0d76c2ca5b315183e0d003de014ba38e30ddda990ad47d75ac12d6242c4`. [Source artifact run #45010837672](https://github.com/levencode-labs/blastradius/actions/runs/45010837672). - Exact P1 first-stage SHA `ed9b4a10ce23f1c9a64f08e8a6fb69b569666412` passed **8/8 frozen `npm ci` push + 8/8 PR jobs**: [push #45011541337](https://github.com/levencode-labs/blastradius/actions/runs/45011541337) and [PR #45011582483](https://github.com/levencode-labs/blastradius/actions/runs/45011582483). -- The [P1 branch/PR](https://github.com/levencode-labs/blastradius/pull/4) adds an isolated consumer install of the actual tarball and CLI `--help` smoke on every OS/Node combination. **This later change requires its own exact-head full green before merge.** +- The [P1 branch/PR](https://github.com/levencode-labs/blastradius/pull/4) adds an isolated consumer install of the actual tarball and CLI `--help` smoke on every OS/Node combination. **Later exact-HEAD package smoke and the cross-platform byte-parity comparison were accepted in subsequent merged CI; the first-stage evidence above is retained as historical provenance.** - Installed dependency license metadata and checked-in [98-location SPDX catalog](THIRD_PARTY_LICENSES.md) are examined on each host. This is **not** full manual legal review of license texts, copyright or NOTICE obligations. - The `npm pack` archive contains CLI, Core, MCP and Skill but **not** embedded runtime dependencies. It is **not** an offline one-file package. -An additional mandatory `package-byte-parity` job compares each cell's genuine tarball SHA-256 and fails closed on any missing/different artifact. An original Windows/Linux byte difference traced to `LICENSE` CRLF checkout (Windows 1092 bytes versus LF 1071), so `.gitattributes` now requests LF for `LICENSE` on all hosts. The full gate must be green on the exact new SHA before merge. +The mandatory `package-byte-parity` job compares each cell's genuine tarball SHA-256 and fails closed on any missing/different artifact; it has passed on multiple accepted merge SHAs (see the current [acceptance ledger](ACCEPTANCE.md)). An original Windows/Linux byte difference traced to `LICENSE` CRLF checkout (Windows 1092 bytes versus LF 1071), so `.gitattributes` now requests LF for `LICENSE` on all hosts. The full gate must be green on the exact new SHA before merge. The unchanged eight-cell CI matrix uses `npm ci --ignore-scripts --no-audit --no-fund`, validates all declared installed packages and reproducibly packs an archive twice with matching bytes. It never publishes. See [P1 design and provenance](P1_SUPPLY_CHAIN.md).