feat(context): expose verified cache controls and optimize snapshot closure

This commit is contained in:
Agent Workbench Dev
2026-11-01 02:35:47 +08:00
parent be126525c5
commit 7a7e0bbe87
27 changed files with 2452 additions and 26 deletions
+9 -1
View File
@@ -7,7 +7,7 @@
| A 测量 | 已完成 | project-cache-a-evidence/baseline.json;3种样本各冷/热3轮/新实例/同大小mtime修改,共18次 |
| B 有界缓存 | 已实现/专项通过 | 8项目、内存/磁盘各32MiB、单项目8MiB;目录/文件/结构/摘要核对,失败回退 |
| C 严格失效 | 已实现/专项通过 | 22/22含旧索引;配置/分支、同大小mtime、权限/链接、不完整扫描、并发变化及清除竞态 |
| D 产品入口 | 待开发 | 工程索引/诊断、桌面/390px |
| D 产品入口 | 已实现/7组通过 | 实际Edge1440/390px:核对/复用、同大小mtime失效、开关保存/刷新、清除重建、错误重试、诊断、键盘/触控/对比度 |
| E 同题工程 | 待验收 | Node/React/Python、检查/页面/Git |
| F 完整发行 | 待验收 | 独立源码、完整UI、便携/安装/升级、原生回看 |
@@ -26,3 +26,11 @@ QA使用独立目录和端口。本地解析命中、上游prompt缓存、实际
仅保存声明/导入和派生签名,没有源码正文、模型Key、请求、审批或工具结果。内存与磁盘各最多8项目/32MiB,单项目8MiB;超限仍返回当前索引。损坏摘要/JSON/字段重建,外链目录、软/硬链接缓存文件拒绝。settings仅保存enabled;清除仅删除当前项目摘要命名的派生文件。原工件和冻结请求不改写。
新增11项加原11项共22/22通过,原日志project-cache-bc-evidence/fixed.tap。第一次8/9暴露损坏symbols含null的验证器异常,修正结构检查后重建通过,失败原件first-failure.tap保留。实际chmod只证明文件mode变化;拒绝读取通过EACCES注入验证,不把注入称为Windows ACL实机。性能与完整工程结果待E。
## D 产品与闭合复核优化
沿用工程索引的检索布局;新增折叠「解析缓存」,显示上次检索核对、实际复用/重新解析、失效原因、耗时及存储状态。开关明确为全机,清除仅本项目;清除后保持上次检索并说明下次重建,避免伪造新核对时间。诊断只读取缓存状态,不运行检索。1440/390px实际Edge7组通过,已目视回看desktop-warm.png/narrow-cache.png;44px关键操作、键盘和实际指标文字4.5:1以上通过。入口初步验证版本仍为1.18开发构建,正式1.19会在F独立包重新验证。
API2/2通过,包括桌面token、精确字段、项目归属、清除后完整会话导出/配置/源码保持和真实宿主重启后持久开关/解析复用;伴随端真实TLS观察设备访问/配置缓存各端点均404,1/1通过。没有新增手机管理权限或iPhone实机结论。
初次比较显示两次完整工程检查/每次重写磁盘使热检索回退,原计时保留project-cache-d-evidence/comparison-first.json。优化仅将第二次声明/Git status/filter配置等无关复查替换为文件句柄两轮SHA闭合、文件集/Git身份核对,未变化派生文件只更新淘汰时间。优化22/22通过,原日志closure.tap;最终同题统计仍待E。UI/接口首轮失败为导出即时exportedAt比较及Playwright同步uncheck,与产品数据损坏无关;仅验证并剔除导出时间,其他完整字段保留比较,切换改为click并等待服务端保存,原件封存。
+6
View File
@@ -13,3 +13,9 @@
## B/C 回顾
补齐缓存身份和来源闭合,而非只把旧Map写到磁盘。两轮SHA读取增加成本,E必须与原基线一起报告。首轮损坏结构验证失败已修正并保留原失败,后续结构字段先验证再使用。22/22通过后进入D,把当前核对、上次检索和派生存储分清,清除不应假装执行了新检索。来源链接测试和缓存目录链接拒绝分开证明,实际权限mode与注入EACCES明确标注。
## D 回顾
真实截图回看新增区域在右侧工程检索内成立,390px无溢出;显示真实检索核对、文件命中和失效原因,未另造仪表盘。开关等待服务端保存,失败保留旧状态;QA应等待实际反馈而非要求同步DOM改变。导出只剔除并验证exportedAt,不放宽会话/执行/项目比较。
测量发现初版复核重复工作造成回退,已优化闭合流程和未变化材料写盘,同时保留原回退数据。本地复用不等于所有工程更快,E仍需在冷/热/失效及三工程真实检查链上检验收益与开销。后续F必须将新缓存入口纳入独立源码和便携验收,而非只跑开发目录。
@@ -0,0 +1,963 @@
{
"success": true,
"phase": "comparison",
"at": "2026-10-31T18:30:52.947Z",
"node": "v24.22.1",
"interpretation": "Local derived parsing only. Source reads include declarations and all current hashes. No model calls or token/cost inference.",
"rows": [
{
"language": "node",
"case": "cold",
"durationMs": 234.88460000000003,
"sourceReads": 220,
"sourceBytesRead": 647968,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:49.397Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 41.13199999999992,
"durationMs": 232.38850000000002,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "93e3054586e31d8128a1166c26500c6bf33ad8610ed3fa3790169208c38016d3",
"indexFingerprint": "36b435351614707fb921d992816e8a0f7fbf26087a3e17ca3ae751388f3d2dcc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-1",
"durationMs": 157.9719,
"sourceReads": 148,
"sourceBytesRead": 432040,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:49.556Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 155.58859999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "93e3054586e31d8128a1166c26500c6bf33ad8610ed3fa3790169208c38016d3",
"indexFingerprint": "36b435351614707fb921d992816e8a0f7fbf26087a3e17ca3ae751388f3d2dcc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-2",
"durationMs": 201.40670000000006,
"sourceReads": 148,
"sourceBytesRead": 432040,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:49.758Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 199.21769999999998,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "93e3054586e31d8128a1166c26500c6bf33ad8610ed3fa3790169208c38016d3",
"indexFingerprint": "36b435351614707fb921d992816e8a0f7fbf26087a3e17ca3ae751388f3d2dcc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-3",
"durationMs": 166.32299999999998,
"sourceReads": 148,
"sourceBytesRead": 432040,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:49.924Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 164.07100000000003,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "93e3054586e31d8128a1166c26500c6bf33ad8610ed3fa3790169208c38016d3",
"indexFingerprint": "36b435351614707fb921d992816e8a0f7fbf26087a3e17ca3ae751388f3d2dcc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "new-indexer",
"durationMs": 159.5937,
"sourceReads": 148,
"sourceBytesRead": 432040,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:50.085Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 157.92650000000003,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "93e3054586e31d8128a1166c26500c6bf33ad8610ed3fa3790169208c38016d3",
"indexFingerprint": "36b435351614707fb921d992816e8a0f7fbf26087a3e17ca3ae751388f3d2dcc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "same-size-mtime-change",
"durationMs": 201.99649999999997,
"sourceReads": 149,
"sourceBytesRead": 435008,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:50.286Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0.5821000000000822,
"durationMs": 199.89019999999994,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "123ec538a6b4cb03e28cf51b4e0b9aa90a887531087c54e4164b0ee729ccb33f",
"indexFingerprint": "1b23ead02b5f2dea23456a3cce28cd6112156803d1db288ab7398a5661ec08de",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "cold",
"durationMs": 260.48160000000007,
"sourceReads": 220,
"sourceBytesRead": 901340,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:50.562Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 75.78450000000066,
"durationMs": 258.0392999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "e52d08fcd5856616ad9fc81a6276f14bfbba7093af765b085577645cf56bedb7",
"indexFingerprint": "f73588c8506d537a2497b148b042f57ccb574c71a4a168f8e781f2f617c9bdaa",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-1",
"durationMs": 300.2406000000001,
"sourceReads": 148,
"sourceBytesRead": 600956,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:50.862Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 298.1725000000001,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "e52d08fcd5856616ad9fc81a6276f14bfbba7093af765b085577645cf56bedb7",
"indexFingerprint": "f73588c8506d537a2497b148b042f57ccb574c71a4a168f8e781f2f617c9bdaa",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-2",
"durationMs": 296.1054999999999,
"sourceReads": 148,
"sourceBytesRead": 600956,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:51.159Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 293.8055999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "e52d08fcd5856616ad9fc81a6276f14bfbba7093af765b085577645cf56bedb7",
"indexFingerprint": "f73588c8506d537a2497b148b042f57ccb574c71a4a168f8e781f2f617c9bdaa",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-3",
"durationMs": 256.1203999999998,
"sourceReads": 148,
"sourceBytesRead": 600956,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:51.415Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 254.01789999999983,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "e52d08fcd5856616ad9fc81a6276f14bfbba7093af765b085577645cf56bedb7",
"indexFingerprint": "f73588c8506d537a2497b148b042f57ccb574c71a4a168f8e781f2f617c9bdaa",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "new-indexer",
"durationMs": 158.6292999999996,
"sourceReads": 148,
"sourceBytesRead": 600956,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:51.575Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 156.9394000000002,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "e52d08fcd5856616ad9fc81a6276f14bfbba7093af765b085577645cf56bedb7",
"indexFingerprint": "f73588c8506d537a2497b148b042f57ccb574c71a4a168f8e781f2f617c9bdaa",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "same-size-mtime-change",
"durationMs": 158.01089999999976,
"sourceReads": 149,
"sourceBytesRead": 605066,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:51.732Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0.6936999999998079,
"durationMs": 155.8822,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "ed9aade9c0bbfcd6924a4f90696e3fcd873c1ffbf89209c8361e52663129feb5",
"indexFingerprint": "20a87352d062db15cc2c68dafe9cf519c861005b4bee339bf888e97e503e8fb3",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "cold",
"durationMs": 182.48070000000007,
"sourceReads": 222,
"sourceBytesRead": 383748,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:51.927Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 10.231600000000071,
"durationMs": 180.94529999999986,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "a66a5cd4d322277f1c8c95e48eaa3ef13b82933c5ac6809ed8314d1b0dbe5e06",
"indexFingerprint": "9b915087f2af37694dd1b6fbc5f885bbab41105c011e9da5f7426113db8f1f0f",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-1",
"durationMs": 219.14269999999988,
"sourceReads": 150,
"sourceBytesRead": 255948,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:52.146Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 217.5721999999996,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "a66a5cd4d322277f1c8c95e48eaa3ef13b82933c5ac6809ed8314d1b0dbe5e06",
"indexFingerprint": "9b915087f2af37694dd1b6fbc5f885bbab41105c011e9da5f7426113db8f1f0f",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-2",
"durationMs": 209.9998999999998,
"sourceReads": 150,
"sourceBytesRead": 255948,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:52.357Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 208.45919999999978,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "a66a5cd4d322277f1c8c95e48eaa3ef13b82933c5ac6809ed8314d1b0dbe5e06",
"indexFingerprint": "9b915087f2af37694dd1b6fbc5f885bbab41105c011e9da5f7426113db8f1f0f",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-3",
"durationMs": 156.2482,
"sourceReads": 150,
"sourceBytesRead": 255948,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:52.513Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 154.79869999999983,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "a66a5cd4d322277f1c8c95e48eaa3ef13b82933c5ac6809ed8314d1b0dbe5e06",
"indexFingerprint": "9b915087f2af37694dd1b6fbc5f885bbab41105c011e9da5f7426113db8f1f0f",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "new-indexer",
"durationMs": 225.18949999999995,
"sourceReads": 150,
"sourceBytesRead": 255948,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:52.739Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 223.73950000000013,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "a66a5cd4d322277f1c8c95e48eaa3ef13b82933c5ac6809ed8314d1b0dbe5e06",
"indexFingerprint": "9b915087f2af37694dd1b6fbc5f885bbab41105c011e9da5f7426113db8f1f0f",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "same-size-mtime-change",
"durationMs": 199.5574999999999,
"sourceReads": 151,
"sourceBytesRead": 257692,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:30:52.939Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0.1044000000001688,
"durationMs": 198.10399999999981,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "7b31d7b5aa7c0769d9c5595225b382bace6319bdf8a1a301939c1059c75299c3",
"indexFingerprint": "8fb096f046b252d388bdb7a82540a45dc343db7165c2317b3f41a4cec3cb7fd4",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
}
]
}
@@ -0,0 +1,963 @@
{
"success": true,
"phase": "comparison",
"at": "2026-10-31T18:32:24.797Z",
"node": "v24.22.1",
"interpretation": "Local derived parsing only. Source reads include declarations and all current hashes. No model calls or token/cost inference.",
"rows": [
{
"language": "node",
"case": "cold",
"durationMs": 166.5876,
"sourceReads": 219,
"sourceBytesRead": 647922,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:22.835Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 41.863899999999916,
"durationMs": 164.3036,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "8e9d094deed5757895e3021c73e60cbfd93c7335af860fdb832862282b441a46",
"indexFingerprint": "83985eb4228776d76d345878406b13580e42565580b51eab3d013718dd972ecc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-1",
"durationMs": 86.54279999999997,
"sourceReads": 147,
"sourceBytesRead": 431994,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:22.927Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 84.4253,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "8e9d094deed5757895e3021c73e60cbfd93c7335af860fdb832862282b441a46",
"indexFingerprint": "83985eb4228776d76d345878406b13580e42565580b51eab3d013718dd972ecc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-2",
"durationMs": 133.44740000000002,
"sourceReads": 147,
"sourceBytesRead": 431994,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.060Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 131.3401,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "8e9d094deed5757895e3021c73e60cbfd93c7335af860fdb832862282b441a46",
"indexFingerprint": "83985eb4228776d76d345878406b13580e42565580b51eab3d013718dd972ecc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "warm-3",
"durationMs": 81.31600000000003,
"sourceReads": 147,
"sourceBytesRead": 431994,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.142Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 79.33020000000005,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "8e9d094deed5757895e3021c73e60cbfd93c7335af860fdb832862282b441a46",
"indexFingerprint": "83985eb4228776d76d345878406b13580e42565580b51eab3d013718dd972ecc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "new-indexer",
"durationMs": 85.4393,
"sourceReads": 147,
"sourceBytesRead": 431994,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.228Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0,
"durationMs": 83.83699999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "8e9d094deed5757895e3021c73e60cbfd93c7335af860fdb832862282b441a46",
"indexFingerprint": "83985eb4228776d76d345878406b13580e42565580b51eab3d013718dd972ecc",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "node",
"case": "same-size-mtime-change",
"durationMs": 86.8791,
"sourceReads": 148,
"sourceBytesRead": 434962,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 583971,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.311Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 431948,
"parseMs": 0.5663999999999305,
"durationMs": 84.8635999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "2288a078bb7bc8da24513a3a5bb6aa0b423d6eb6846b00518ab3dc1b52cbbb87",
"indexFingerprint": "47669372aff55291c5c446355ccab02afce5392ee757457ca0532e011cc2497d",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "cold",
"durationMs": 183.7240999999999,
"sourceReads": 219,
"sourceBytesRead": 901293,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.509Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 76.43759999999997,
"durationMs": 181.63299999999992,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "3bca8f9b2bc62f1d4f768b200b6ce3bea4306e06664aee127b853613e627f1c3",
"indexFingerprint": "7a7cdede1dda1480b5bc642d54b197bd6743f5040a43a02f15fbae7d474540eb",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-1",
"durationMs": 128.5551999999999,
"sourceReads": 147,
"sourceBytesRead": 600909,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.642Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 126.50390000000004,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "3bca8f9b2bc62f1d4f768b200b6ce3bea4306e06664aee127b853613e627f1c3",
"indexFingerprint": "7a7cdede1dda1480b5bc642d54b197bd6743f5040a43a02f15fbae7d474540eb",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-2",
"durationMs": 88.52610000000004,
"sourceReads": 147,
"sourceBytesRead": 600909,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.730Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 86.38070000000016,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "3bca8f9b2bc62f1d4f768b200b6ce3bea4306e06664aee127b853613e627f1c3",
"indexFingerprint": "7a7cdede1dda1480b5bc642d54b197bd6743f5040a43a02f15fbae7d474540eb",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "warm-3",
"durationMs": 125.79469999999992,
"sourceReads": 147,
"sourceBytesRead": 600909,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:23.857Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 123.75569999999993,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "3bca8f9b2bc62f1d4f768b200b6ce3bea4306e06664aee127b853613e627f1c3",
"indexFingerprint": "7a7cdede1dda1480b5bc642d54b197bd6743f5040a43a02f15fbae7d474540eb",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "new-indexer",
"durationMs": 183.41730000000007,
"sourceReads": 147,
"sourceBytesRead": 600909,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.042Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0,
"durationMs": 181.9674,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "3bca8f9b2bc62f1d4f768b200b6ce3bea4306e06664aee127b853613e627f1c3",
"indexFingerprint": "7a7cdede1dda1480b5bc642d54b197bd6743f5040a43a02f15fbae7d474540eb",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "react",
"case": "same-size-mtime-change",
"durationMs": 215.4749999999999,
"sourceReads": 148,
"sourceBytesRead": 605019,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 628037,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.251Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 600862,
"parseMs": 0.6792000000000371,
"durationMs": 213.34460000000013,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "902fa17c031be1f4db749fd457c832290ad75dffc80d6526c451a05a1f643b12",
"indexFingerprint": "4e3aa6a765a922f6b4a3b315ccf66da45fa03a6c125b89ff87a6329a16a3f516",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 72,
"pythonCandidateFiles": 0,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "cold",
"durationMs": 113.28359999999998,
"sourceReads": 220,
"sourceBytesRead": 383632,
"refresh": {
"updatedFiles": 73,
"reusedFiles": 0,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.377Z",
"sourceVerified": true,
"origin": "cold",
"invalidation": null,
"reusedFiles": 0,
"rebuiltFiles": 73,
"parsedFiles": 72,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 10.035900000000765,
"durationMs": 111.81510000000003,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "588c3cbd695d351cdd3191a79f1d4c93df3cc90b43728b4ff61528de3898ec8f",
"indexFingerprint": "c1d9b0f542364499655e0ade60d01936b80d15c737a1763db95d1b44256ef045",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-1",
"durationMs": 79.98940000000016,
"sourceReads": 148,
"sourceBytesRead": 255832,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.462Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 78.54459999999995,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "588c3cbd695d351cdd3191a79f1d4c93df3cc90b43728b4ff61528de3898ec8f",
"indexFingerprint": "c1d9b0f542364499655e0ade60d01936b80d15c737a1763db95d1b44256ef045",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-2",
"durationMs": 79.60709999999995,
"sourceReads": 148,
"sourceBytesRead": 255832,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.541Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 78.18149999999991,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "588c3cbd695d351cdd3191a79f1d4c93df3cc90b43728b4ff61528de3898ec8f",
"indexFingerprint": "c1d9b0f542364499655e0ade60d01936b80d15c737a1763db95d1b44256ef045",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "warm-3",
"durationMs": 79.8877,
"sourceReads": 148,
"sourceBytesRead": 255832,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.621Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 78.4360999999999,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "588c3cbd695d351cdd3191a79f1d4c93df3cc90b43728b4ff61528de3898ec8f",
"indexFingerprint": "c1d9b0f542364499655e0ade60d01936b80d15c737a1763db95d1b44256ef045",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "new-indexer",
"durationMs": 85.64720000000011,
"sourceReads": 148,
"sourceBytesRead": 255832,
"refresh": {
"updatedFiles": 0,
"reusedFiles": 73,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.707Z",
"sourceVerified": true,
"origin": "disk",
"invalidation": null,
"reusedFiles": 73,
"rebuiltFiles": 0,
"parsedFiles": 0,
"invalidatedFiles": 0,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0,
"durationMs": 84.24020000000019,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "588c3cbd695d351cdd3191a79f1d4c93df3cc90b43728b4ff61528de3898ec8f",
"indexFingerprint": "c1d9b0f542364499655e0ade60d01936b80d15c737a1763db95d1b44256ef045",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
},
{
"language": "python",
"case": "same-size-mtime-change",
"durationMs": 86.0005000000001,
"sourceReads": 149,
"sourceBytesRead": 257576,
"refresh": {
"updatedFiles": 1,
"reusedFiles": 72,
"removedFiles": 0
},
"cache": {
"enabled": true,
"persistent": true,
"diskProjects": 1,
"diskBytes": 590745,
"maximumProjects": 8,
"maximumBytes": 33554432,
"maximumEntryBytes": 8388608,
"error": null,
"checkedAt": "2026-10-31T18:32:24.789Z",
"sourceVerified": true,
"origin": "memory",
"invalidation": "source-or-access-changed",
"reusedFiles": 72,
"rebuiltFiles": 1,
"parsedFiles": 1,
"invalidatedFiles": 1,
"removedFiles": 0,
"verifiedFiles": 73,
"verificationPasses": 2,
"sourceBytesRead": 255716,
"parseMs": 0.09840000000031068,
"durationMs": 84.60399999999981,
"stored": true,
"storageReason": "stored",
"evictedProjects": 0
},
"sourceFingerprint": "1900dc67ce873116db0debe6b2be2405f022ebf01688f53cb69f7529655ed0af",
"indexFingerprint": "e3db8af54d51fad65b82b2aba2d1c373b3f09622e97a15061b36b493769510f6",
"coverage": {
"snapshotComplete": true,
"fileCount": 73,
"symbolCount": 2592,
"importCount": 0,
"astFiles": 0,
"pythonCandidateFiles": 72,
"unindexedFiles": 0,
"truncated": false,
"maximumFileBytes": 256000,
"maximumSymbols": 6000
}
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

@@ -0,0 +1,45 @@
✖ cache controls require desktop authority, exact inputs and owned project identity while preserving task evidence (2143.4704ms)
✔ cache enablement and derived reuse survive a real host restart without becoming task recovery state (3983.0287ms)
ℹ tests 2
ℹ suites 0
ℹ pass 1
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6213.1724
✖ failing tests:
test at tests\project-cache-api.test.mjs:7:1
✖ cache controls require desktop authority, exact inputs and owned project identity while preserving task evidence (2143.4704ms)
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
... Skipped lines
{
execution: {
accountedTaskTokens: 0,
artifacts: [],
browserJobs: [],
...
executionSchemaVersion: 1,
+ exportedAt: '2026-10-31T18:33:37.763Z',
- exportedAt: '2026-10-31T18:33:37.537Z',
project: {
addedAt: '2026-10-31T18:33:36.123Z',
id: '6a670d06-8a1e-4382-b7ed-b152d582d810',
name: 'project',
root: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\test-NRQAGD\\project'
at TestContext.<anonymous> (file:///D:/Ai-project/REA%E9%80%86%E5%90%91/Agent-Workbench/tests/project-cache-api.test.mjs:29:10)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async Test.run (node:internal/test_runner/test:1409:7)
at async startSubtestAfterBootstrap (node:internal/test_runner/harness:387:3) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: { schemaVersion: 1, executionSchemaVersion: 1, exportedAt: '2026-10-31T18:33:37.763Z', project: { id: '6a670d06-8a1e-4382-b7ed-b152d582d810', root: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\test-NRQAGD\\project', name: 'project', addedAt: '2026-10-31T18:33:36.123Z' }, session: { id: '230d317a-749b-4d5f-96da-916804d59f3b', projectId: '6a670d06-8a1e-4382-b7ed-b152d582d810', title: '新任务', status: 'idle', createdAt: '2026-10-31T18:33:36.147Z', updatedAt: '2026-10-31T18:33:36.147Z', messages: [], providerMessages: [], events: [], changes: [], approvals: [], failure: null, lastFailure: null, compactions: 0, estimatedTokens: 0, usage: null, archived: false, revision: 1, eventSeq: 1 }, execution: { schemaVersion: 1, task: null, run: null, workspaceIdentity: [Object], workspaces: [], runs: [], progress: [Object], artifacts: [], checks: [], mcpJobs: [], taskPlans: [], taskProofs: [], researchTargets: [], researchJobs: [], engineJobs: [], browserPlans: [], browserJobs: [], contextPlans: [], changeSets: [], plans: [], deliveries: [], deliveryPlans: [], accountedTaskTokens: 0 } },
expected: { schemaVersion: 1, executionSchemaVersion: 1, exportedAt: '2026-10-31T18:33:37.537Z', project: { id: '6a670d06-8a1e-4382-b7ed-b152d582d810', root: 'D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\test-NRQAGD\\project', name: 'project', addedAt: '2026-10-31T18:33:36.123Z' }, session: { id: '230d317a-749b-4d5f-96da-916804d59f3b', projectId: '6a670d06-8a1e-4382-b7ed-b152d582d810', title: '新任务', status: 'idle', createdAt: '2026-10-31T18:33:36.147Z', updatedAt: '2026-10-31T18:33:36.147Z', messages: [], providerMessages: [], events: [], changes: [], approvals: [], failure: null, lastFailure: null, compactions: 0, estimatedTokens: 0, usage: null, archived: false, revision: 1, eventSeq: 1 }, execution: { schemaVersion: 1, task: null, run: null, workspaceIdentity: [Object], workspaces: [], runs: [], progress: [Object], artifacts: [], checks: [], mcpJobs: [], taskPlans: [], taskProofs: [], researchTargets: [], researchJobs: [], engineJobs: [], browserPlans: [], browserJobs: [], contextPlans: [], changeSets: [], plans: [], deliveries: [], deliveryPlans: [], accountedTaskTokens: 0 } },
operator: 'deepStrictEqual',
diff: 'simple'
}
@@ -0,0 +1,10 @@
✔ cache controls require desktop authority, exact inputs and owned project identity while preserving task evidence (2354.007ms)
✔ cache enablement and derived reuse survive a real host restart without becoming task recovery state (4124.5155ms)
ℹ tests 2
ℹ suites 0
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6565.1087
@@ -0,0 +1,34 @@
✔ persistent parsing is project/SHA/config bound and produces identical semantic indexes after restart (1363.5232ms)
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'main.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'value.ts', LF will be replaced by CRLF the next time Git touches it
✔ same-size restored-mtime changes, additions, renames and deletions cannot reuse stale entries or import targets (1154.8831ms)
Switched to a new branch 'other'
✔ branch and commit changes invalidate even byte-identical sources (2161.4984ms)
✔ corrupt, malformed and schema-invalid records fall back to fresh parsing (1116.9728ms)
✔ disable and clear persist without touching sources, sessions, configuration or original artifacts (1086.2923ms)
✔ cache capacity bounds disk and memory by bytes and LRU project count (1491.624ms)
✔ incomplete scans do not load or save cached entries; unavailable files leave the current result scope (948.1679ms)
✔ project and cache junctions cannot expose or delete an outside directory (883.0282ms)
✔ concurrent file changes refuse a snapshot and clear during pending work cannot repopulate it (888.3075ms)
✔ file access mode changes invalidate parsed material even when bytes are unchanged (811.712ms)
✔ tracked directory replaced by a junction invalidates access scope and never uses its old cache (1850.6651ms)
✔ JS/TS/React AST indexes actual declarations, exports, imports and verified source lines (1013.9669ms)
✔ default expressions, named default exports and declared functions retain their AST evidence (681.6304ms)
✔ incremental refresh invalidates changed/deleted symbols and recalculates reused import targets (1076.6982ms)
✔ Python candidates exclude comments and multiline strings and declare limited evidence (774.9067ms)
✔ indexes isolate project identity and root and evict bounded caches without sharing results (724.9474ms)
✔ Git ignore, credential paths and links stay outside the index and no project files are executed (1413.273ms)
✔ malformed, binary, non-UTF8 and bounded files expose partial coverage while good files remain searchable (910.6801ms)
✔ index query rejects invalid limits/types and does not imply reference or alias resolution (865.877ms)
✔ read-only engineering inspection disables configured Git clean filters and preserves index bytes (2123.3156ms)
✔ Python multiline declarations retain candidate scope without interpreting expressions as declarations (1047.9222ms)
✔ TypeScript module candidates support import-equals and MTS/CTS while opaque imports stay explicit (884.0918ms)
ℹ tests 22
ℹ suites 0
ℹ pass 22
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 13856.0087
@@ -0,0 +1,9 @@
✔ observe-only device authority cannot read, configure or clear project parsing caches (1162.3237ms)
ℹ tests 1
ℹ suites 0
ℹ pass 1
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 1453.3812
@@ -0,0 +1,39 @@
PASS desktop query shows two-pass current SHA verification and real parsing reuse
PASS same-size restored-mtime edit invalidates the actual source and displays the reason
EVIDENCE D:\Ai-project\REA逆向\Agent-Workbench\.qa\project-cache-ui-5aefec7a-2073-4162-a49f-a465f4d37c42
node:internal/modules/run_main:107
triggerUncaughtException(
^
locator.uncheck: Clicking the checkbox did not change its state
Call log:
- waiting for getByLabel('工程索引', { exact: true }).locator('.index-cache').getByRole('switch', { name: '启用本机解析缓存' })
- locator resolved to <input checked role="switch" type="checkbox" aria-label="启用本机解析缓存"/>
- attempting click action
- waiting for element to be visible, enabled and stable
- element is visible, enabled and stable
- scrolling into view if needed
- done scrolling
- performing click action
- click action done
- waiting for scheduled navigations to finish
- navigations have finished
at D:\Ai-project\REA逆向\Agent-Workbench\scripts\verify-project-cache-ui.mjs:41:59 {
log: [
" - waiting for getByLabel('工程索引', { exact: true }).locator('.index-cache').getByRole('switch', { name: '启用本机解析缓存' })",
' - locator resolved to <input checked role="switch" type="checkbox" aria-label="启用本机解析缓存"/>',
' - attempting click action',
' - waiting for element to be visible, enabled and stable',
' - element is visible, enabled and stable',
' - scrolling into view if needed',
' - done scrolling',
' - performing click action',
' - click action done',
' - waiting for scheduled navigations to finish',
' - navigations have finished'
],
name: 'Error'
}
Node.js v24.22.1
@@ -0,0 +1,8 @@
PASS desktop query shows two-pass current SHA verification and real parsing reuse
PASS same-size restored-mtime edit invalidates the actual source and displays the reason
PASS disable persists across page reload and future queries parse current sources
PASS clear removes only derived project material; next query rebuilds while sessions and configuration remain byte-semantically unchanged
PASS failed settings keep actual switch and query state; the same operation can recover
PASS diagnostics displays bounded cache and last project verification without triggering another query
PASS 390px controls support keyboard, 44px targets, readable metrics and no horizontal page/panel overflow
EVIDENCE D:\Ai-project\REA逆向\Agent-Workbench\.qa\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4
+41
View File
@@ -0,0 +1,41 @@
{
"success": true,
"version": "1.18.0",
"appRoot": "D:\\Ai-project\\REA逆向\\Agent-Workbench",
"realModelRequests": 0,
"passed": [
"desktop query shows two-pass current SHA verification and real parsing reuse",
"same-size restored-mtime edit invalidates the actual source and displays the reason",
"disable persists across page reload and future queries parse current sources",
"clear removes only derived project material; next query rebuilds while sessions and configuration remain byte-semantically unchanged",
"failed settings keep actual switch and query state; the same operation can recover",
"diagnostics displays bounded cache and last project verification without triggering another query",
"390px controls support keyboard, 44px targets, readable metrics and no horizontal page/panel overflow"
],
"screenshots": [
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-cold.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-warm.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-invalidated.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-disabled.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-cleared.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-error.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\desktop-diagnostics.png",
"D:\\Ai-project\\REA逆向\\Agent-Workbench\\.qa\\project-cache-ui-79314173-56d7-463d-ae66-84a0f63247e4\\narrow-cache.png"
],
"pageErrors": [],
"requestFailures": [],
"contrast": [
5.6547953800002615,
13.85710152658139,
5.6547953800002615,
13.85710152658139,
5.6547953800002615,
13.85710152658139,
5.6547953800002615,
13.85710152658139,
5.6547953800002615,
13.85710152658139
],
"sourceBeforeSha256": "deebbdd0a042596cab6ef2cb98c16d432598c6c34a7d24b6ec1582d7c8ff25d0",
"sourceAfterSha256": "37315c4d7ce309e3496e2c428644dfdea79f1d49070ee58472386314d4f4ef62"
}
+2
View File
@@ -1,5 +1,7 @@
# 统一执行进度
1.19 D首轮验收发现两项QA问题:会话导出比较误包含即时exportedAt;Playwright.uncheck要求同步变更而开关等待服务端保存。保留API/UI首轮日志,比较只剔除且验证真实导出时间,其余完整数据逐项比较;操作改为真实click并等待服务端状态。源码闭合优化22/22、观察设备缓存管理拒绝1/1已通过。比较首轮显示双完整inspection/重复写盘拖慢,优化为句柄SHA闭合、精确Git身份/文件集和未变化材料touch,原回退计时保留;无核验跳过。
1.19 B/C首轮专项8/9:损坏缓存内symbols含null时验证器抛异常,未走重建。原失败保留.qa/project-cache-bc-first.tap;修正为完整元素结构核对,并补充实际只读mode变化及Git已跟踪目录被junction替换测试。旧索引11/11通过;正式服务未修改。
1.19 A已完成18次固定样本测量,原输入SHA/变更SHA/逐轮耗时/读次数存档。Node/React跨实例重解析有实际空间,Python收益较小;不折算token。接下来B/C实现单一有界持久解析缓存并完善分支/配置/不完整扫描与并发来源核对。首次批量只读输出过大截断,后续限定短段读取,无文件或服务副作用。
+6 -2
View File
@@ -13,10 +13,14 @@ fs.mkdirSync(output, { recursive: true });
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const rows = [];
const originalRead = fs.readFileSync;
const originalOpen = fs.openSync, originalClose = fs.closeSync, handles = new Map();
fs.openSync = function (filename, ...args) { const handle = originalOpen.call(this, filename, ...args); handles.set(handle, filename); return handle; };
fs.closeSync = function (handle) { handles.delete(handle); return originalClose.call(this, handle); };
let currentRoot = null, reads = 0, bytes = 0;
fs.readFileSync = function (filename, ...args) {
const result = originalRead.call(this, filename, ...args);
if (typeof filename === 'string' && currentRoot && path.resolve(filename).startsWith(currentRoot + path.sep)) {
const source = typeof filename === 'number' ? handles.get(filename) : filename;
if (typeof source === 'string' && currentRoot && path.resolve(source).startsWith(currentRoot + path.sep)) {
reads++; bytes += Buffer.byteLength(result);
}
return result;
@@ -68,7 +72,7 @@ try {
fs.writeFileSync(path.join(output, language + '-inputs.json'), JSON.stringify({ project, inputs,
mutation: { path: path.basename(target), before: hash(content), after: hash(changed), preservedSize: true, restoredMtime: true } }, null, 2) + '\n');
}
} finally { fs.readFileSync = originalRead; }
} finally { fs.readFileSync = originalRead; fs.openSync = originalOpen; fs.closeSync = originalClose; }
const report = { success: true, phase, at: new Date().toISOString(), node: process.version,
interpretation: 'Local derived parsing only. Source reads include declarations and all current hashes. No model calls or token/cost inference.', rows };
fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify(report, null, 2) + '\n');
+88
View File
@@ -0,0 +1,88 @@
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { randomUUID, createHash } from 'node:crypto';
import { chromium, expect } from 'playwright/test';
import { fixture, launchWorkbench } from '../tests/helpers.mjs';
if (process.argv.includes('--help')) { console.log('node scripts/verify-project-cache-ui.mjs [--app-root <absolute-package>] - owned desktop/390px cache query, invalidation, clear, persisted disable, error recovery and read-only diagnostics. No configured model requests.'); process.exit(0); }
const args = process.argv.slice(2); assert.ok(!args.length || args.length === 2 && args[0] === '--app-root' && path.isAbsolute(args[1]));
const appRoot = fs.realpathSync.native(args[1] ?? process.cwd()), directory = path.resolve('.qa', 'project-cache-ui-' + randomUUID()); fs.mkdirSync(directory, { recursive: true });
const disposers = [], t = { after: fn => disposers.push(fn) }, f = fixture(t); f.store.close();
const filename = path.join(f.projectRoot, 'main.ts'), original = 'export function calculate(value: number) { return value + 1; }\n';
fs.writeFileSync(filename, original);
const host = await launchWorkbench(t, f.data, {}, { appRoot, nodePath: args.length ? path.join(appRoot, 'runtime', 'node.exe') : process.execPath });
const browser = await chromium.launch({ channel: 'msedge', headless: true }), page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
const passed = [], screenshots = [], errors = [], queryRequests = [];
page.on('pageerror', error => errors.push(error.message)); page.on('request', request => { if (request.url().includes('/code-query?')) queryRequests.push(request.url()); });
const panel = () => page.getByLabel('工程索引', { exact: true }), cache = () => panel().locator('.index-cache');
const mark = text => { passed.push(text); console.log('PASS ' + text); };
const shot = async name => { const file = path.join(directory, name + '.png'); await page.screenshot({ path: file }); screenshots.push(file);
assert.ok(await page.locator('body').evaluate(node => node.scrollWidth <= innerWidth), 'body overflow ' + name);
assert.ok(await panel().evaluate(node => node.scrollWidth <= node.clientWidth + 1), 'panel overflow ' + name); };
const refresh = async () => { const response = page.waitForResponse(value => value.url().includes('/code-query?')); await panel().getByRole('button', { name: '刷新工程索引', exact: true }).click();
const value = await (await response).json(); await expect(panel().getByRole('button', { name: '查找', exact: true })).toBeEnabled(); return value.index; };
const openCache = async () => { if (!await cache().evaluate(node => node.open)) await cache().locator('summary').click(); };
const setCache = async enabled => { const control = cache().getByRole('switch'); if (await control.isChecked() !== enabled) await control.click();
if (enabled) await expect(control).toBeChecked(); else await expect(control).not.toBeChecked();
await expect(cache().getByRole('button', { name: '清除本项目缓存', exact: true })).toBeEnabled(); };
const content = value => { const { exportedAt, ...record } = value; assert.ok(Number.isFinite(Date.parse(exportedAt))); return record; };
try {
await page.goto(host.url); await page.evaluate(id => localStorage.setItem('awb-session', id), f.session.id); await page.reload();
await page.getByLabel('当前项目', { exact: true }).selectOption(f.project.id);
await page.locator('.inspector-tabs').getByRole('button', { name: '索引', exact: true }).click();
await expect(panel().locator('.index-result')).toHaveCount(1); await openCache();
await expect(cache()).toContainText('2 轮 SHA 核对'); await expect(cache()).toContainText('1 重新解析');
const originalExport = content(await host.api('/sessions/' + f.session.id + '/export')), config = (await host.api('/bootstrap')).config;
await shot('desktop-cold');
const warm = await refresh(); assert.equal(warm.cache.parsedFiles, 0); assert.equal(warm.cache.origin, 'memory');
await expect(cache()).toContainText('0 重新解析'); await shot('desktop-warm'); mark('desktop query shows two-pass current SHA verification and real parsing reuse');
const stat = fs.statSync(filename); fs.writeFileSync(filename, original.replace('value + 1', 'value + 2')); fs.utimesSync(filename, stat.atime, stat.mtime);
const modified = await refresh(); assert.equal(modified.cache.invalidatedFiles, 1); assert.equal(modified.cache.parsedFiles, 1);
await expect(cache()).toContainText('源码或读取权限变化'); await shot('desktop-invalidated'); mark('same-size restored-mtime edit invalidates the actual source and displays the reason');
await setCache(false);
await expect(cache()).toContainText('后续查询从当前源码重新分析'); assert.equal((await host.api('/project-cache')).enabled, false);
await page.reload(); await page.locator('.inspector-tabs').getByRole('button', { name: '索引', exact: true }).click(); await expect(panel().locator('.index-result')).toHaveCount(1); await openCache();
await expect(cache().getByRole('switch')).not.toBeChecked(); assert.equal((await refresh()).cache.parsedFiles, 1);
await shot('desktop-disabled'); mark('disable persists across page reload and future queries parse current sources');
await setCache(true); await expect(cache()).toContainText('本机解析缓存已启用');
await cache().getByRole('button', { name: '清除本项目缓存', exact: true }).click(); await expect(cache()).toContainText('本项目派生缓存已清除');
assert.equal((await host.api('/projects/' + f.project.id + '/index-cache')).diskProjects, 0);
await expect(panel().locator('.index-result')).toHaveCount(1); await shot('desktop-cleared');
const rebuilt = await refresh(); assert.equal(rebuilt.cache.parsedFiles, 1); assert.equal(rebuilt.cache.origin, 'cold');
assert.deepEqual(content(await host.api('/sessions/' + f.session.id + '/export')), originalExport); assert.deepEqual((await host.api('/bootstrap')).config, config);
mark('clear removes only derived project material; next query rebuilds while sessions and configuration remain byte-semantically unchanged');
const pattern = '**/api/project-cache'; let fail = true;
await page.route(pattern, route => route.request().method() === 'POST' && fail ? (fail = false, route.fulfill({ status: 409, contentType: 'application/json', body: '{"error":"缓存设置被占用,请重试。"}' })) : route.continue());
await cache().getByRole('switch').click(); await expect(cache().getByRole('alert')).toContainText('缓存操作未完成');
await expect(cache().getByRole('switch')).toBeChecked(); await expect(panel().locator('.index-result')).toBeEnabled(); await shot('desktop-error');
await setCache(false); await expect(cache().getByRole('alert')).toHaveCount(0); await setCache(true); await page.unroute(pattern);
mark('failed settings keep actual switch and query state; the same operation can recover');
const queriesBefore = queryRequests.length;
await page.getByRole('button', { name: '运行诊断', exact: true }).last().click();
const diagnostics = page.getByRole('dialog', { name: '运行诊断', exact: true }); await expect(diagnostics.getByLabel('解析缓存诊断')).toContainText('32 MiB');
assert.equal(queryRequests.length, queriesBefore); await page.screenshot({ path: path.join(directory, 'desktop-diagnostics.png') }); screenshots.push(path.join(directory, 'desktop-diagnostics.png'));
await diagnostics.getByRole('button', { name: '关闭窗口', exact: true }).click(); mark('diagnostics displays bounded cache and last project verification without triggering another query');
await page.setViewportSize({ width: 390, height: 844 }); await page.getByRole('button', { name: '查看文件', exact: true }).click();
await page.locator('.inspector-tabs').getByRole('button', { name: '索引', exact: true }).click(); await openCache();
const switchControl = cache().getByRole('switch'); await switchControl.focus(); await page.keyboard.press('Space'); await expect(switchControl).not.toBeChecked();
await expect(cache().getByRole('button', { name: '清除本项目缓存', exact: true })).toBeEnabled(); await switchControl.focus(); await page.keyboard.press('Space'); await expect(switchControl).toBeChecked();
await refresh(); await shot('narrow-cache');
const controls = await cache().locator('button,label').evaluateAll(nodes => nodes.map(node => { const box = node.getBoundingClientRect(); return { width: box.width, height: box.height }; }));
assert.ok(controls.every(value => value.height >= 44));
const colors = await cache().locator('dt,dd').evaluateAll(nodes => nodes.map(node => ({ foreground: getComputedStyle(node).color, background: '#FCFDFC' })));
const luminance = color => { const values = color.startsWith('#') ? color.slice(1).match(/../g).map(value => parseInt(value, 16)) : color.match(/\d+/g).slice(0, 3).map(Number);
return values.map(value => value / 255).map(value => value <= .04045 ? value / 12.92 : ((value + .055) / 1.055) ** 2.4).reduce((sum, value, index) => sum + value * [.2126, .7152, .0722][index], 0); };
const contrast = colors.map(value => (Math.max(luminance(value.foreground), luminance(value.background)) + .05) / (Math.min(luminance(value.foreground), luminance(value.background)) + .05)); assert.ok(contrast.every(value => value >= 4.5));
mark('390px controls support keyboard, 44px targets, readable metrics and no horizontal page/panel overflow');
assert.deepEqual(errors, []);
fs.writeFileSync(path.join(directory, 'result.json'), JSON.stringify({ success: true, version: host.bootstrap.version, appRoot, realModelRequests: 0, passed, screenshots,
pageErrors: errors, requestFailures: [], contrast, sourceBeforeSha256: createHash('sha256').update(original).digest('hex'), sourceAfterSha256: createHash('sha256').update(fs.readFileSync(filename)).digest('hex') }, null, 2) + '\n');
} catch (error) { await shot('failure').catch(() => {}); fs.writeFileSync(path.join(directory, 'result.json'), JSON.stringify({ success: false, error: error.stack, passed, screenshots, pageErrors: errors }, null, 2) + '\n'); throw error; }
finally { console.log('EVIDENCE ' + directory); await browser.close(); for (const dispose of disposers.reverse()) await dispose(); }
+4
View File
@@ -32,3 +32,7 @@
@media(max-width:1250px){.inspector-tabs{gap:1px;padding-left:7px;padding-right:7px}.inspector-tabs>button:not(.icon-button){padding-left:7px;padding-right:7px}}
@media(max-width:620px){.index-heading,.index-search{padding-left:13px;padding-right:13px}.index-scroll{padding-left:13px;padding-right:13px}}
@media(prefers-reduced-motion:reduce){.index-result{transition:none}}
.index-cache{margin:12px 0;border-top:1px solid #d8e4de;border-bottom:1px solid #d8e4de;font-size:12px;color:#405c54;line-height:1.7;padding:3px 0}
.index-cache>summary{cursor:pointer;color:#154B4A;padding:10px 0;font-weight:600;min-height:44px}.index-cache p{margin:8px 0;overflow-wrap:anywhere}
.index-cache-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between}.index-cache-controls label{display:flex;align-items:center;gap:8px;min-height:44px;cursor:pointer}.index-cache-controls input{width:17px;height:17px;accent-color:#154B4A}.index-cache-controls button{font-size:12px;min-height:44px;padding:6px 10px}
.index-cache-metrics{display:grid;grid-template-columns:94px minmax(0,1fr);gap:7px 10px;margin:13px 0}.index-cache-metrics dt{color:#526b63}.index-cache-metrics dd{margin:0;color:#1C2E32;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.index-cache .index-cache-feedback{border-left:3px solid #154B4A;background:#EDF3F1;padding:8px 10px;color:#154B4A}.index-cache .index-cache-warning{color:#76541f}
+44 -5
View File
@@ -1,11 +1,17 @@
import { useEffect, useRef, useState } from 'react';
import { ArrowUpRight, FileCode2, LoaderCircle, RefreshCw, Search } from 'lucide-react';
import { api } from './api';
import type { CodeQuery, CodeQueryKind, CodeResult, Project } from './types';
import type { CodeQuery, CodeQueryKind, CodeResult, Project, ProjectCacheStatus } from './types';
import './CodeIndexPanel.css';
const kindNames: Record<string, string> = { function: '函数', method: '方法', class: '类', interface: '接口', type: '类型', enum: '枚举', binding: '变量' };
const resultName = (result: CodeResult) => result.resultKind === 'symbol' ? result.qualifiedName || result.name : result.name;
const reasons: Record<string, string> = { cold: '首次建立', memory: '本次进程复用', disk: '从本机派生缓存载入', disabled: '缓存已关闭',
'process-only': '仅本次进程', 'incomplete-scan': '读取范围不完整,重新分析可读文件', 'identity-changed': '分支、解析配置或项目身份变化',
'source-or-access-changed': '源码或读取权限变化', 'files-added-or-removed': '文件新增、删除或重命名', corrupt: '派生材料损坏,已重建',
unavailable: '派生缓存不可用,已重建', capacity: '超出缓存容量,保留当前检索结果', stored: '已保存派生材料', 'cleared-during-refresh': '核对期间已清除,未重新填入缓存' };
const reason = (value: string) => reasons[value] ?? value;
const size = (bytes: number) => bytes < 1024 * 1024 ? (bytes / 1024).toFixed(1) + ' KiB' : (bytes / (1024 * 1024)).toFixed(1) + ' MiB';
export function CodeIndexPanel({ project, active, onOpen }: {
project: Project; active: boolean; onOpen: (path: string, line: number, sha256: string) => void;
@@ -15,26 +21,43 @@ export function CodeIndexPanel({ project, active, onOpen }: {
const [result, setResult] = useState<CodeQuery | null>(null);
const [busy, setBusy] = useState(false);
const [error, setError] = useState('');
const [cacheInfo, setCacheInfo] = useState<ProjectCacheStatus | null>(null);
const [cacheMessage, setCacheMessage] = useState('');
const [cacheError, setCacheError] = useState('');
const request = useRef(0);
const initialLoad = useRef(false);
async function search(nextKind = kind) {
const current = ++request.current;
setBusy(true); setError('');
setBusy(true); setError(''); setCacheMessage('');
try {
const response = await api<CodeQuery>('/projects/' + project.id + '/code-query?query=' + encodeURIComponent(query.trim()) + '&kind=' + nextKind + '&limit=40');
if (current !== request.current || response.index.projectId !== project.id) return;
setResult(response);
if (response.index.cache) setCacheInfo({ ...response.index.cache, latest: response.index.cache });
} catch (cause) {
if (current === request.current) setError(cause instanceof Error ? cause.message : String(cause));
} finally { if (current === request.current) setBusy(false); }
}
useEffect(() => () => { request.current++; initialLoad.current = false; }, [project.id, project.root]);
async function changeCache(action: 'toggle' | 'clear', enabled?: boolean) {
const current = ++request.current; setBusy(true); setCacheError(''); setCacheMessage('');
try {
const response = await (action === 'toggle' ? api<ProjectCacheStatus>('/project-cache', { enabled })
: api<ProjectCacheStatus>('/projects/' + project.id + '/index-cache', {}, 'DELETE'));
if (current !== request.current) return;
setCacheInfo(response);
setCacheMessage(action === 'clear' ? '本项目派生缓存已清除;下次查询重新分析。工程、会话与原工件保留。'
: enabled ? '本机解析缓存已启用;下次查询按当前源码核对。' : '本机解析缓存已关闭;后续查询从当前源码重新分析。');
} catch (cause) { if (current === request.current) setCacheError(cause instanceof Error ? cause.message : String(cause)); }
finally { if (current === request.current) setBusy(false); }
}
useEffect(() => { request.current++; initialLoad.current = false; setResult(null); setCacheInfo(null); setCacheMessage(''); setCacheError('');
return () => { request.current++; initialLoad.current = false; }; }, [project.id, project.root]);
useEffect(() => {
if (active && !initialLoad.current) { initialLoad.current = true; void search(); }
}, [active]);
}, [active, project.id, project.root]);
const index = result?.index, coverage = index?.coverage;
const index = result?.index, coverage = index?.coverage, metrics = cacheInfo?.latest ?? index?.cache;
return <section className="code-index-panel" aria-label="工程索引" hidden={!active}>
<header className="index-heading"><div><span className="field-eyebrow">当前项目 · {project.name}</span><h3>定位代码</h3></div>
<button className="icon-button" aria-label="刷新工程索引" title="重新核对文件变化并刷新结果" disabled={busy} onClick={() => void search()}>
@@ -55,6 +78,22 @@ export function CodeIndexPanel({ project, active, onOpen }: {
<p>{coverage.fileCount} 个文件 · {coverage.symbolCount} 个符号 · {coverage.importCount} 处导入</p>
<span>本次 {index.refresh.updatedFiles} 更新 · {index.refresh.reusedFiles} 复用 · {index.refresh.removedFiles} 移除</span>
</div>
{cacheInfo && <details className="index-cache"><summary>解析缓存 · {cacheInfo.enabled ? '已启用' : '已关闭'}</summary>
<div className="index-cache-controls"><label><input type="checkbox" role="switch" aria-label="启用本机解析缓存" checked={cacheInfo.enabled} disabled={busy}
onChange={event => void changeCache('toggle', event.target.checked)} />启用本机解析缓存</label>
<button className="button secondary" disabled={busy} onClick={() => void changeCache('clear')}>清除本项目缓存</button></div>
<p>开关作用于本机所有项目;清除仅移除当前项目的派生解析材料。</p>
<p>{cacheInfo.diskProjects} / {cacheInfo.maximumProjects} 个项目 · 磁盘 {size(cacheInfo.diskBytes)} / {size(cacheInfo.maximumBytes)} · 单项目上限 {size(cacheInfo.maximumEntryBytes)}</p>
{metrics && <dl className="index-cache-metrics"><dt>上次检索核对</dt><dd>{new Date(metrics.checkedAt).toLocaleString('zh-CN')} · {metrics.sourceVerified ? `${metrics.verificationPasses} 轮 SHA 核对` : '范围不完整'}</dd>
<dt>解析材料</dt><dd>{reason(metrics.origin)} · {metrics.reusedFiles} 复用 / {metrics.parsedFiles} 重新解析</dd>
<dt>失效原因</dt><dd>{metrics.invalidation ? reason(metrics.invalidation) : '未发现已缓存来源变化'}</dd>
<dt>本次检索用时</dt><dd>{Math.round(metrics.durationMs)} ms · 其中解析 {metrics.parseMs.toFixed(1)} ms</dd>
<dt>派生存储</dt><dd>{reason(metrics.storageReason)}</dd></dl>}
<p>每次查询都核对当前来源。本地复用量与模型服务的 token 计费分别记录。</p>
{cacheInfo.error && <p className="index-cache-warning">{cacheInfo.error}</p>}
{cacheError && <p className="index-cache-warning" role="alert">缓存操作未完成:{cacheError} 可重试本次操作。</p>}
{cacheMessage && <p className="index-cache-feedback" aria-live="polite">{cacheMessage}</p>}
</details>}
<details className="index-scope"><summary>查看索引范围与依据</summary>
<p>{coverage.astFiles} 个 JS/TS/React 文件采用静态声明分析;{coverage.pythonCandidateFiles} 个 Python 文件提供声明候选。</p>
<p>已检查 {index.sourceScope.scannedFiles} 个文件,快照上限 {index.sourceScope.maximumFiles} 个文件;单文件符号分析上限 {Math.round(coverage.maximumFileBytes / 1000)} KB。</p>
+6
View File
@@ -10,6 +10,12 @@ export function DiagnosticsPanel({ value, busy, onRefresh }: { value: RuntimeDia
<div className="diagnostic-grid"><section><h3>运行环境</h3><dl><dt>终端</dt><dd>{value.environment.shell}</dd><dt>Node.js</dt><dd>{value.environment.node}</dd><dt>输入与输出</dt><dd>{value.environment.encoding}</dd></dl><p className="diagnostic-note">{value.environment.shellSyntax}</p></section>
<section><h3>模型连接</h3><dl><dt>模式</dt><dd>{value.connection.mode === 'demo' ? '离线演示' : '兼容模型服务'}</dd><dt>模型</dt><dd>{value.connection.model || '未配置'}</dd><dt>服务地址</dt><dd>{value.connection.endpoint}</dd><dt>凭据状态</dt><dd>{value.connection.hasKey ? '本次运行已配置' : '未配置'}</dd></dl>{value.connection.lastRequest && <p className="diagnostic-note">最近请求:{value.connection.lastRequest.status === 'completed' ? '成功' : value.connection.lastRequest.status === 'retrying' ? '重试中' : value.connection.lastRequest.status === 'interrupted' ? '已停止' : '失败'} · {value.connection.lastRequest.attempts ?? 1} 次</p>}</section></div>
{value.session && <section className="diagnostic-session"><div className="diagnostic-section-heading"><h3>当前项目与会话</h3><Status value={value.session.session.status} /></div><strong>{value.session.project.name}</strong><p className="diagnostic-path">{value.session.project.root}</p><p className="diagnostic-note">{value.session.changes.filter(change => change.status === 'applied').length} 项已应用 · {value.session.changes.filter(change => ['pending', 'conflict'].includes(change.status)).length} 项待处理</p></section>}
{value.projectCache && <section aria-label="解析缓存诊断"><h3>项目解析缓存</h3><dl><dt>本机开关</dt><dd>{value.projectCache.enabled ? '已启用' : '已关闭'}</dd>
<dt>派生存储</dt><dd>{value.projectCache.diskProjects} / {value.projectCache.maximumProjects} 个项目 · {(value.projectCache.diskBytes / 1024 / 1024).toFixed(2)} / {(value.projectCache.maximumBytes / 1024 / 1024).toFixed(0)} MiB</dd>
<dt>当前进程</dt><dd>{value.projectCache.memoryProjects ?? 0} 个项目 · {value.projectCache.pending ?? 0} 个核对中</dd>
<dt>当前项目上次核对</dt><dd>{value.projectCache.latest ? new Date(value.projectCache.latest.checkedAt).toLocaleString('zh-CN') : '本次进程尚未检索'}</dd></dl>
{value.projectCache.latest && <p className="diagnostic-note">{value.projectCache.latest.reusedFiles} 份解析材料复用,{value.projectCache.latest.parsedFiles} 份重新解析;来源{value.projectCache.latest.sourceVerified ? '已核对' : '范围不完整'}。</p>}
<p className="diagnostic-note">在工程「索引 → 解析缓存」管理开关与清除。此处仅显示派生缓存状态,不触发工程检索或模型请求。</p>{value.projectCache.error && <p className="diagnostic-note">{value.projectCache.error}</p>}</section>}
{failure && <section className="diagnostic-failure"><div className="diagnostic-section-heading"><h3>最近的错误记录</h3><span>{failure.source === 'model_connection' ? '模型服务请求' : '工作台任务'}</span></div><strong>{failure.title}</strong><p>{failure.message}</p>{failure.detail && <p>{failure.detail}</p>}{failure.occurredAt && <small>{new Date(failure.occurredAt).toLocaleString('zh-CN')}</small>}{failure.suggestion && <p className="diagnostic-note">{failure.suggestion}</p>}</section>}
{!!value.session?.changes.length && <section><h3>文件改动的实际状态</h3><div className="diagnostic-changes">{value.session.changes.map(change => <div key={change.id}><code>{change.path}</code><Status value={change.status} /></div>)}</div></section>}
{!!value.session?.recentTools.length && <section><h3>近期工具结果</h3><div className="diagnostic-tools">{value.session.recentTools.slice(-8).map((tool, index) => <details key={index}><summary><code>{tool.tool}</code><Status value={tool.phase} />{tool.exitCode !== null && <span>退出码 {tool.exitCode}</span>}</summary><pre>{tool.outputExcerpt || '没有文本输出。'}</pre></details>)}</div></section>}
+14
View File
@@ -55,6 +55,7 @@ export interface RuntimeFailure {
export interface ExecutionEnvironment { platform: string; node: string; shell: string; encoding: string; shellSyntax: string }
export interface RuntimeDiagnostics {
version: string; environment: ExecutionEnvironment;
projectCache?: ProjectCacheStatus;
connection: { mode: string; endpoint: string; model: string; hasKey: boolean; lastRequest: { status?: string; attempts?: number; durationMs?: number } | null };
session: {
project: { name: string; root: string }; session: { id: string; status: string; revision: number };
@@ -69,12 +70,25 @@ export interface Bootstrap { token: string; version: string; config: Config; mod
export interface ResearchDoc { id: string; title: string; description: string }
export type CodeQueryKind = 'all' | 'symbols' | 'imports' | 'files';
export interface ProjectCacheMetrics {
enabled: boolean; persistent: boolean; checkedAt: string; sourceVerified: boolean; origin: string; invalidation: string | null;
reusedFiles: number; rebuiltFiles: number; parsedFiles: number; invalidatedFiles: number; removedFiles: number;
verifiedFiles: number; verificationPasses: number; sourceBytesRead: number; parseMs: number; durationMs: number;
stored: boolean; storageReason: string; evictedProjects: number; diskProjects: number; diskBytes: number;
maximumProjects: number; maximumBytes: number; maximumEntryBytes: number; error: string | null;
}
export interface ProjectCacheStatus {
enabled: boolean; persistent: boolean; diskProjects: number; diskBytes: number; maximumProjects: number; maximumBytes: number;
maximumEntryBytes: number; error: string | null; memoryProjects?: number; memoryBytes?: number; pending?: number;
latest?: ProjectCacheMetrics | null; clearedAt?: string; removedProjects?: number;
}
export interface CodeIndexSummary {
schemaVersion: number; projectId: string; projectName: string; parser: string; generatedAt: string; sourceFingerprint: string; indexFingerprint: string;
coverage: { snapshotComplete: boolean; fileCount: number; symbolCount: number; importCount: number; astFiles: number; pythonCandidateFiles: number; unindexedFiles: number; truncated: boolean; maximumFileBytes: number; maximumSymbols: number };
refresh: { updatedFiles: number; reusedFiles: number; removedFiles: number };
sourceScope: { complete: boolean; scannedFiles: number; bytes: number; maximumFiles: number; maximumBytes: number; excludedFiles: number; note: string };
warnings: { path: string; sha256: string; status: string; message: string; line: number }[]; notes: string[];
cache?: ProjectCacheMetrics;
}
export interface CodeResult {
resultKind: 'symbol' | 'import' | 'file'; path: string; line: number; sha256: string; name: string; kind: string;
+14 -4
View File
@@ -24,6 +24,7 @@ export class IndexCache {
if (settings.schemaVersion !== 1 || typeof settings.enabled !== 'boolean') throw failure();
this.enabled = settings.enabled;
}
this.trim();
} catch { this.enabled = false; this.error = '缓存设置无法核对,缓存已关闭;可修复目录后重新启用。'; }
}
}
@@ -40,12 +41,12 @@ export class IndexCache {
}
write(filename, value) {
this.assertDirectory();
if (fs.existsSync(filename)) this.assertFile(filename, Math.max(1024, this.maximumEntryBytes));
if (fs.existsSync(filename)) this.assertFile(filename, Number.MAX_SAFE_INTEGER);
const temporary = path.join(this.directory, '.write-' + randomUUID() + '.tmp');
try {
fs.writeFileSync(temporary, value, { flag: 'wx', mode: 0o600 });
this.assertDirectory();
if (fs.existsSync(filename)) this.assertFile(filename, Math.max(1024, this.maximumEntryBytes));
if (fs.existsSync(filename)) this.assertFile(filename, Number.MAX_SAFE_INTEGER);
fs.renameSync(temporary, filename);
} finally { if (fs.existsSync(temporary)) fs.unlinkSync(temporary); }
}
@@ -77,11 +78,20 @@ export class IndexCache {
return { stored: true, reason: 'stored', evictedProjects };
} catch { this.error = '派生缓存写入失败;当前索引仍来自本次源码核对。'; return { stored: false, reason: 'unavailable' }; }
}
touch(project) {
if (!this.enabled || !this.directory) return { stored: false, reason: this.enabled ? 'process-only' : 'disabled' };
try {
this.assertDirectory(); const filename = path.join(this.directory, this.key(project) + '.json');
if (!fs.existsSync(filename)) return { stored: false, reason: 'cold' };
this.assertFile(filename); const at = new Date(); fs.utimesSync(filename, at, at);
return { stored: true, reason: 'stored', evictedProjects: this.trim() };
} catch { this.error = '派生缓存不可用;当前索引来自本次源码核对。'; return { stored: false, reason: 'unavailable' }; }
}
records() {
if (!this.directory) return [];
this.assertDirectory();
return fs.readdirSync(this.directory).filter(name => recordName.test(name)).map(name => {
const filename = path.join(this.directory, name), stat = this.assertFile(filename);
const filename = path.join(this.directory, name), stat = this.assertFile(filename, Number.MAX_SAFE_INTEGER);
return { filename, bytes: stat.size, touched: stat.mtimeMs };
});
}
@@ -98,7 +108,7 @@ export class IndexCache {
this.assertDirectory();
const names = project ? [path.join(this.directory, this.key(project) + '.json')] : this.records().map(value => value.filename);
let removed = 0;
for (const filename of names) if (fs.existsSync(filename)) { this.assertFile(filename); fs.unlinkSync(filename); removed++; }
for (const filename of names) if (fs.existsSync(filename)) { this.assertFile(filename, Number.MAX_SAFE_INTEGER); fs.unlinkSync(filename); removed++; }
return removed;
}
configure(enabled) {
+6 -6
View File
@@ -1,7 +1,7 @@
import path from 'node:path';
import { createHash } from 'node:crypto';
import { parse } from '@babel/parser';
import { inspectProject } from '../project-inspector.mjs';
import { inspectProject, verifyIndexSnapshot } from '../project-inspector.mjs';
import { readText } from '../../server/files.mjs';
import { performance } from 'node:perf_hooks';
import { IndexCache } from './index-cache.mjs';
@@ -202,11 +202,11 @@ export class ProjectIndex {
}
// Recheck the bounded snapshot after parsing/loading, including names, Git
// identity and access scope. A cache hit cannot close a concurrent change.
const verified = await inspectProject(project, { includeFiles: true, strictSnapshot: true });
if (verified.sourceFingerprint !== inspection.sourceFingerprint || JSON.stringify(verified.files) !== JSON.stringify(inspection.files)
|| verified.git.available !== inspection.git.available || verified.git.head !== inspection.git.head || verified.git.branch !== inspection.git.branch || verified.git.complete !== inspection.git.complete) {
let verified;
try { verified = await verifyIndexSnapshot(project, inspection); }
catch (error) {
this.projects.delete(key); this.identities.delete(key); this.memoryBytes.delete(key);
throw conflict('索引核对期间源码、分支或读取范围已变化,请重新刷新;未使用或保存本次派生缓存。');
throw error;
}
const available = new Map(entries.map(file => [process.platform === 'win32' ? file.path.toLowerCase() : file.path, file]));
const allSymbols = entries.flatMap(file => file.symbols.map(value => ({ ...value, path: file.path, sha256: file.sha256, language: file.language })));
@@ -222,7 +222,7 @@ export class ProjectIndex {
while (this.projects.size > this.maximumProjects || [...this.memoryBytes.values()].reduce((sum, bytes) => sum + bytes, 0) > this.cache.maximumBytes) {
const oldest = this.projects.keys().next().value; this.projects.delete(oldest); this.identities.delete(oldest); this.memoryBytes.delete(oldest); this.latest.delete(oldest);
}
stored = this.cache.save(project, identity, next);
stored = !updatedFiles && !removedFiles && ['memory', 'disk'].includes(loaded.reason) ? this.cache.touch(project) : this.cache.save(project, identity, next);
} else { this.projects.delete(key); this.identities.delete(key); this.memoryBytes.delete(key); }
const warnings = entries.filter(file => ['unindexed', 'partial', 'outside-index-budget'].includes(file.status)).map(file => ({ path: file.path, sha256: file.sha256, status: file.status,
message: file.error ?? (file.opaqueImports ? file.opaqueImports + '处动态导入无法确定静态文件目标;其余声明结果保留。' : '该文件达到索引读取或分析上限;按范围提供已有结果。'), line: file.errorLine ?? 1 }));
+67 -6
View File
@@ -6,6 +6,16 @@ import { runGit } from './git-process.mjs';
import { inspectPythonProject } from './python-project.mjs';
const hash = value => createHash('sha256').update(value).digest('hex');
const accessIdentity = info => hash(JSON.stringify([info.dev, info.ino, info.mode, info.uid, info.gid, info.nlink]));
const changedSnapshot = () => Object.assign(new Error('索引核对期间源码、分支或读取范围已变化,请重新刷新;未保存本次派生缓存。'), { status: 409 });
function gitMarker(root) {
const filename = path.join(root, '.git');
try {
const info = fs.lstatSync(filename);
if (info.isSymbolicLink()) return 'link';
return accessIdentity(info) + (info.isFile() && info.size < 4096 ? ':' + hash(fs.readFileSync(filename)) : '');
} catch (error) { if (error.code === 'ENOENT') return 'absent'; throw error; }
}
const languages = { '.js': 'JavaScript', '.mjs': 'JavaScript', '.cjs': 'JavaScript', '.ts': 'TypeScript', '.tsx': 'TypeScript', '.mts': 'TypeScript', '.cts': 'TypeScript', '.jsx': 'JavaScript', '.py': 'Python', '.go': 'Go', '.rs': 'Rust', '.cs': 'C#', '.vue': 'Vue', '.html': 'HTML', '.css': 'CSS' };
const recognizedScripts = /^(test(?::[a-z0-9_-]+)?|typecheck|check|lint|build)$/i;
@@ -59,7 +69,8 @@ function framework(script) {
}
export async function inspectProject(project, { includeFiles = false, strictSnapshot = false } = {}) {
const root = safePath(project), git = await gitBaseline(project);
const root = safePath(project), rootAccess = strictSnapshot ? accessIdentity(fs.lstatSync(root)) : null,
marker = strictSnapshot ? gitMarker(root) : null, git = await gitBaseline(project);
const inventory = git.paths ? null : listFiles(project, '', 8, 1500);
const candidates = (git.paths ?? inventory.files.filter(file => file.kind === 'file').map(file => file.path)).slice().sort();
const fingerprints = [], names = [], excluded = [], detected = new Set(), sourceFiles = [];
@@ -83,13 +94,18 @@ export async function inspectProject(project, { includeFiles = false, strictSnap
if (info.size > 1024 * 1024 || bytes + info.size > 16 * 1024 * 1024) { complete = false; fingerprints.push([relative, info.size, 'outside-read-budget']); continue; }
const contents = fs.readFileSync(file), sha256 = hash(contents); bytes += contents.length; fingerprints.push([relative, sha256]);
sourceFiles.push({ path: relative, sha256, bytes: contents.length, language: language ?? null,
...(strictSnapshot ? { access: hash(JSON.stringify([info.dev, info.ino, info.mode, info.uid, info.gid, info.nlink])) } : {}) });
...(strictSnapshot ? { access: accessIdentity(info) } : {}) });
} catch (error) {
excluded.push(relative);
if (strictSnapshot || error.message !== '该路径不在可读取的项目范围内。') { complete = false; fingerprints.push([relative, 'unreadable']); }
}
}
const packageFile = declaration(project, 'package.json');
const readDeclaration = relative => {
const value = declaration(project, relative), source = sourceFiles.find(file => file.path === relative);
if (strictSnapshot && value && source?.sha256 && value.sha256 !== source.sha256) throw changedSnapshot();
return value;
};
const packageFile = readDeclaration('package.json');
let manifest = null;
if (packageFile) {
try { manifest = JSON.parse(packageFile.content); } catch { throw new Error('项目package.json不是有效JSON,先修复工程声明。'); }
@@ -102,13 +118,13 @@ export async function inspectProject(project, { includeFiles = false, strictSnap
lifecycle: ['pre' + name, 'post' + name].filter(key => typeof manifest.scripts[key] === 'string').map(key => ({ name: key, script: manifest.scripts[key].slice(0, 6000) })) }));
const rules = [];
for (const relative of names.filter(name => /(^|\/)AGENTS\.md$/i.test(name)).slice(0, 8)) {
const file = declaration(project, relative); if (file) rules.push({ path: relative, sha256: file.sha256, excerpt: file.content.slice(0, 1800), interpretation: 'project-data' });
const file = readDeclaration(relative); if (file) rules.push({ path: relative, sha256: file.sha256, excerpt: file.content.slice(0, 1800), interpretation: 'project-data' });
}
const declarations = {};
for (const relative of ['pyproject.toml', 'Cargo.toml', 'go.mod', 'tsconfig.json']) {
const file = declaration(project, relative); if (file) declarations[relative] = { sha256: file.sha256, excerpt: file.content.slice(0, 1000) };
const file = readDeclaration(relative); if (file) declarations[relative] = { sha256: file.sha256, excerpt: file.content.slice(0, 1000) };
}
const python = inspectPythonProject(project, sourceFiles, relative => declaration(project, relative));
const python = inspectPythonProject(project, sourceFiles, readDeclaration);
const fingerprint = hash(JSON.stringify({ projectId: project.id, root, files: fingerprints, packageSha256: packageFile?.sha256 ?? null,
...(python ? { pythonDeclarationHashes: python.declarationHashes } : {}), head: git.head, gitStatus: git.statusSha256 ?? null, complete }));
const sourceFingerprint = hash(JSON.stringify({ projectId: project.id, root, files: fingerprints,
@@ -119,10 +135,55 @@ export async function inspectProject(project, { includeFiles = false, strictSnap
entryPoints: [manifest?.main, typeof manifest?.bin === 'string' ? manifest.bin : null, names.includes('src/index.ts') ? 'src/index.ts' : null, names.includes('src/index.mjs') ? 'src/index.mjs' : null].filter(value => typeof value === 'string').slice(0, 5),
git: visibleGit, fingerprint, sourceFingerprint, inspectedAt: new Date().toISOString(),
...(includeFiles ? { files: sourceFiles } : {}),
...(strictSnapshot ? { snapshot: { rootAccess, gitMarker: marker, candidates } } : {}),
scope: { complete, scannedFiles: fingerprints.length, bytes, excludedFiles: excluded.length, maximumFiles: 1000, maximumBytes: 16 * 1024 * 1024,
note: '有界快照;Git工程遵循ignore并包含未跟踪源码,跳过依赖、链接和常见凭据路径。' } };
}
// Close the index snapshot without reparsing manifests or repeating unrelated
// Git status/filter/config inspection. Rehash actual bytes through owned handles.
export async function verifyIndexSnapshot(project, inspection) {
const root = safePath(project), snapshot = inspection.snapshot;
if (!snapshot || accessIdentity(fs.lstatSync(root)) !== snapshot.rootAccess || gitMarker(root) !== snapshot.gitMarker) throw changedSnapshot();
let candidates;
if (inspection.git.available) {
const [files, head, branch] = await Promise.all([
gitCommand(root, ['ls-files', '-z', '--cached', '--others', '--exclude-standard', '--', '.']),
gitCommand(root, ['rev-parse', '--verify', 'HEAD']), gitCommand(root, ['symbolic-ref', '--quiet', '--short', 'HEAD']),
]);
if (!files.ok || (head.ok ? head.output.trim() : null) !== inspection.git.head || (branch.ok ? branch.output.trim() : null) !== inspection.git.branch) throw changedSnapshot();
candidates = [...new Set(files.output.split('\0').filter(Boolean))].sort();
} else {
const inventory = listFiles(project, '', 8, 1500);
candidates = inventory.files.filter(file => file.kind === 'file').map(file => file.path).sort();
if (inspection.scope.complete && inventory.truncated) throw changedSnapshot();
}
if (JSON.stringify(candidates) !== JSON.stringify(snapshot.candidates)) throw changedSnapshot();
const directories = new Set([root]);
for (const file of inspection.files) {
if (file.missing) { if (fs.existsSync(path.join(root, file.path))) throw changedSnapshot(); continue; }
const filename = path.join(root, file.path); let directory = path.dirname(filename);
while (!directories.has(directory)) {
const info = fs.lstatSync(directory);
if (!info.isDirectory() || info.isSymbolicLink()) throw changedSnapshot();
directories.add(directory); directory = path.dirname(directory);
}
let handle;
try {
const current = fs.lstatSync(filename);
if (!current.isFile() || current.isSymbolicLink() || accessIdentity(current) !== file.access || current.size !== file.bytes) throw changedSnapshot();
handle = fs.openSync(filename, 'r'); const before = fs.fstatSync(handle);
if (accessIdentity(before) !== file.access || before.size !== file.bytes) throw changedSnapshot();
const bytes = fs.readFileSync(handle), after = fs.fstatSync(handle), last = fs.lstatSync(filename);
if (hash(bytes) !== file.sha256 || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs
|| accessIdentity(last) !== file.access || last.mtimeMs !== after.mtimeMs || last.ctimeMs !== after.ctimeMs) throw changedSnapshot();
} catch { throw changedSnapshot(); }
finally { if (handle !== undefined) fs.closeSync(handle); }
}
if (gitMarker(root) !== snapshot.gitMarker) throw changedSnapshot();
return { inspectedAt: new Date().toISOString(), scope: inspection.scope, files: inspection.files };
}
export function createCheckList(inspection, names) {
if (names !== undefined && (!Array.isArray(names) || !names.length || names.length > 6 || names.some(name => typeof name !== 'string'))) throw new Error('检查脚本选择需要1到6个已识别名称。');
if (inspection.python?.status === 'invalid' && (inspection.packageManager !== 'npm' || names?.some(name => name.startsWith('python:')))) throw new Error(inspection.python.message);
+20
View File
@@ -203,9 +203,18 @@ return async (request, response) => {
version: APP_VERSION, environment: executionEnvironment(),
connection: { mode: store.config.mode, endpoint: store.config.baseUrl, model: store.config.model, hasKey: provider.hasKey(), lastRequest: provider.lastRequest ?? null },
storage: store.storageInfo(),
projectCache: runtime.projectIndexer().status(session ? store.project(session.projectId) : undefined),
session: session ? { ...sessionSnapshot(session, store.project(session.projectId), store.config, value => provider.redact(value)), execution: store.executionSnapshot(session) } : null,
});
}
if (route === '/api/project-cache') {
if (method === 'GET') return json(response, runtime.projectIndexer().status());
if (method === 'POST') {
const input = await body(request);
if (!input || Object.keys(input).length !== 1 || typeof input.enabled !== 'boolean') throw new Error('仅接受enabled缓存开关。');
return json(response, runtime.projectIndexer().configure(input.enabled));
}
}
if (method === 'GET' && route === '/api/research/availability') return json(response, runtime.researchManager().availability());
if (method === 'GET' && route === '/api/engines/deepseek/availability') return json(response, runtime.engineManager().availability(url.searchParams.has('root') ? url.searchParams.get('root') : undefined));
if (method === 'GET' && route === '/api/engines/deepseek/controlled-availability') return json(response, runtime.engineRunner().availability(url.searchParams.has('root') ? url.searchParams.get('root') : undefined));
@@ -244,6 +253,17 @@ return async (request, response) => {
if (typeof input.root !== 'string' || input.root.length > 2000) throw new Error('请输入项目文件夹的完整路径。');
return json(response, store.addProject(input.root), 201);
}
const cacheMatch = route.match(/^\/api\/projects\/([a-f0-9-]+)\/index-cache$/);
if (cacheMatch && ['GET', 'DELETE'].includes(method)) {
const project = store.project(cacheMatch[1]);
await verifyWorkspaceProject(store, project);
if (method === 'DELETE') {
const input = await body(request);
if (!input || Object.keys(input).length) throw new Error('清除派生缓存不接受路径或其他字段。');
return json(response, runtime.projectIndexer().clear(project));
}
return json(response, runtime.projectIndexer().status(project));
}
const projectMatch = route.match(/^\/api\/projects\/([a-f0-9-]+)\/(files|file|inspection|code-index|code-query)$/);
if (method === 'GET' && projectMatch) {
const project = store.project(projectMatch[1]);
+2 -2
View File
@@ -7,8 +7,8 @@
1. [complete] A:现有复用/记忆/请求工件已审查;18次固定Node/React/Python测量及原输入SHA保存,见QA-1.19。跨实例AST重解析有收益,Python收益较小。
2. [complete] B:单一ProjectIndex增加派生持久缓存,项目/解析契约绑定,8项目/32MiB/单项8MiB;损坏和超限回退当前重建。
3. [complete] C:11项新增+11项旧索引22/22通过;同大小mtime、增删改名、分支、mode/EACCES、junction、不完整及并发变化拒绝/降级。
4. [in_progress] D:既有工程索引/运行诊断显示核对、命中/重建/失效原因、容量、关闭/清除;桌面和390px实际操作验证,手机不扩权。
5. [pending] E:同题冷/热/失效比较、Node8/8、React9/9、Python10/10、构建/编译/页面/Git及原修改保护;本地缓存与token用量分开。
4. [complete] D:实际1440/390px7组通过并目视回看;API2/2及观察设备管理拒绝1/1通过。复核重复开销已修正,初次回退计时及失败原件保留。
5. [in_progress] E:同题冷/热/失效比较、Node8/8、React9/9、Python10/10、构建/编译/页面/Git及原修改保护;本地缓存与token用量分开。
6. [pending] F:完整历史回归、独立源码/便携/同载荷安装、保留全状态升级、原生回看、证据封存、下一计划及本地Git收尾。
每个独立切片通过相关检查后回顾、提交。失败原件保留,重试使用新收据;正式升级用新不可变发行,不覆盖运行目录。
+9
View File
@@ -66,6 +66,15 @@ async function running(t) {
return { ...f, gateway, runtime, request, pair };
}
test('observe-only device authority cannot read, configure or clear project parsing caches', async t => {
const f = await running(t), paired = await f.pair();
assert.equal((await f.request('/mobile-api/projects', undefined, { cookie: paired.cookie })).status, 200);
for (const route of ['/api/project-cache', '/api/projects/' + f.project.id + '/index-cache', '/mobile-api/project-cache', '/mobile-api/projects/' + f.project.id + '/index-cache']) {
for (const data of [undefined, { enabled: false }]) assert.equal((await f.request(route, data, { cookie: paired.cookie })).status, 404);
}
assert.equal(fs.existsSync(path.join(f.data, 'cache', 'project-index')), false);
});
test('pairing is short lived, single-use, generation-bound and validates exact permissions', t => {
const f = setup(t), pair = f.registry.pair(f.grant, 'generation');
assert.match(pair.token, /^[A-Za-z0-9_-]{43}$/);
+43
View File
@@ -0,0 +1,43 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fixture, launchWorkbench } from './helpers.mjs';
const content = value => { const { exportedAt, ...record } = value; assert.ok(Number.isFinite(Date.parse(exportedAt))); return record; };
test('cache controls require desktop authority, exact inputs and owned project identity while preserving task evidence', async t => {
const f = fixture(t); fs.writeFileSync(path.join(f.projectRoot, 'main.ts'), 'export const current = 1;\n');
const host = await launchWorkbench(t, f.data), route = '/projects/' + f.project.id;
const before = content(await host.api('/sessions/' + f.session.id + '/export')), config = (await host.api('/bootstrap')).config;
const source = fs.readFileSync(path.join(f.projectRoot, 'main.ts'));
assert.equal((await fetch(host.url + '/api/project-cache', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{"enabled":false}' })).status, 403);
assert.equal((await fetch(host.url + '/api' + route + '/index-cache', { method: 'DELETE', headers: { 'Content-Type': 'application/json' }, body: '{}' })).status, 403);
await assert.rejects(host.api('/project-cache', { enabled: true, path: f.root }), { status: 400 });
await assert.rejects(host.api('/project-cache', { enabled: 'yes' }), { status: 400 });
await assert.rejects(host.api('/projects/00000000-0000-0000-0000-000000000000/index-cache'), { status: 404 });
const first = await host.api(route + '/code-index'); assert.equal(first.cache.parsedFiles, 1);
const query = await host.api(route + '/code-query?query=current&kind=symbols'); assert.equal(query.index.cache.parsedFiles, 0);
assert.equal(query.results[0].name, 'current');
const diagnostics = await host.api('/diagnostics?session=' + f.session.id);
assert.equal(diagnostics.projectCache.latest.sourceVerified, true);
assert.equal(diagnostics.projectCache.latest.checkedAt, query.index.cache.checkedAt, 'diagnostics does not perform another query');
assert.equal((await host.api('/project-cache', { enabled: false })).enabled, false);
assert.equal((await host.api(route + '/code-index')).cache.parsedFiles, 1);
const clear = await fetch(host.url + '/api' + route + '/index-cache', { method: 'DELETE', headers: {
'Content-Type': 'application/json', 'X-Workbench-Token': host.bootstrap.token }, body: '{}' });
assert.equal(clear.status, 200); assert.equal((await clear.json()).removedProjects, 1);
assert.equal((await host.api(route + '/index-cache')).diskProjects, 0);
assert.deepEqual(content(await host.api('/sessions/' + f.session.id + '/export')), before);
assert.deepEqual((await host.api('/bootstrap')).config, config); assert.deepEqual(fs.readFileSync(path.join(f.projectRoot, 'main.ts')), source);
});
test('cache enablement and derived reuse survive a real host restart without becoming task recovery state', async t => {
const f = fixture(t); fs.writeFileSync(path.join(f.projectRoot, 'main.py'), 'def candidate():\n return 1\n');
const first = await launchWorkbench(t, f.data), route = '/projects/' + f.project.id;
const indexed = await first.api(route + '/code-index'); await first.api('/project-cache', { enabled: false }); await first.close();
const second = await launchWorkbench(t, f.data);
assert.equal((await second.api('/project-cache')).enabled, false);
await second.api('/project-cache', { enabled: true });
const reused = await second.api(route + '/code-index'); assert.equal(reused.cache.origin, 'disk'); assert.equal(reused.cache.parsedFiles, 0);
assert.equal(reused.indexFingerprint, indexed.indexFingerprint); assert.equal((await second.api('/sessions/' + f.session.id)).status, 'idle');
});