@sanqianx/project-knowledge 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +16 -0
- package/README.md +17 -14
- package/bin/project-knowledge-integrations.js +3 -3
- package/bin/project-knowledge-kb.js +2 -2
- package/bin/project-knowledge-mcp.js +3 -3
- package/bin/project-knowledge.js +5 -5
- package/module-runtime-manifest.json +24 -23
- package/package.json +31 -27
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/{_site → src}/README.md +30 -30
- package/{_site/lib → src/automation}/capture-hook-config.js +1 -1
- package/{_site/lib → src/automation}/commit-conversation-binder.js +4 -4
- package/{_site/lib → src/automation}/commit-processing-ledger.js +27 -27
- package/{_site/lib → src/automation}/commit-reconciler.js +11 -11
- package/{_site/lib → src/automation}/hook-manager.js +203 -203
- package/{_site/lib → src/automation}/post-commit-automation.js +87 -87
- package/{_site/lib → src/common}/atomic-file.js +1 -0
- package/{_site/lib → src/common}/runtime-endpoint.js +153 -160
- package/{_site/lib → src/common}/structured-logger.js +574 -574
- package/{_site/lib → src/conversations}/bridge-adapter.js +2 -2
- package/{_site/lib → src/conversations}/codex-notify-config.js +6 -3
- package/{_site/lib → src/conversations}/conversation-exclusions.js +2 -2
- package/{_site/lib → src/conversations}/conversation-query-service.js +144 -144
- package/{_site/lib → src/conversations}/conversation-store.js +3 -3
- package/{_site/lib → src/conversations}/zcode-context-integration.js +1 -1
- package/{_site/lib → src/integrations}/ai-profile-resolver.js +78 -78
- package/{_site/lib → src/integrations}/ai-workspace.js +101 -101
- package/{_site/lib → src/integrations}/claude-cli-runner.js +1510 -1510
- package/{_site/lib → src/integrations}/integration-installer.js +11 -15
- package/{_site/lib → src/integrations}/llm-client.js +161 -161
- package/{_site/lib → src/knowledge}/context-pack-builder.js +3 -3
- package/{_site/lib → src/knowledge}/evidence-bundle.js +2 -2
- package/{_site/lib → src/knowledge}/index-service.js +173 -173
- package/{_site/lib → src/knowledge}/kb-framework.js +171 -191
- package/{_site/lib → src/knowledge}/knowledge-promotion.js +6 -6
- package/{_site/lib → src/knowledge}/knowledge-retrieval-service.js +401 -401
- package/{_site/lib → src/module_bridge}/engine-connection.js +2 -2
- package/{_site/lib → src/module_bridge}/engine-knowledge-client.js +3 -3
- package/{_site/lib → src/module_bridge}/module-bridge.js +99 -10
- package/{_site/lib → src/projects}/github-team-store.js +1172 -1172
- package/{_site/lib → src/projects}/project-lifecycle-service.js +5 -5
- package/{_site/lib → src/projects}/project-registry-store.js +3 -3
- package/{_site/lib → src/projects}/project-store.js +268 -268
- package/{_site/lib → src/projects}/scanner.js +3 -3
- package/{_site/lib → src/projects}/settings-store.js +3 -3
- package/{_site → src}/scripts/ab-rank-v2-v3.js +4 -4
- package/{_site → src}/scripts/hook-trigger.js +158 -158
- package/{_site → src}/scripts/install-module-candidates.js +2 -2
- package/{_site → src}/scripts/pack-module-candidates.js +5 -3
- package/{_site → src}/scripts/refresh-runtime-manifest.js +1 -1
- package/{_site → src}/scripts/run-retrieval-gold-isolated.js +6 -6
- package/{_site → src}/scripts/sync-product-content.js +2 -2
- package/{_site → src}/scripts/verify-product-runtime.js +3 -3
- package/{_site → src}/scripts/verify-retrieval-gold.js +1 -1
- package/{_site/lib → src/server}/product-data.js +2 -2
- package/{_site/lib → src/server}/server-app.js +74 -52
- package/{_site/lib → src/server}/storage-layout.js +166 -166
- package/{_site → src}/server.js +1 -1
- package/{_site/lib → src/tools}/knowledge-tool-runtime.js +366 -366
- package/{_site/lib → src/tools}/prompt-registry.js +1 -1
- package/{_site/lib → src/tools}/requirement-adapters.js +1 -1
- package/{_site/lib → src/tools}/requirement-binder.js +4 -4
- package/{_site/lib → src/tools}/requirement-recorder.js +278 -278
- package/{_site/lib → src/tools}/workflow-tool-runtime.js +3 -3
- package/_site/_test/agent-capture-mcp-ui-test.js +0 -118
- package/_site/_test/agent-capture-ui-test.js +0 -103
- package/_site/_test/ai-profile-resolver-test.js +0 -137
- package/_site/_test/ai-profile-test.js +0 -75
- package/_site/_test/ai-team-ui-integration-test.js +0 -219
- package/_site/_test/ai-vendor-presets-test.js +0 -91
- package/_site/_test/appearance-settings-test.js +0 -148
- package/_site/_test/automatic-context-test.js +0 -95
- package/_site/_test/automation-queue-test.js +0 -14
- package/_site/_test/automation-ui-test.js +0 -40
- package/_site/_test/background-task-registry-test.js +0 -43
- package/_site/_test/baseline-schema-test.js +0 -91
- package/_site/_test/bin-cli-test.js +0 -231
- package/_site/_test/bridge-adapter-test.js +0 -95
- package/_site/_test/bridge-consumer-service-test.js +0 -310
- package/_site/_test/candidate-bin-content-test.js +0 -35
- package/_site/_test/candidate-product-assets-test.js +0 -13
- package/_site/_test/candidate-release-contract-test.js +0 -14
- package/_site/_test/capture-hook-dedup-test.js +0 -198
- package/_site/_test/cdp-browser-failure-test.js +0 -103
- package/_site/_test/chat-claudecodeui-match-test.js +0 -111
- package/_site/_test/claude-executable-discovery-test.js +0 -90
- package/_site/_test/claude-session-lifecycle-sweep-test.js +0 -252
- package/_site/_test/claude-workbench-test.js +0 -174
- package/_site/_test/cli-instance-management-test.js +0 -62
- package/_site/_test/cli-version-report-test.js +0 -22
- package/_site/_test/client-capture-restart-e2e-test.js +0 -189
- package/_site/_test/codex-conversation-projection-test.js +0 -60
- package/_site/_test/codex-marketplace-scoped-path-test.js +0 -186
- package/_site/_test/codex-notify-capture-e2e-test.js +0 -101
- package/_site/_test/codex-notify-fanout-test.js +0 -141
- package/_site/_test/codex-notify-upgrade-test.js +0 -260
- package/_site/_test/commit-boundary-freeze-test.js +0 -147
- package/_site/_test/commit-conversation-binding-test.js +0 -99
- package/_site/_test/commit-evidence-test.js +0 -110
- package/_site/_test/configuration-generation-test.js +0 -22
- package/_site/_test/context-pack-test.js +0 -200
- package/_site/_test/context-session-index-test.js +0 -254
- package/_site/_test/conversation-api-test.js +0 -119
- package/_site/_test/conversation-origin-test.js +0 -15
- package/_site/_test/conversation-store-test.js +0 -138
- package/_site/_test/cross-repo-isolation-e2e-test.js +0 -187
- package/_site/_test/desktop-browser-compat-test.js +0 -28
- package/_site/_test/desktop-hook-runtime-regression-test.js +0 -204
- package/_site/_test/embedding-config-test.js +0 -32
- package/_site/_test/explicit-commit-processor-test.js +0 -37
- package/_site/_test/fixtures/fake-browser-exit.js +0 -10
- package/_site/_test/fixtures/fake-browser-hang.js +0 -10
- package/_site/_test/fixtures/integration-busy-worker.cjs +0 -14
- package/_site/_test/fixtures/make-git-repos.js +0 -92
- package/_site/_test/fixtures/retrieval-gold-queries.json +0 -36
- package/_site/_test/fixtures/slow-startup-integration.cjs +0 -12
- package/_site/_test/fixtures/startup-repair-worker.cjs +0 -13
- package/_site/_test/folder-picker-output-test.js +0 -19
- package/_site/_test/fresh-hook-reimport-test.js +0 -53
- package/_site/_test/fresh-product-data-test.js +0 -56
- package/_site/_test/full-integration-e2e-test.js +0 -167
- package/_site/_test/git-path-compatibility-test.js +0 -80
- package/_site/_test/git-validation-test.js +0 -81
- package/_site/_test/glm-ui-refresh-review-test.js +0 -313
- package/_site/_test/harness-isolation-test.js +0 -138
- package/_site/_test/helpers/ai-team-ui-fixture.js +0 -235
- package/_site/_test/helpers/cdp-browser.js +0 -386
- package/_site/_test/helpers/cdp-network-capture.js +0 -66
- package/_site/_test/helpers/find-chrome.js +0 -34
- package/_site/_test/helpers/free-port.js +0 -8
- package/_site/_test/helpers/logging-ui-fixture.js +0 -131
- package/_site/_test/helpers/module-fixture.js +0 -282
- package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +0 -606
- package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +0 -464
- package/_site/_test/helpers/parallel-dock-acceptance-env.js +0 -301
- package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +0 -378
- package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +0 -314
- package/_site/_test/helpers/parallel-dock-acceptance-ui.js +0 -195
- package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +0 -113
- package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +0 -307
- package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +0 -373
- package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +0 -314
- package/_site/_test/helpers/parallel-engine-advanced-engine-child.js +0 -45
- package/_site/_test/helpers/parallel-engine-advanced-fault-writer.js +0 -171
- package/_site/_test/helpers/parallel-engine-advanced-harness.js +0 -245
- package/_site/_test/helpers/parallel-engine-advanced-standin-analyzer.js +0 -80
- package/_site/_test/helpers/parallel-engine-advanced-ui-host.js +0 -177
- package/_site/_test/helpers/parallel-engine-final-harness.js +0 -314
- package/_site/_test/helpers/parallel-engine-final-standin-analyzer.js +0 -159
- package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +0 -340
- package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +0 -82
- package/_site/_test/helpers/parallel-knowledge-fixture.js +0 -255
- package/_site/_test/helpers/parallel-logging-acceptance-fixture.js +0 -111
- package/_site/_test/helpers/parallel-logging-acceptance-proxy.js +0 -106
- package/_site/_test/helpers/parallel-logging-fix-r2-proxy.js +0 -205
- package/_site/_test/helpers/parallel-logging-integration-5025-env.js +0 -432
- package/_site/_test/helpers/parallel-memory-analyzer.js +0 -81
- package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +0 -605
- package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +0 -176
- package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +0 -577
- package/_site/_test/helpers/parallel-memory-event-bridge.js +0 -128
- package/_site/_test/helpers/parallel-memory-injection-shell.js +0 -723
- package/_site/_test/helpers/parallel-memory-injection-wb-host.js +0 -81
- package/_site/_test/helpers/parallel-memory-shell.js +0 -489
- package/_site/_test/helpers/parallel-nav-isolation-env.js +0 -389
- package/_site/_test/helpers/parallel-nav-module-ui.js +0 -186
- package/_site/_test/helpers/parallel-nav-proxy.js +0 -148
- package/_site/_test/helpers/parallel-nav-shell.js +0 -361
- package/_site/_test/helpers/parallel-qa-engine-endpoint-guard.js +0 -206
- package/_site/_test/helpers/parallel-qa-engine-endpoint-isolate.js +0 -259
- package/_site/_test/helpers/parallel-retrieval-followup-corpus.js +0 -293
- package/_site/_test/helpers/parallel-retrieval-followup-next-session.js +0 -70
- package/_site/_test/helpers/parallel-retrieval-followup-r2-shell.js +0 -737
- package/_site/_test/helpers/parallel-retrieval-followup-r2-wb-host.js +0 -82
- package/_site/_test/helpers/parallel-retrieval-followup-shell.js +0 -279
- package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +0 -295
- package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +0 -573
- package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +0 -69
- package/_site/_test/helpers/parallel-workbench-fixture.js +0 -371
- package/_site/_test/helpers/parallel-workbench-host.js +0 -80
- package/_site/_test/helpers/parallel-workbench-integration-5025-fixture.js +0 -408
- package/_site/_test/helpers/parallel-workbench-integration-5025-harness.js +0 -593
- package/_site/_test/helpers/parallel-workbench-integration-5025-host.js +0 -70
- package/_site/_test/helpers/parallel-workbench-integration-5025-launcher.js +0 -240
- package/_site/_test/helpers/parallel-workbench-integration-5025-runtime-harness.js +0 -630
- package/_site/_test/helpers/parallel-workbench-runtime-harness.js +0 -587
- package/_site/_test/helpers/parallel-workbench-source-map.js +0 -196
- package/_site/_test/helpers/qa-r44-env.js +0 -418
- package/_site/_test/helpers/qa-r44-report.js +0 -656
- package/_site/_test/helpers/qa-r44-ui.js +0 -347
- package/_site/_test/helpers/qa-r45-harness.js +0 -94
- package/_site/_test/helpers/qa-r48-env.js +0 -64
- package/_site/_test/helpers/qa-r49-wb-host.js +0 -58
- package/_site/_test/helpers/qa-r51-env.cjs +0 -77
- package/_site/_test/helpers/qa-r91-harness.cjs +0 -534
- package/_site/_test/helpers/single-repo-maintenance-fixture.js +0 -94
- package/_site/_test/helpers/single-repo-maintenance-tool.js +0 -56
- package/_site/_test/helpers/spawn-server.js +0 -106
- package/_site/_test/helpers/version-visibility-fixture.js +0 -251
- package/_site/_test/home-overview-test.js +0 -64
- package/_site/_test/hook-relocation-rebind-test.js +0 -120
- package/_site/_test/hook-runtime-endpoint-test.js +0 -88
- package/_site/_test/hook-status-repair-api-test.js +0 -152
- package/_site/_test/hook-trigger-test.js +0 -85
- package/_site/_test/hook-worktree-test.js +0 -42
- package/_site/_test/import-preflight-api-test.js +0 -234
- package/_site/_test/index-builder-test.js +0 -41
- package/_site/_test/index-error-display-contract-test.js +0 -32
- package/_site/_test/index-writer-concurrency-test.js +0 -135
- package/_site/_test/integration-adapters-test.js +0 -262
- package/_site/_test/integration-auto-repair-test.js +0 -115
- package/_site/_test/integration-capture-setup-test.js +0 -118
- package/_site/_test/integration-intent-test.js +0 -85
- package/_site/_test/integration-runtime-binding-a2-test.js +0 -566
- package/_site/_test/integration-runtime-binding-a3-test.js +0 -227
- package/_site/_test/integration-runtime-binding-test.js +0 -473
- package/_site/_test/integration-status-scan-test.js +0 -160
- package/_site/_test/integration-surface-coverage-test.js +0 -165
- package/_site/_test/kb-framework-test.js +0 -57
- package/_site/_test/kbpath-follow-test.js +0 -63
- package/_site/_test/knowledge-db-test.js +0 -144
- package/_site/_test/knowledge-engine-client-test.js +0 -120
- package/_site/_test/knowledge-language-control-test.js +0 -170
- package/_site/_test/knowledge-maintenance-test.js +0 -40
- package/_site/_test/knowledge-panel-lifecycle-test.js +0 -154
- package/_site/_test/knowledge-panel-ui-contract-test.js +0 -110
- package/_site/_test/knowledge-promotion-recovery-test.js +0 -260
- package/_site/_test/knowledge-query-test.js +0 -54
- package/_site/_test/knowledge-retrieval-service-test.js +0 -77
- package/_site/_test/knowledge-scopes-test.js +0 -37
- package/_site/_test/knowledge-storage-location-test.js +0 -28
- package/_site/_test/knowledge-storage-startup-test.js +0 -52
- package/_site/_test/knowledge-store-logs-supervision-test.js +0 -89
- package/_site/_test/launcher-readiness-test.js +0 -80
- package/_site/_test/legacy-claude-session-alias-test.js +0 -106
- package/_site/_test/legacy-relocation-recovery-test.js +0 -258
- package/_site/_test/legacy-routes-removed-test.js +0 -47
- package/_site/_test/legacy-workbench-exclusion-test.js +0 -92
- package/_site/_test/live-gateway-test.js +0 -48
- package/_site/_test/local-marketplace-test.js +0 -16
- package/_site/_test/log-redaction-test.js +0 -58
- package/_site/_test/logging-api-test.js +0 -89
- package/_site/_test/logging-sse-no-gap-test.js +0 -88
- package/_site/_test/logging-ui-test.js +0 -107
- package/_site/_test/markdown-delta-overlay-test.js +0 -85
- package/_site/_test/markdown-maintenance-api-test.js +0 -75
- package/_site/_test/markdown-maintenance-test.js +0 -11
- package/_site/_test/mcp-server-test.js +0 -149
- package/_site/_test/memory-groups-ui-test.js +0 -173
- package/_site/_test/model-context-windows-test.js +0 -89
- package/_site/_test/module-agent-start-proxy-test.js +0 -65
- package/_site/_test/module-artifact-integrity-test.js +0 -27
- package/_site/_test/module-boundary-test.js +0 -30
- package/_site/_test/module-bridge-eventbridge-test.js +0 -202
- package/_site/_test/module-dynamic-port-test.js +0 -118
- package/_site/_test/module-index-proxy-test.js +0 -33
- package/_site/_test/module-model-configuration-test.js +0 -44
- package/_site/_test/module-process-lifecycle-test.js +0 -35
- package/_site/_test/module-stream-proxy-test.js +0 -34
- package/_site/_test/module-supervisor-backoff-reset-test.js +0 -64
- package/_site/_test/module-terminal-restart-test.js +0 -63
- package/_site/_test/module-wiring-unbind-race-test.js +0 -59
- package/_site/_test/native-context-integrations-test.js +0 -86
- package/_site/_test/non-release-ci-test.js +0 -34
- package/_site/_test/offline-boundary-isolation-test.js +0 -32
- package/_site/_test/orphaned-claim-recovery-test.js +0 -80
- package/_site/_test/package-boundary-test.js +0 -48
- package/_site/_test/package-startup-test.js +0 -56
- package/_site/_test/packaged-ui-smoke-test.js +0 -126
- package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +0 -524
- package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +0 -577
- package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +0 -381
- package/_site/_test/parallel-ci-r9-posix-socket-budget-test.js +0 -156
- package/_site/_test/parallel-engine-advanced-eng005-test.js +0 -136
- package/_site/_test/parallel-engine-advanced-eng006-test.js +0 -171
- package/_site/_test/parallel-engine-advanced-eng007-reconcile-test.js +0 -231
- package/_site/_test/parallel-engine-advanced-eng009-test.js +0 -208
- package/_site/_test/parallel-engine-advanced-eng010-test.js +0 -213
- package/_site/_test/parallel-engine-advanced-eng011-ui-probe.js +0 -459
- package/_site/_test/parallel-engine-final-eng002-test.js +0 -255
- package/_site/_test/parallel-engine-final-eng007-test.js +0 -269
- package/_site/_test/parallel-engine-final-eng011-test.js +0 -197
- package/_site/_test/parallel-engine-final-eng012-test.js +0 -354
- package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +0 -304
- package/_site/_test/parallel-knowledge-client-error-code-test.js +0 -194
- package/_site/_test/parallel-knowledge-engine-test.js +0 -353
- package/_site/_test/parallel-knowledge-retrieval-test.js +0 -292
- package/_site/_test/parallel-knowledge-vector-test.js +0 -168
- package/_site/_test/parallel-linux-ci-r7-log007-day-test.js +0 -110
- package/_site/_test/parallel-logging-acceptance-log003-probe.js +0 -78
- package/_site/_test/parallel-logging-acceptance-log003-test.js +0 -224
- package/_site/_test/parallel-logging-acceptance-log004-probe.js +0 -85
- package/_site/_test/parallel-logging-acceptance-log004-test.js +0 -231
- package/_site/_test/parallel-logging-acceptance-log005-test.js +0 -208
- package/_site/_test/parallel-logging-acceptance-log006-test.js +0 -214
- package/_site/_test/parallel-logging-acceptance-log007-test.js +0 -223
- package/_site/_test/parallel-logging-acceptance-log008-test.js +0 -192
- package/_site/_test/parallel-logging-fix-r2-crash-probe.js +0 -271
- package/_site/_test/parallel-logging-fix-r2-gap-test.js +0 -294
- package/_site/_test/parallel-logging-fix-r2-normalhook-test.js +0 -330
- package/_site/_test/parallel-logging-integration-5025-portability-test.js +0 -554
- package/_site/_test/parallel-memory-candidate-test.js +0 -353
- package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +0 -238
- package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +0 -371
- package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +0 -439
- package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +0 -333
- package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +0 -519
- package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +0 -569
- package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +0 -374
- package/_site/_test/parallel-memory-home-review-test.js +0 -148
- package/_site/_test/parallel-memory-injection-origin-probe.js +0 -412
- package/_site/_test/parallel-memory-injection-probe.js +0 -411
- package/_site/_test/parallel-memory-manual-test.js +0 -292
- package/_site/_test/parallel-memory-scope-test.js +0 -98
- package/_site/_test/parallel-memory-source-test.js +0 -254
- package/_site/_test/parallel-memory-sync-test.js +0 -274
- package/_site/_test/parallel-memory-view-r8-reload-gate-test.js +0 -123
- package/_site/_test/parallel-nav-failure-test.js +0 -139
- package/_site/_test/parallel-nav-home-issues-test.js +0 -159
- package/_site/_test/parallel-nav-isolation-test.js +0 -308
- package/_site/_test/parallel-nav-isolation-vector-path-test.js +0 -90
- package/_site/_test/parallel-nav-offline-test.js +0 -300
- package/_site/_test/parallel-nav-operability-test.js +0 -268
- package/_site/_test/parallel-nav-switch-test.js +0 -293
- package/_site/_test/parallel-nav-theme-test.js +0 -176
- package/_site/_test/parallel-nav-viewport-test.js +0 -321
- package/_site/_test/parallel-qa-engine-endpoint-guard-test.js +0 -275
- package/_site/_test/parallel-retrieval-followup-citation-test.js +0 -219
- package/_site/_test/parallel-retrieval-followup-corpus-test.js +0 -289
- package/_site/_test/parallel-workbench-drafts-r4-probe.js +0 -477
- package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +0 -89
- package/_site/_test/parallel-workbench-drafts-r5-probe.js +0 -593
- package/_site/_test/parallel-workbench-independent-host.js +0 -262
- package/_site/_test/parallel-workbench-integration-5025-abort-probe.js +0 -340
- package/_site/_test/parallel-workbench-integration-5025-drafts-probe.js +0 -588
- package/_site/_test/parallel-workbench-integration-5025-env-check.js +0 -317
- package/_site/_test/parallel-workbench-integration-5025-model-probe.js +0 -342
- package/_site/_test/parallel-workbench-integration-5025-ordering-probe.js +0 -326
- package/_site/_test/parallel-workbench-model-probe.js +0 -336
- package/_site/_test/parallel-workbench-offline-test.js +0 -169
- package/_site/_test/parallel-workbench-provenance-trace.js +0 -134
- package/_site/_test/parallel-workbench-runtime-minimax-probe.js +0 -321
- package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +0 -307
- package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +0 -313
- package/_site/_test/parallel-workbench-runtime-wb008-abort.js +0 -321
- package/_site/_test/parallel-workbench-source-match.js +0 -206
- package/_site/_test/parallel-workbench-standalone-turn.js +0 -349
- package/_site/_test/path-consistency-test.js +0 -151
- package/_site/_test/pending-sweep-test.js +0 -9
- package/_site/_test/post-commit-automation-test.js +0 -87
- package/_site/_test/pr-consumer-contract-test.js +0 -55
- package/_site/_test/product-brand-contract-test.js +0 -25
- package/_site/_test/product-diagnostics-ui-test.js +0 -105
- package/_site/_test/product-empty-state-test.js +0 -214
- package/_site/_test/product-import-ui-test.js +0 -245
- package/_site/_test/product-navigation-test.js +0 -213
- package/_site/_test/product-progress-status-test.js +0 -100
- package/_site/_test/project-delete-recovery-test.js +0 -64
- package/_site/_test/project-domain-create-test.js +0 -91
- package/_site/_test/project-domain-scope-retrieval-test.js +0 -214
- package/_site/_test/project-git-init-confirm-test.js +0 -115
- package/_site/_test/project-goal-editor-test.js +0 -145
- package/_site/_test/project-import-duplicate-alias-test.js +0 -134
- package/_site/_test/project-import-unicode-restart-test.js +0 -140
- package/_site/_test/project-lifecycle-transaction-test.js +0 -106
- package/_site/_test/project-module-partial-recovery-test.js +0 -237
- package/_site/_test/project-remove-running-guard-test.js +0 -79
- package/_site/_test/project-store-test.js +0 -90
- package/_site/_test/project-team-ui-test.js +0 -128
- package/_site/_test/project-unbind-late-read-ui-test.js +0 -281
- package/_site/_test/project-unbind-writer-guard-test.js +0 -231
- package/_site/_test/prompt-settings-test.js +0 -115
- package/_site/_test/protected-architecture-gate-test.js +0 -123
- package/_site/_test/qa-r44-permission-question.js +0 -756
- package/_site/_test/qa-r45-offline-backfill-test.js +0 -279
- package/_site/_test/qa-r48-sys003-blank-secret-test.js +0 -258
- package/_site/_test/qa-r49-sys003-real-blank-probe.js +0 -374
- package/_site/_test/recovery-label-contract-test.js +0 -55
- package/_site/_test/refactor-characterization-test.js +0 -36
- package/_site/_test/registry-events-test.js +0 -38
- package/_site/_test/release-version-sync-test.js +0 -115
- package/_site/_test/requirement-binding-test.js +0 -113
- package/_site/_test/requirement-recorder-test.js +0 -173
- package/_site/_test/run-all-tests.js +0 -196
- package/_site/_test/runtime-endpoint-test.js +0 -64
- package/_site/_test/scanner-test.js +0 -83
- package/_site/_test/server-security-test.js +0 -96
- package/_site/_test/sessions-stream-test.js +0 -93
- package/_site/_test/shared-contracts-test.js +0 -58
- package/_site/_test/shared-scope-root-binding-test.js +0 -75
- package/_site/_test/simple-import-test.js +0 -98
- package/_site/_test/single-repo-maintenance-e2e-test.js +0 -200
- package/_site/_test/startup-analysis-disabled-test.js +0 -16
- package/_site/_test/startup-integration-isolation-test.js +0 -59
- package/_site/_test/startup-integration-repair-test.js +0 -43
- package/_site/_test/storage-foundation-test.js +0 -78
- package/_site/_test/structured-logger-test.js +0 -101
- package/_site/_test/t07b-cln-005-coverage-test.js +0 -212
- package/_site/_test/t07c-cln-001-002-007-coverage-test.js +0 -135
- package/_site/_test/t07d-git-rel-coverage-test.js +0 -226
- package/_site/_test/t07e-qta-coverage-test.js +0 -195
- package/_site/_test/t07f-mem-008-coverage-test.js +0 -100
- package/_site/_test/team-knowledge-store-sparse-checkout-test.js +0 -196
- package/_site/_test/team-knowledge-store-test.js +0 -132
- package/_site/_test/test-server-cleanup-test.js +0 -35
- package/_site/_test/test-server-module-isolation-test.js +0 -37
- package/_site/_test/tracking-start-test.js +0 -144
- package/_site/_test/vector-storage-root-test.js +0 -75
- package/_site/_test/version-visibility-browser-probe.js +0 -249
- package/_site/_test/version-visibility-test.js +0 -92
- package/_site/_test/workbench-context-receipts-test.js +0 -27
- package/_site/_test/workbench-permission-test.js +0 -118
- package/_site/_test/workflow-module-wiring-test.js +0 -252
- package/_site/_test/workflow-tools-test.js +0 -243
- package/_site/_test/workspace-ui-contract-test.js +0 -77
- package/_site/_test/zcode-capture-integration-test.js +0 -112
- package/templates/change.md +0 -30
- package/templates/project-readme.md +0 -52
- /package/docs/{assets → images}/architecture.svg +0 -0
- /package/docs/{assets → images}/dashboard.png +0 -0
- /package/docs/{assets → images}/draft-review.png +0 -0
- /package/docs/{assets → images}/logo.svg +0 -0
- /package/docs/{assets → images}/runs-drafts.png +0 -0
- /package/docs/{assets → images}/settings.png +0 -0
- /package/{ui → resources/ui}/favicon.svg +0 -0
- /package/{ui → resources/ui}/index.html +0 -0
- /package/{ui → resources/ui}/knowledge-panel.html +0 -0
- /package/{ui → resources/ui}/live-client.js +0 -0
- /package/{ui → resources/ui}/product.css +0 -0
- /package/{ui → resources/ui}/product.js +0 -0
- /package/{ui → resources/ui}/version-info.css +0 -0
- /package/{ui → resources/ui}/version-info.js +0 -0
- /package/{_site/lib → src/automation}/automation-config.js +0 -0
- /package/{_site/lib → src/automation}/commit-prompt.js +0 -0
- /package/{_site/lib → src/common}/cli-instances.js +0 -0
- /package/{_site/lib → src/common}/contracts.js +0 -0
- /package/{_site/lib → src/common}/data-dir.js +0 -0
- /package/{_site/lib → src/common}/folder-picker-output.js +0 -0
- /package/{_site/lib → src/common}/git-path.js +0 -0
- /package/{_site/lib → src/common}/git-runner.js +0 -0
- /package/{_site/lib → src/common}/runtime-control.js +0 -0
- /package/{_site/lib → src/conversations}/bridge-consumer-service.js +0 -0
- /package/{_site/lib → src/conversations}/codex-context-status.js +0 -0
- /package/{_site/lib → src/integrations}/ai-vendor-presets.js +0 -0
- /package/{_site/lib → src/integrations}/claude-plugin-status.js +0 -0
- /package/{_site/lib → src/integrations}/integration-auto-repair.js +0 -0
- /package/{_site/lib → src/integrations}/integration-intent.js +0 -0
- /package/{_site/lib → src/integrations}/integration-repair-worker.js +0 -0
- /package/{_site/lib → src/integrations}/integration-status-scan.js +0 -0
- /package/{_site/lib → src/integrations}/integration-status-worker.js +0 -0
- /package/{_site/lib → src/integrations}/model-context-windows.js +0 -0
- /package/{_site/lib → src/integrations}/startup-integration-repair.js +0 -0
- /package/{_site/lib → src/knowledge}/embedding-service.js +0 -0
- /package/{_site/lib → src/knowledge}/index-builder.js +0 -0
- /package/{_site/lib → src/knowledge}/kb-validator.js +0 -0
- /package/{_site/lib → src/knowledge}/knowledge-db.js +0 -0
- /package/{_site/lib → src/knowledge}/knowledge-schema.js +0 -0
- /package/{_site/lib → src/knowledge}/markdown-knowledge-indexer.js +0 -0
- /package/{_site → src}/scripts/codex-notify-fanout.cjs +0 -0
- /package/{_site → src}/scripts/folder-picker.ps1 +0 -0
- /package/{_site → src}/scripts/sync-release-version.js +0 -0
- /package/{_site → src}/scripts/verify-module-runtime.js +0 -0
- /package/{_site/lib → src/server}/live-gateway.js +0 -0
- /package/{_site/lib → src/server}/module-port-resolver.js +0 -0
- /package/{_site/lib → src/server}/public-version-info.js +0 -0
- /package/{_site → src}/start.bat +0 -0
- /package/{_site → src}/stop.bat +0 -0
- /package/{_site/lib → src/tools}/registry-events.js +0 -0
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
// _site/_test/t07d-git-rel-coverage-test.js
|
|
2
|
-
//
|
|
3
|
-
// T07D ledger coverage for the git/release-discipline specs:
|
|
4
|
-
//
|
|
5
|
-
// GIT-002 基准远程验证 — annotated (non-v) baseline tag + QA branch must be
|
|
6
|
-
// verified REMOTELY via ls-remote dereference; the tag object SHA differs
|
|
7
|
-
// from the commit SHA, proving plain ls-remote is not enough.
|
|
8
|
-
// GIT-005 Push回执丢失 — when the client missed the push receipt, the
|
|
9
|
-
// reconciliation reads remote HEAD/parent and confirms WITHOUT a new
|
|
10
|
-
// commit and WITHOUT force push.
|
|
11
|
-
// GIT-006 CI取消失败 — the SHIPPED promote CI gate (checkCiGate) refuses
|
|
12
|
-
// failed/cancelled/incomplete-job runs; the sha/branch matching lives in
|
|
13
|
-
// the real ciStatus filter (source-anchored).
|
|
14
|
-
// GIT-007 单问题回退 — a controlled git revert keeps the FULL remote
|
|
15
|
-
// history; nothing is rewritten.
|
|
16
|
-
// REL-001 正式通道封锁 — only the exact x.y.z-rc.n form is a candidate;
|
|
17
|
-
// STABLE versions reject rc; latest has no automatic exit.
|
|
18
|
-
// REL-003 制品泄漏 — the shipped pack validator refuses qa/state/.env/
|
|
19
|
-
// credentials and REQUIRES the runtime essentials.
|
|
20
|
-
// REL-008 稳定版审批 — the promotion gate accepts only the exact
|
|
21
|
-
// READY_FOR_STABLE_APPROVAL attestation and refuses rc versions.
|
|
22
|
-
//
|
|
23
|
-
// Every assertion message starts with QA-SPEC-<CASE>.
|
|
24
|
-
|
|
25
|
-
'use strict';
|
|
26
|
-
|
|
27
|
-
const assert = require('node:assert/strict');
|
|
28
|
-
const fs = require('node:fs');
|
|
29
|
-
const os = require('node:os');
|
|
30
|
-
const path = require('node:path');
|
|
31
|
-
const { execFileSync } = require('node:child_process');
|
|
32
|
-
|
|
33
|
-
const REPO = path.resolve(__dirname, '..', '..');
|
|
34
|
-
|
|
35
|
-
function git(dir, args) { return execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8', windowsHide: true }); }
|
|
36
|
-
function gitOk(dir, args) { try { git(dir, args); return true; } catch { return false; } }
|
|
37
|
-
|
|
38
|
-
function fixtureRepo() {
|
|
39
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'qa-git-rel-'));
|
|
40
|
-
const remote = path.join(root, 'remote.git');
|
|
41
|
-
const work = path.join(root, 'work');
|
|
42
|
-
fs.mkdirSync(work, { recursive: true });
|
|
43
|
-
git(work, ['init', '-q', '--bare', remote]);
|
|
44
|
-
git(work, ['init', '-q', '-b', 'main']);
|
|
45
|
-
for (const [key, value] of [['user.email', 'qa-git@example.invalid'], ['user.name', 'qa-git']]) git(work, ['config', key, value]);
|
|
46
|
-
return { root, remote, work, cleanup: () => fs.rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }) };
|
|
47
|
-
}
|
|
48
|
-
const commit = (work, file, text, message) => {
|
|
49
|
-
fs.writeFileSync(path.join(work, file), text, 'utf8');
|
|
50
|
-
git(work, ['add', file]);
|
|
51
|
-
git(work, ['commit', '-q', '-m', message]);
|
|
52
|
-
return git(work, ['rev-parse', 'HEAD']).trim();
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
function main() {
|
|
56
|
-
// ---------------- GIT-002 基准远程验证 --------------------------------
|
|
57
|
-
{
|
|
58
|
-
const f = fixtureRepo();
|
|
59
|
-
try {
|
|
60
|
-
const baselineSha = commit(f.work, 'BASELINE.md', 'baseline\n', 'baseline commit');
|
|
61
|
-
git(f.work, ['remote', 'add', 'origin', f.remote]);
|
|
62
|
-
// An annotated, NON-v tag (exactly the spec's shape).
|
|
63
|
-
git(f.work, ['tag', '-a', 'baseline-2026Q4', '-m', 'baseline 2026Q4']);
|
|
64
|
-
git(f.work, ['branch', 'qa/acceptance-r9']);
|
|
65
|
-
git(f.work, ['push', '-q', 'origin', 'main', 'baseline-2026Q4', 'qa/acceptance-r9']);
|
|
66
|
-
|
|
67
|
-
// Remote verification — dereferenced tag and branch both must be the
|
|
68
|
-
// FULL baseline SHA, read from the REMOTE, not from local state.
|
|
69
|
-
const tagCommit = git(f.work, ['ls-remote', 'origin', 'refs/tags/baseline-2026Q4^{}']).trim().split(/\s+/)[0];
|
|
70
|
-
const tagObject = git(f.work, ['ls-remote', 'origin', 'refs/tags/baseline-2026Q4']).trim().split(/\s+/)[0];
|
|
71
|
-
const branchSha = git(f.work, ['ls-remote', 'origin', 'refs/heads/qa/acceptance-r9']).trim().split(/\s+/)[0];
|
|
72
|
-
assert.ok(tagCommit === baselineSha, `QA-SPEC-GIT-002: the dereferenced tag commit is the full baseline SHA (${tagCommit} vs ${baselineSha})`);
|
|
73
|
-
assert.notStrictEqual(tagObject, tagCommit, 'QA-SPEC-GIT-002: annotated tag object SHA differs from the commit — dereference (^{}) is REQUIRED, a plain ls-remote is not verification');
|
|
74
|
-
assert.ok(/^[0-9a-f]{40}$/.test(tagCommit), 'QA-SPEC-GIT-002: the verified SHA is a complete 40-hex baseline SHA');
|
|
75
|
-
assert.ok(branchSha === baselineSha, 'QA-SPEC-GIT-002: the QA branch points at the same complete baseline SHA remotely');
|
|
76
|
-
console.log('QA-SPEC-GIT-002: remote baseline verified via ls-remote dereference + branch; local command success alone is never the proof');
|
|
77
|
-
} finally { f.cleanup(); }
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// ---------------- GIT-005 Push回执丢失 --------------------------------
|
|
81
|
-
{
|
|
82
|
-
const f = fixtureRepo();
|
|
83
|
-
try {
|
|
84
|
-
const first = commit(f.work, 'A.txt', 'a\n', 'first');
|
|
85
|
-
const second = commit(f.work, 'B.txt', 'b\n', 'second');
|
|
86
|
-
git(f.work, ['remote', 'add', 'origin', f.remote]);
|
|
87
|
-
git(f.work, ['push', '-q', 'origin', 'main']);
|
|
88
|
-
const localCount = git(f.work, ['rev-list', '--count', 'HEAD']).trim();
|
|
89
|
-
|
|
90
|
-
// Reconciliation after a "lost receipt": read the REMOTE HEAD and its
|
|
91
|
-
// parent; only then confirm. No new commit, no force push.
|
|
92
|
-
const remoteHead = git(f.work, ['ls-remote', 'origin', 'refs/heads/main']).trim().split(/\s+/)[0];
|
|
93
|
-
assert.ok(remoteHead === second, 'QA-SPEC-GIT-005: remote HEAD equals the local commit — the push did land');
|
|
94
|
-
const remoteParent = git(f.work, ['ls-remote', 'origin', 'refs/heads/main'])
|
|
95
|
-
&& git(f.work, ['cat-file', '-p', remoteHead]).split('\n').find(l => l.startsWith('parent ')).split(' ')[1].trim();
|
|
96
|
-
assert.ok(remoteParent === first, 'QA-SPEC-GIT-005: the remote parent matches the local parent — identity proven before any action');
|
|
97
|
-
const afterCount = git(f.work, ['rev-list', '--count', 'HEAD']).trim();
|
|
98
|
-
assert.ok(afterCount === localCount, 'QA-SPEC-GIT-005: reconciliation creates NO duplicate commit');
|
|
99
|
-
// A force push is never needed: nothing is unpushed and nothing
|
|
100
|
-
// diverges, structurally (a force push would only ever be needed when
|
|
101
|
-
// local and remote have DIVERGED).
|
|
102
|
-
git(f.work, ['fetch', '-q', 'origin']);
|
|
103
|
-
const unpushed = git(f.work, ['rev-list', '--count', 'origin/main..HEAD']).trim();
|
|
104
|
-
const diverged = git(f.work, ['rev-list', '--count', 'HEAD..origin/main']).trim();
|
|
105
|
-
assert.ok(unpushed === '0' && diverged === '0', `QA-SPEC-GIT-005: the reconciled state has nothing unpushed (${unpushed}) and no divergence (${diverged}) — no force push can be required`);
|
|
106
|
-
console.log('QA-SPEC-GIT-005: lost-receipt reconciliation reads remote HEAD/parent and confirms without re-commit or force push');
|
|
107
|
-
} finally { f.cleanup(); }
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ---------------- GIT-006 CI取消失败 ----------------------------------
|
|
111
|
-
{
|
|
112
|
-
const { checkCiGate } = require(path.join(REPO, 'qa-autopilot', 'tools', 'stable-promote.cjs'));
|
|
113
|
-
const { REQUIRED_CI_JOBS: all } = require(path.join(REPO, 'qa-autopilot', 'tools', 'stable-next-common.cjs'));
|
|
114
|
-
const jobs = names => names.map(name => ({ name, conclusion: 'success' }));
|
|
115
|
-
assert.ok(checkCiGate({ ciStatus: 'FAIL', jobs: jobs(all), sourceSha: 'a'.repeat(40) }).ok === false,
|
|
116
|
-
'QA-SPEC-GIT-006: a FAILED run is never PASS (CI_NOT_GREEN)');
|
|
117
|
-
assert.ok(checkCiGate({ ciStatus: 'PENDING', jobs: jobs(all), sourceSha: 'a'.repeat(40) }).ok === false,
|
|
118
|
-
'QA-SPEC-GIT-006: a CANCELLED/incomplete run is never PASS');
|
|
119
|
-
assert.ok(checkCiGate({ ciStatus: 'PASS', jobs: jobs(all.filter(n => !n.includes('Windows'))), sourceSha: 'a'.repeat(40) }).ok === false,
|
|
120
|
-
'QA-SPEC-GIT-006: missing Windows job refuses PASS (CI_JOBS_INCOMPLETE)');
|
|
121
|
-
assert.strictEqual(checkCiGate({ ciStatus: 'PASS', jobs: jobs(all), sourceSha: 'a'.repeat(40) }).ok, true,
|
|
122
|
-
'QA-SPEC-GIT-006: only a complete green gate passes');
|
|
123
|
-
// SHA/branch matching is the real filter in lib/registry.cjs ciStatus —
|
|
124
|
-
// anchored here so the binding cannot drift silently.
|
|
125
|
-
const registrySource = fs.readFileSync(path.join(REPO, 'qa-autopilot', 'lib', 'registry.cjs'), 'utf8');
|
|
126
|
-
assert.ok(registrySource.includes("x.head_sha === sha") && registrySource.includes("x.head_branch ==="),
|
|
127
|
-
'QA-SPEC-GIT-006: ciStatus matches runs by THIS head_sha AND the QA main branch — a green run of another SHA/branch never counts');
|
|
128
|
-
console.log('QA-SPEC-GIT-006: shipped CI gate refuses failed/cancelled/incomplete; matching is sha+branch');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ---------------- GIT-007 单问题回退 ----------------------------------
|
|
132
|
-
{
|
|
133
|
-
const f = fixtureRepo();
|
|
134
|
-
try {
|
|
135
|
-
commit(f.work, 'BASE.md', 'base\n', 'baseline');
|
|
136
|
-
const fixSha = commit(f.work, 'check.txt', 'ok\n', 'fix: repair the check');
|
|
137
|
-
const regressionSha = commit(f.work, 'check.txt', 'BROKEN\n', 'regression: breaks the check');
|
|
138
|
-
git(f.work, ['remote', 'add', 'origin', f.remote]);
|
|
139
|
-
git(f.work, ['push', '-q', 'origin', 'main']);
|
|
140
|
-
// The regression trips the check; a CONTROLLED revert (not a rewrite).
|
|
141
|
-
const checkOk = () => fs.readFileSync(path.join(f.work, 'check.txt'), 'utf8').includes('ok');
|
|
142
|
-
assert.ok(!checkOk(), 'QA-SPEC-GIT-007: the pushed regression reproduces');
|
|
143
|
-
git(f.work, ['revert', '--no-edit', regressionSha]);
|
|
144
|
-
assert.ok(checkOk(), 'QA-SPEC-GIT-007: the controlled revert restores the behavior and the re-test passes');
|
|
145
|
-
git(f.work, ['push', '-q', 'origin', 'main']);
|
|
146
|
-
// Full remote history preserved: every original SHA is still reachable
|
|
147
|
-
// on the remote and the revert sits ON TOP, replacing nothing.
|
|
148
|
-
for (const sha of [fixSha, regressionSha]) {
|
|
149
|
-
assert.ok(gitOk(f.work, ['cat-file', '-e', `${sha}^{commit}`]), `QA-SPEC-GIT-007: original commit ${sha.slice(0, 8)} still exists`);
|
|
150
|
-
const inRemote = git(f.work, ['branch', '-r', '--contains', sha]).includes('origin/main');
|
|
151
|
-
assert.ok(inRemote, `QA-SPEC-GIT-007: original commit ${sha.slice(0, 8)} remains in the REMOTE history`);
|
|
152
|
-
}
|
|
153
|
-
const remoteLog = git(f.work, ['log', '--oneline', 'origin/main']);
|
|
154
|
-
assert.ok(/revert/i.test(remoteLog) && /regression/i.test(remoteLog), 'QA-SPEC-GIT-007: remote log keeps BOTH the regression and its revert — nothing rewritten');
|
|
155
|
-
console.log('QA-SPEC-GIT-007: controlled revert verified; full remote history preserved');
|
|
156
|
-
} finally { f.cleanup(); }
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ---------------- REL-001 正式通道封锁 --------------------------------
|
|
160
|
-
{
|
|
161
|
-
const { isRC } = require(path.join(REPO, 'qa-autopilot', 'lib', 'registry.cjs'));
|
|
162
|
-
const { STABLE_VERSION } = require(path.join(REPO, 'qa-autopilot', 'tools', 'stable-next-common.cjs'));
|
|
163
|
-
assert.ok(isRC('5.0.31-rc.1'), 'QA-SPEC-REL-001: the exact x.y.z-rc.n form enters the candidate channel');
|
|
164
|
-
for (const bad of ['v5.0.31-rc.1', 'baseline-2026Q4', '5.0.31-rc', '5.0.31-RC.1', '5.0.31-rc.1-beta', '5.0.31']) {
|
|
165
|
-
assert.ok(!isRC(bad), `QA-SPEC-REL-001: ${bad} is NOT a candidate rc`);
|
|
166
|
-
}
|
|
167
|
-
assert.ok(!STABLE_VERSION.test('5.0.31-rc.1') && STABLE_VERSION.test('5.0.31'),
|
|
168
|
-
'QA-SPEC-REL-001: an rc can never be a stable latest — latest has no automatic exit from the rc channel');
|
|
169
|
-
console.log('QA-SPEC-REL-001: only the exact rc form is a candidate; latest never auto-exits');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ---------------- REL-003 制品泄漏 ------------------------------------
|
|
173
|
-
{
|
|
174
|
-
const { validatePack } = require(path.join(REPO, 'qa-autopilot', 'lib', 'registry.cjs'));
|
|
175
|
-
const essentials = ['package.json', '_site/server.js', 'ui/index.html', 'ui/product.js', 'ui/live-client.js', 'module-runtime-manifest.json'];
|
|
176
|
-
assert.throws(() => validatePack([...essentials, 'qa-autopilot/tools/x.cjs']), /Forbidden package file.*qa-autopilot/,
|
|
177
|
-
'QA-SPEC-REL-003: qa/ paths are refused in the pack');
|
|
178
|
-
assert.throws(() => validatePack([...essentials, 'state/runs/1.json']), /Forbidden package file.*state/,
|
|
179
|
-
'QA-SPEC-REL-003: state/ paths are refused');
|
|
180
|
-
assert.throws(() => validatePack([...essentials, '.env']), /Forbidden package file.*.env/,
|
|
181
|
-
'QA-SPEC-REL-003: .env is refused');
|
|
182
|
-
assert.throws(() => validatePack([...essentials, 'ai-profiles.json']), /Forbidden package file.*ai-profiles/,
|
|
183
|
-
'QA-SPEC-REL-003: credentials-shaped files are refused');
|
|
184
|
-
for (const required of ['_site/server.js', 'module-runtime-manifest.json', 'ui/product.js']) {
|
|
185
|
-
assert.throws(() => validatePack(essentials.filter(f => f !== required)), /Required runtime missing/,
|
|
186
|
-
`QA-SPEC-REL-003: removing the essential ${required} is refused — the engine/plugins runtime cannot be cleaned away`);
|
|
187
|
-
}
|
|
188
|
-
assert.doesNotThrow(() => validatePack([...essentials, 'plugins/project-knowledge/plugin.json']),
|
|
189
|
-
'QA-SPEC-REL-003: shell and plugin payload passes the audit with npm runtime dependencies');
|
|
190
|
-
assert.throws(() => validatePack([...essentials, '_modules/knowledge-engine/src/server.js']), /Engine source must be installed/,
|
|
191
|
-
'QA-SPEC-REL-003: engine source cannot leak back into the shell package');
|
|
192
|
-
console.log('QA-SPEC-REL-003: leak paths refused; required runtime essentials protected');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// ---------------- REL-008 稳定版审批 ----------------------------------
|
|
196
|
-
{
|
|
197
|
-
const promote = require(path.join(REPO, 'qa-autopilot', 'tools', 'stable-promote.cjs'));
|
|
198
|
-
const base = {
|
|
199
|
-
repository: 'SanQianX/project-knowledge-base',
|
|
200
|
-
workflowRef: 'SanQianX/project-knowledge-base/.github/workflows/publish.yml@refs/heads/main',
|
|
201
|
-
eventName: 'workflow_dispatch',
|
|
202
|
-
packageName: '@sanqianx/project-knowledge',
|
|
203
|
-
expectedVersion: '5.0.31',
|
|
204
|
-
sourceSha: 'a'.repeat(40),
|
|
205
|
-
expectedSRI: 'sha512-' + 'A'.repeat(86) + '==',
|
|
206
|
-
reviewer: 'ZCode-Leader',
|
|
207
|
-
acceptanceAck: promote.ACCEPTANCE_ACK,
|
|
208
|
-
expectedCurrentLatest: '5.0.30',
|
|
209
|
-
};
|
|
210
|
-
assert.strictEqual(promote.checkPromotionInputs(base).ok, true, 'QA-SPEC-REL-008: complete, attested promotion inputs pass the gate');
|
|
211
|
-
assert.ok(promote.checkPromotionInputs({ ...base, expectedVersion: '5.0.31-rc.1' }).code === 'VERSION_SEMVER',
|
|
212
|
-
'QA-SPEC-REL-008: an rc version is REFUSED for latest — rc is never re-tagged directly');
|
|
213
|
-
assert.ok(promote.checkPromotionInputs({ ...base, acceptanceAck: 'looks-good-to-me' }).code === 'ACCEPTANCE_ACK',
|
|
214
|
-
'QA-SPEC-REL-008: only the exact READY_FOR_STABLE_APPROVAL attestation passes');
|
|
215
|
-
assert.ok(promote.checkPromotionInputs({ ...base, reviewer: '' }).code === 'REVIEWER_REQUIRED',
|
|
216
|
-
'QA-SPEC-REL-008: an anonymous approval is refused');
|
|
217
|
-
assert.ok(promote.checkPromotionInputs({ ...base, repository: 'someone/else' }).code === 'CI_IDENTITY',
|
|
218
|
-
'QA-SPEC-REL-008: only this repository\'s workflow may promote');
|
|
219
|
-
assert.strictEqual(promote.PROMOTION_TAG, 'latest');
|
|
220
|
-
console.log('QA-SPEC-REL-008: stable approval requires the exact attestation; rc cannot be re-tagged latest');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
console.log('t07d-git-rel-coverage-test PASS');
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
main();
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
// _site/_test/t07e-qta-coverage-test.js
|
|
2
|
-
//
|
|
3
|
-
// T07E ledger coverage for the four remaining quota-discipline specs:
|
|
4
|
-
//
|
|
5
|
-
// QTA-001 账户识别 — the SHIPPED profile-quota parser (workbench
|
|
6
|
-
// profile-quota.js) maps subscription usage windows from the official
|
|
7
|
-
// endpoints; a PAYG balance field is NEVER read into a five-hour window
|
|
8
|
-
// (balance simply has no mapping), and count windows carry 'requests'
|
|
9
|
-
// units, never money.
|
|
10
|
-
// QTA-002 usage字段歧义 — replay through the REAL parser: a payload with
|
|
11
|
-
// ONLY usage counts yields null remaining percent (UNKNOWN — nothing
|
|
12
|
-
// guessed); a payload with an explicit server percentage uses it; the
|
|
13
|
-
// GLM percentage is documented-and-parsed as the USED percent.
|
|
14
|
-
// QTA-007 进程重启 — the SHIPPED supervisor reconcile(): a preserved
|
|
15
|
-
// checkpoint whose PUSH landed while the controller was down becomes
|
|
16
|
-
// PUSH_ALREADY_PRESENT (never re-pushed); a half-finished worker whose
|
|
17
|
-
// state is UNKNOWN goes back to PENDING for independent review — never
|
|
18
|
-
// blindly advanced or re-dispatched.
|
|
19
|
-
// QTA-008 绕过防护 — the SHIPPED worker isolation: withSanitizedEnv strips
|
|
20
|
-
// every ambient credential variable (ANTHROPIC_/CLAUDE_/CODEX_/…) from
|
|
21
|
-
// worker processes, and the supervisor contract is hash-frozen per task
|
|
22
|
-
// so a worker cannot widen its own control contract.
|
|
23
|
-
|
|
24
|
-
'use strict';
|
|
25
|
-
|
|
26
|
-
const assert = require('node:assert/strict');
|
|
27
|
-
const fs = require('node:fs');
|
|
28
|
-
const os = require('node:os');
|
|
29
|
-
const path = require('node:path');
|
|
30
|
-
const { execFileSync } = require('node:child_process');
|
|
31
|
-
|
|
32
|
-
const REPO = path.resolve(__dirname, '..', '..');
|
|
33
|
-
|
|
34
|
-
function jsonResponse(body) {
|
|
35
|
-
return { ok: true, status: 200, json: async () => body, text: async () => JSON.stringify(body), headers: new Map() };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function main() {
|
|
39
|
-
const { ProfileQuotaService, detectProvider } = require(path.join(REPO, 'node_modules', 'claude-ai-workbench', 'packages', 'server', 'lib', 'profile-quota.js'));
|
|
40
|
-
|
|
41
|
-
// ---------------- QTA-001 / QTA-002: the real parser ------------------
|
|
42
|
-
{
|
|
43
|
-
const now = Date.parse('2026-11-06T08:00:00.000Z');
|
|
44
|
-
let lastBody = null;
|
|
45
|
-
const fetchImpl = async () => jsonResponse(lastBody);
|
|
46
|
-
const service = new ProfileQuotaService({ fetch: fetchImpl, now: () => now, ttlMs: 0 });
|
|
47
|
-
const profile = { id: 'p1', provider: 'minimax', name: 'MiniMax', baseUrl: 'https://www.minimaxi.com/api/v1', models: { default: 'abab6.5s-chat' } };
|
|
48
|
-
const credential = 'test-key';
|
|
49
|
-
|
|
50
|
-
// Replay 1 (QTA-002): ONLY usage counts — no percentage anywhere.
|
|
51
|
-
lastBody = {
|
|
52
|
-
base_resp: { status_code: 0 },
|
|
53
|
-
balance: { amount: 42.5, currency: 'CNY' }, // stray PAYG balance field
|
|
54
|
-
model_remains: [{
|
|
55
|
-
model_name: 'general',
|
|
56
|
-
start_time: now - 3600_000, end_time: now + 4 * 3600_000,
|
|
57
|
-
current_interval_usage_count: 5, current_interval_total_count: 100,
|
|
58
|
-
weekly_start_time: now - 86400_000 * 3, weekly_end_time: now + 86400_000 * 4,
|
|
59
|
-
current_weekly_usage_count: 30, current_weekly_total_count: 500,
|
|
60
|
-
}],
|
|
61
|
-
};
|
|
62
|
-
const onlyCounts = await service.getQuota({ profile, credential, refresh: true });
|
|
63
|
-
const windows = onlyCounts.windows || [];
|
|
64
|
-
const interval = windows.find(w => w.kind === 'interval');
|
|
65
|
-
const weekly = windows.find(w => w.kind === 'weekly');
|
|
66
|
-
assert.ok(interval && interval.used === 5 && interval.total === 100 && interval.unit === 'requests',
|
|
67
|
-
'QA-SPEC-QTA-001: subscription usage windows are read from the official count fields with requests units');
|
|
68
|
-
assert.ok(JSON.stringify(onlyCounts).indexOf('42.5') === -1,
|
|
69
|
-
'QA-SPEC-QTA-001: the PAYG balance value never leaks into any quota window — balance is not a five-hour allowance');
|
|
70
|
-
assert.ok(interval.serverRemainingPercent === null,
|
|
71
|
-
'QA-SPEC-QTA-002: with ONLY usage counts the remaining percent stays null (UNKNOWN) — nothing is guessed');
|
|
72
|
-
assert.ok(weekly && weekly.serverRemainingPercent === null,
|
|
73
|
-
'QA-SPEC-QTA-002: the weekly window stays UNKNOWN too without semantic evidence');
|
|
74
|
-
|
|
75
|
-
// Replay 2 (QTA-002): explicit server-computed percentage present.
|
|
76
|
-
const service2 = new ProfileQuotaService({ fetch: fetchImpl, now: () => now, ttlMs: 0 });
|
|
77
|
-
lastBody = {
|
|
78
|
-
base_resp: { status_code: 0 },
|
|
79
|
-
model_remains: [{
|
|
80
|
-
model_name: 'general',
|
|
81
|
-
start_time: now - 3600_000, end_time: now + 4 * 3600_000,
|
|
82
|
-
current_interval_usage_count: 5, current_interval_total_count: 100,
|
|
83
|
-
current_interval_remaining_percent: 95,
|
|
84
|
-
weekly_start_time: now - 86400_000 * 3, weekly_end_time: now + 86400_000 * 4,
|
|
85
|
-
current_weekly_usage_count: 30, current_weekly_total_count: 500,
|
|
86
|
-
current_weekly_remaining_percent: 88,
|
|
87
|
-
}],
|
|
88
|
-
};
|
|
89
|
-
const withPercent = await service2.getQuota({ profile, credential, refresh: true });
|
|
90
|
-
const interval2 = (withPercent.windows || []).find(w => w.kind === 'interval');
|
|
91
|
-
const weekly2 = (withPercent.windows || []).find(w => w.kind === 'weekly');
|
|
92
|
-
assert.ok(interval2.serverRemainingPercent === 95 && weekly2.serverRemainingPercent === 88,
|
|
93
|
-
'QA-SPEC-QTA-002: an explicit server-computed percentage takes priority and is surfaced as-is');
|
|
94
|
-
|
|
95
|
-
// GLM shape: percentage is the USED percent (documented) and stays
|
|
96
|
-
// UNKNOWN when absent — never guessed into a remaining value.
|
|
97
|
-
const glmProfile = { id: 'p2', provider: 'glm', name: 'GLM', baseUrl: 'https://open.bigmodel.cn/api/paas/v4', models: { default: 'glm-4.6' } };
|
|
98
|
-
const glmNoPercent = { code: 200, success: true, data: { limits: [{ type: 'TIME_LIMIT', unit: 3, number: 5, currentValue: 8, usage: 4000, remaining: 3992, nextResetTime: now + 3600_000 }] } };
|
|
99
|
-
lastBody = glmNoPercent;
|
|
100
|
-
const glmUnknown = await service2.getQuota({ profile: glmProfile, credential, refresh: true });
|
|
101
|
-
const toolsWindowUnknown = (glmUnknown.windows || []).find(w => w.kind === 'tools');
|
|
102
|
-
assert.ok(toolsWindowUnknown && toolsWindowUnknown.usedPercent === null && toolsWindowUnknown.remainingPercent === null,
|
|
103
|
-
'QA-SPEC-QTA-002: GLM window without percentage stays UNKNOWN both ways');
|
|
104
|
-
lastBody = { code: 200, success: true, data: { limits: [{ type: 'TIME_LIMIT', unit: 3, number: 5, percentage: 1, currentValue: 8, usage: 4000, remaining: 3992, nextResetTime: now + 3600_000 }] } };
|
|
105
|
-
const glmPercent = await service2.getQuota({ profile: glmProfile, credential, refresh: true });
|
|
106
|
-
const toolsWindow = (glmPercent.windows || []).find(w => w.kind === 'tools');
|
|
107
|
-
assert.ok(toolsWindow.usedPercent === 1 && toolsWindow.remainingPercent === 99,
|
|
108
|
-
'QA-SPEC-QTA-002: the explicit percentage is applied with its documented USED semantics (8/4000 used -> 1% used, 99% remaining), protecting the old-plan entitlement');
|
|
109
|
-
assert.ok(detectProvider(glmProfile).id === 'glm' && detectProvider(profile).id === 'minimax',
|
|
110
|
-
'QA-SPEC-QTA-001: account/provider identification distinguishes the actual endpoints');
|
|
111
|
-
console.log('QA-SPEC-QTA-001/002: real parser replay — balance never becomes a window; UNKNOWN without semantic evidence; explicit percentages honored');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// ---------------- QTA-007: shipped reconcile --------------------------
|
|
115
|
-
{
|
|
116
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'qa-qta007-'));
|
|
117
|
-
try {
|
|
118
|
-
const work = path.join(root, 'work');
|
|
119
|
-
fs.mkdirSync(work, { recursive: true });
|
|
120
|
-
const git = args => execFileSync('git', ['-C', work, ...args], { encoding: 'utf8', windowsHide: true });
|
|
121
|
-
git(['init', '-q', '-b', 'main']);
|
|
122
|
-
git(['config', 'user.email', 'qta@example.invalid']); git(['config', 'user.name', 'qta']);
|
|
123
|
-
fs.writeFileSync(path.join(work, 'A.md'), 'a\n');
|
|
124
|
-
git(['add', 'A.md']); git(['commit', '-q', '-m', 'one']);
|
|
125
|
-
const head = git(['rev-parse', 'HEAD']).trim();
|
|
126
|
-
const remote = path.join(root, 'remote.git');
|
|
127
|
-
git(['init', '-q', '--bare', remote]);
|
|
128
|
-
git(['remote', 'add', 'origin', remote]);
|
|
129
|
-
git(['push', '-q', 'origin', 'main']); // the PUSH landed while the controller was "down"
|
|
130
|
-
|
|
131
|
-
const stateDir = path.join(root, 'state');
|
|
132
|
-
fs.mkdirSync(stateDir, { recursive: true });
|
|
133
|
-
fs.writeFileSync(path.join(stateDir, 'queue.json'), JSON.stringify([]));
|
|
134
|
-
// The supervisor reads its fixed paths from QA_OVERNIGHT_STATE_DIR —
|
|
135
|
-
// redirect BEFORE require so the module constants point at the fixture.
|
|
136
|
-
process.env.QA_OVERNIGHT_STATE_DIR = stateDir;
|
|
137
|
-
const { reconcile } = require(path.join(REPO, 'qa-autopilot', 'tools', 'overnight-supervisor.cjs'));
|
|
138
|
-
const cfg = { repoRoot: work, mainBranch: 'main', tools: {} };
|
|
139
|
-
const state = {
|
|
140
|
-
order: ['t1', 't2'],
|
|
141
|
-
tasks: {
|
|
142
|
-
t1: { id: 't1', status: 'PUSHED', commitSha: head }, // receipt unknown, remote HAS it
|
|
143
|
-
t2: { id: 't2', status: 'AGENT_RUNNING', commitSha: null }, // worker state unknown at restart
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
const notes = reconcile(cfg, state);
|
|
147
|
-
const n1 = notes.find(n => n.id === 't1');
|
|
148
|
-
const n2 = notes.find(n => n.id === 't2');
|
|
149
|
-
assert.ok(n1 && n1.action === 'PUSH_ALREADY_PRESENT',
|
|
150
|
-
`QA-SPEC-QTA-007: the already-pushed task is reconciled as PUSH_ALREADY_PRESENT (never re-pushed): ${JSON.stringify(n1)}`);
|
|
151
|
-
assert.ok(state.tasks.t1.status === 'CI_PENDING', 'QA-SPEC-QTA-007: the reconciled pushed task moves to CI_PENDING, not back to dispatch');
|
|
152
|
-
assert.ok(n2 && n2.action === 'HALF_FINISHED_BACK_TO_PENDING',
|
|
153
|
-
`QA-SPEC-QTA-007: the unknown-state worker goes back to PENDING for independent review: ${JSON.stringify(n2)}`);
|
|
154
|
-
assert.ok(state.tasks.t2.status === 'PENDING' && state.tasks.t2.halfFinished === true,
|
|
155
|
-
'QA-SPEC-QTA-007: the half-finished task is NOT advanced and NOT re-dispatched blindly');
|
|
156
|
-
console.log('QA-SPEC-QTA-007: shipped reconcile verifies remote state; unknown workers reconcile, never resend');
|
|
157
|
-
} finally { fs.rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// ---------------- QTA-008: shipped worker isolation -------------------
|
|
161
|
-
{
|
|
162
|
-
const { withSanitizedEnv, AMBIENT_PREFIXES } = require(path.join(REPO, '_site', '_test', 'helpers', 'parallel-memory-capture-r3-cap-shell'));
|
|
163
|
-
assert.ok(AMBIENT_PREFIXES.includes('ANTHROPIC_') && AMBIENT_PREFIXES.includes('CLAUDE_') && AMBIENT_PREFIXES.includes('CODEX_'),
|
|
164
|
-
'QA-SPEC-QTA-008: ambient credential prefixes are pinned in the shipped worker isolation');
|
|
165
|
-
// The probes are set BY THIS TEST (an offline CI lane must never depend
|
|
166
|
-
// on the calling shell carrying real credentials): synthetic probe values
|
|
167
|
-
// stand in for ambient secrets, and the isolation must strip them.
|
|
168
|
-
if (process.env.ANTHROPIC_PROBE_SECRET === undefined && process.env.CLAUDE_PROBE_TOKEN === undefined) {
|
|
169
|
-
process.env.ANTHROPIC_PROBE_SECRET = 't07e-synthetic-probe-secret';
|
|
170
|
-
process.env.CLAUDE_PROBE_TOKEN = 't07e-synthetic-probe-token';
|
|
171
|
-
}
|
|
172
|
-
const probeClaude = process.env.CLAUDE_PROBE_TOKEN;
|
|
173
|
-
const probeAnthropic = process.env.ANTHROPIC_PROBE_SECRET;
|
|
174
|
-
assert.ok(probeClaude !== undefined && probeAnthropic !== undefined, 'QA-SPEC-QTA-008: probe setup — ambient credential probes present in the parent env');
|
|
175
|
-
let seenInside = null;
|
|
176
|
-
withSanitizedEnv(() => {
|
|
177
|
-
seenInside = {
|
|
178
|
-
anthropic: process.env.ANTHROPIC_PROBE_SECRET,
|
|
179
|
-
claude: process.env.CLAUDE_PROBE_TOKEN,
|
|
180
|
-
};
|
|
181
|
-
});
|
|
182
|
-
assert.ok(seenInside.anthropic === undefined && seenInside.claude === undefined,
|
|
183
|
-
'QA-SPEC-QTA-008: inside the sanitized worker env the ambient credentials are GONE — a worker cannot read the real subscription credentials');
|
|
184
|
-
// The control contract is hash-frozen per task by the shipped
|
|
185
|
-
// makeContract (anchored): a worker cannot widen its own contract.
|
|
186
|
-
const supervisorSource = fs.readFileSync(path.join(REPO, 'qa-autopilot', 'tools', 'overnight-supervisor.cjs'), 'utf8');
|
|
187
|
-
assert.ok(/function makeContract/.test(supervisorSource) && /contracts', task\.id \+ '\.json'/.test(supervisorSource),
|
|
188
|
-
'QA-SPEC-QTA-008: the supervisor freezes each task contract into a per-task file — contract changes are detectable, not silently widened');
|
|
189
|
-
console.log('QA-SPEC-QTA-008: worker env isolation strips credentials; control contract is frozen per task');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
console.log('t07e-qta-coverage-test PASS');
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
main().catch(error => { console.error(String(error && error.stack || error)); process.exit(1); });
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// _site/_test/t07f-mem-008-coverage-test.js
|
|
2
|
-
//
|
|
3
|
-
// T07F ledger coverage for MEM-008 来源边界 (memory candidate provenance):
|
|
4
|
-
//
|
|
5
|
-
// steps: 委派Agent指令/系统维护输出诱发记忆候选。
|
|
6
|
-
// expected: 不得自动当作人类长期偏好。/ C01未解决项明确阻断。
|
|
7
|
-
//
|
|
8
|
-
// The behaviour under test is the REAL vendored engine's MemoryEligibility
|
|
9
|
-
// gate (_modules/knowledge-engine/src/memory-eligibility.js): every candidate
|
|
10
|
-
// must be vouched for by a conversation snapshot that is bound to THIS run's
|
|
11
|
-
// promoted evidence references, and the quoted source event must be HUMAN
|
|
12
|
-
// input with a matching content hash. Delegated-agent instructions and
|
|
13
|
-
// system/maintenance outputs are refused with explicit codes; an unresolved
|
|
14
|
-
// provenance chain (the C01-class boundary case) blocks explicitly instead
|
|
15
|
-
// of admitting silently.
|
|
16
|
-
|
|
17
|
-
'use strict';
|
|
18
|
-
|
|
19
|
-
const assert = require('node:assert/strict');
|
|
20
|
-
const path = require('node:path');
|
|
21
|
-
const crypto = require('node:crypto');
|
|
22
|
-
|
|
23
|
-
const REPO = path.resolve(__dirname, '..', '..');
|
|
24
|
-
const { MemoryEligibility } = require(path.join(path.dirname(require.resolve('@sanqianx/ai-coding-knowledge-engine/package.json', { paths: [path.join(REPO)] })), 'src', 'memory-eligibility.js'));
|
|
25
|
-
|
|
26
|
-
const sha = text => crypto.createHash('sha256').update(text).digest('hex');
|
|
27
|
-
|
|
28
|
-
const HUMAN_TEXT = '我以后所有项目的提交信息都用中文写,这是我自己的长期习惯。';
|
|
29
|
-
const AGENT_TEXT = '以最小改动修复该测试,不要重构。';
|
|
30
|
-
const SYSTEM_TEXT = '索引重建完成:重建了 3 个项目的知识索引。';
|
|
31
|
-
|
|
32
|
-
const snapshot = {
|
|
33
|
-
snapshotHash: 'snap-1',
|
|
34
|
-
turns: [{
|
|
35
|
-
userEvents: [
|
|
36
|
-
{ eventId: 'ev-human', inputOrigin: 'human', content: HUMAN_TEXT, contentHash: sha(HUMAN_TEXT) },
|
|
37
|
-
{ eventId: 'ev-agent', inputOrigin: 'agent', content: AGENT_TEXT, contentHash: sha(AGENT_TEXT) },
|
|
38
|
-
{ eventId: 'ev-system', inputOrigin: 'system', content: SYSTEM_TEXT, contentHash: sha(SYSTEM_TEXT) },
|
|
39
|
-
],
|
|
40
|
-
}],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
function runWith(refs) {
|
|
44
|
-
return { projectId: 'p1', commitSha: 'c1', staging: { operations: [{ evidenceReferences: refs }] } };
|
|
45
|
-
}
|
|
46
|
-
const candidate = over => ({
|
|
47
|
-
text: HUMAN_TEXT,
|
|
48
|
-
quote: HUMAN_TEXT,
|
|
49
|
-
sourceEventId: 'ev-human',
|
|
50
|
-
sourceHash: sha(HUMAN_TEXT),
|
|
51
|
-
eligibility: { durable: true, crossProject: true, reason: 'owner-stated long-term habit', scopeReason: 'applies across all projects' },
|
|
52
|
-
...over,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
function main() {
|
|
56
|
-
const gate = new MemoryEligibility({ readSnapshot: () => snapshot });
|
|
57
|
-
const boundRun = runWith(['conversation:snap-1']);
|
|
58
|
-
|
|
59
|
-
// 1. A delegated-agent instruction can never become a long-term preference.
|
|
60
|
-
const agentClaim = gate.verify(
|
|
61
|
-
candidate({ text: AGENT_TEXT, quote: AGENT_TEXT, sourceEventId: 'ev-agent', sourceHash: sha(AGENT_TEXT) }),
|
|
62
|
-
gate.resolve(boundRun), 'p1');
|
|
63
|
-
assert.ok(agentClaim.ok === false && agentClaim.code === 'SOURCE_NOT_HUMAN',
|
|
64
|
-
`QA-SPEC-MEM-008: a delegated-agent instruction is refused as a memory source (${agentClaim.code})`);
|
|
65
|
-
|
|
66
|
-
// 2. System/maintenance output likewise.
|
|
67
|
-
const systemClaim = gate.verify(
|
|
68
|
-
candidate({ text: SYSTEM_TEXT, quote: SYSTEM_TEXT, sourceEventId: 'ev-system', sourceHash: sha(SYSTEM_TEXT) }),
|
|
69
|
-
gate.resolve(boundRun), 'p1');
|
|
70
|
-
assert.ok(systemClaim.ok === false && systemClaim.code === 'SOURCE_NOT_HUMAN',
|
|
71
|
-
`QA-SPEC-MEM-008: system maintenance output is refused as a memory source (${systemClaim.code})`);
|
|
72
|
-
|
|
73
|
-
// 3. The C01-class unresolved chain: no conversation boundary reference (or
|
|
74
|
-
// a reference to a foreign snapshot) resolves -> SNAPSHOT_UNAVAILABLE, an
|
|
75
|
-
// EXPLICIT block, never a silent admission.
|
|
76
|
-
const unresolvedRun = runWith([]); // boundary record never persisted/linked
|
|
77
|
-
assert.strictEqual(gate.resolve(unresolvedRun), null,
|
|
78
|
-
'QA-SPEC-MEM-008: a run without a persisted conversation boundary resolves NO snapshot');
|
|
79
|
-
const foreignRun = runWith(['conversation:some-other-hash']);
|
|
80
|
-
assert.strictEqual(gate.resolve(foreignRun), null,
|
|
81
|
-
'QA-SPEC-MEM-008: a foreign/later-frozen snapshot can never vouch for this claim');
|
|
82
|
-
const blocked = gate.verify(candidate({}), gate.resolve(unresolvedRun), 'p1');
|
|
83
|
-
assert.ok(blocked.ok === false && blocked.code === 'SNAPSHOT_UNAVAILABLE',
|
|
84
|
-
`QA-SPEC-MEM-008: the unresolved C01-class chain blocks the candidate EXPLICITLY (${blocked.code})`);
|
|
85
|
-
|
|
86
|
-
// 4. Hash/quote chain integrity.
|
|
87
|
-
const hashMismatch = gate.verify(candidate({ sourceHash: 'deadbeef' }), gate.resolve(boundRun), 'p1');
|
|
88
|
-
assert.ok(hashMismatch.code === 'SOURCE_HASH_MISMATCH', 'QA-SPEC-MEM-008: a rewritten source is refused (hash mismatch)');
|
|
89
|
-
const quoteMismatch = gate.verify(candidate({ quote: '从未说过的偏好' }), gate.resolve(boundRun), 'p1');
|
|
90
|
-
assert.ok(quoteMismatch.code === 'QUOTE_NOT_IN_SOURCE', 'QA-SPEC-MEM-008: a fabricated quote is refused');
|
|
91
|
-
|
|
92
|
-
// 5. Positive control: the real human sentence with its frozen chain passes.
|
|
93
|
-
const ok = gate.verify(candidate({}), gate.resolve(boundRun), 'p1');
|
|
94
|
-
assert.ok(ok.ok === true, `QA-SPEC-MEM-008: a genuine human long-term preference with a verified chain passes (${JSON.stringify(ok)})`);
|
|
95
|
-
|
|
96
|
-
console.log('QA-SPEC-MEM-008: agent/system sources refused; unresolved provenance blocks explicitly; genuine human chain passes');
|
|
97
|
-
console.log('t07f-mem-008-coverage-test PASS');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
main();
|