Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(agent): run prompt ownership contract in guard tier

Chris6e546264c6d3
diff --git a/apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts b/apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts
index f25f1d8228..bc0ad46363 100644
--- a/apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts
+++ b/apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts
@@ -6,6 +6,10 @@ import precedence from '../../maker-host/skill-source-precedence-prompt.md?raw';
import claudePrompt from '../../maker-host/claude-system-prompt.md?raw';
import codexPrompt from '../../maker-host/codex-system-prompt.md?raw';
+// Guard tier: cindy-bots-runtime.md §6 and engineering-conventions.md §3.2.
+// The exact cross-file prompt contract keeps host ownership and native engine
+// guidance intact without injecting remote-authorization policy into either.
+// Runtime model-choice behavior is separately exercised in the isolated Desktop.
it('keeps the upstream Desktop system prompt unchanged by remote authorization', () => {
const cases = [
[buildDesktopClaudeRuntimeConfig(() => 'https://model.example'), claudePrompt],
diff --git a/scripts/__tests__/test-workspaces.test.mjs b/scripts/__tests__/test-workspaces.test.mjs
index 35997ee914..16a3d865c7 100644
--- a/scripts/__tests__/test-workspaces.test.mjs
+++ b/scripts/__tests__/test-workspaces.test.mjs
@@ -720,6 +720,7 @@ test("desktop guard selects source-contract tests only", () => {
}
assert.deepEqual(
selectFilesForTier(workspace, tier, [
+ "apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts",
"apps/desktop/src/main/__tests__/directSessionSendGuard.test.ts",
"apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts",
"apps/desktop/src/main/__tests__/authCaptchaIpcSecurity.test.ts",
@@ -728,6 +729,7 @@ test("desktop guard selects source-contract tests only", () => {
"apps/desktop/src/main/localDb/ipc/messages.test.ts",
]),
[
+ "apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts",
"apps/desktop/src/main/__tests__/directSessionSendGuard.test.ts",
"apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts",
"apps/desktop/src/main/__tests__/authCaptchaIpcSecurity.test.ts",
diff --git a/scripts/test-hygiene-baseline.json b/scripts/test-hygiene-baseline.json
index da081002d5..6ce618c481 100644
--- a/scripts/test-hygiene-baseline.json
+++ b/scripts/test-hygiene-baseline.json
@@ -379,9 +379,6 @@
"apps/desktop/src/main/plugin-market/__tests__/sources-cache-lease.test.ts": {
"realWaits": 1
},
- "apps/desktop/src/main/plugin-oauth/__tests__/runtimePrompt.test.ts": {
- "sourceReads": 4
- },
"apps/desktop/src/main/plugin-publisher/__tests__/host.test.ts": {
"resetModules": 1
},
diff --git a/scripts/test-workspaces.config.mjs b/scripts/test-workspaces.config.mjs
index 50caa20f01..8741b416af 100644
--- a/scripts/test-workspaces.config.mjs
+++ b/scripts/test-workspaces.config.mjs
@@ -151,6 +151,8 @@ const mobileGuardInclude = [
// in the explicit guard tier. Keeping an exact allowlist makes it impossible
// for a new source scan to silently become part of the ordinary unit gate.
const desktopGuardInclude = [
+ // Cross-file host/engine prompt ownership and remote-authorization isolation.
+ 'src/main/plugin-oauth/__tests__/runtimePrompt.test.ts',
// Cross-hook voice stop/refine ownership and composer hydration race wiring.
'src/renderer/__tests__/voiceInputEnterToSend.test.ts',
'src/renderer/__tests__/sessionAgentSwitchRemoteRouting.contract.test.ts',