Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`credential-isolation paths (snapshot) > settings-file conflicts: neutralize / warn / fail-closed disposition 1`] = `
{
"autoFix_neutralize": [
"project",
],
"failClosed_userFixes": [
"managed",
],
"warnOnly_alreadyIgnored": [
"user",
"project-local",
],
}
`;

exports[`credential-isolation paths (snapshot) > subprocess env: disposition of every credential path 1`] = `
{
"ANTHROPIC_API_KEY": "stripped",
Expand Down
56 changes: 0 additions & 56 deletions src/agent/__tests__/commandments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { WIZARD_COMMANDMENTS } from '@agent/commandments';
import { assembleCommandments } from '@agent/runner/switchboard/commandments';
import { Harness, Sequence } from '@shared/constants';

const global = WIZARD_COMMANDMENTS.join('\n');

/** Every axis combination that reaches a runner today. */
const CAPS = { bash: true, posthogMcp: true };
const prompt = (
Expand Down Expand Up @@ -55,25 +53,6 @@ describe('commandments by axis', () => {
);
},
);

it('are stated once, not once per source', () => {
// Previously duplicated: the global list said "create tasks as soon as you
// understand the work" while pi's runtime notes said "after you load and
// skim the skill workflow, not before" — both in the same prompt.
const linear = prompt(Harness.pi, Sequence.linear);
expect(
linear.match(/Create the task list once you understand/g),
).toHaveLength(1);
expect(linear.match(/Each task subject is SHORT/g)).toHaveLength(1);
expect(linear).not.toMatch(/Create tasks as soon as you understand/);
});

it('keeps the provider-naming rule global — it governs code, not a tool', () => {
expect(global).toMatch(/Do not assume "PostHog provider"/);
expect(prompt(Harness.pi, Sequence.orchestrator)).toMatch(
/Do not assume "PostHog provider"/,
);
});
});

describe('axis scoping', () => {
Expand All @@ -99,41 +78,6 @@ describe('commandments by axis', () => {
);
});
});

// Targeted assertions for the wizard_ask Path A translation rules.
// These are the rules a skill author depends on when leaving their prose
// unchanged — they need to keep working as the commandment list evolves.
describe('wizard_ask Path A rules', () => {
const text = global;

it('names the tool explicitly', () => {
expect(text).toMatch(/`wizard_ask`/);
});

it('forbids inlining questions in text output', () => {
expect(text).toMatch(/never inline questions/i);
});

it('requires batching prose lists into one call', () => {
expect(text).toMatch(/single `wizard_ask` tool call/i);
expect(text).toMatch(/never split/i);
});

it('describes how to infer `kind`', () => {
expect(text).toMatch(/`single`/);
expect(text).toMatch(/`multi`/);
expect(text).toMatch(/`text`/);
});

it('describes how to derive options and ids', () => {
expect(text).toMatch(/kebab-case/i);
expect(text).toMatch(/label.*value/i);
});

it('tells the agent to use answers directly without re-asking', () => {
expect(text).toMatch(/do not re-ask/i);
});
});
});

/**
Expand Down
44 changes: 0 additions & 44 deletions src/agent/__tests__/credential-isolation-snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/

import { sanitizeAgentSubprocessEnv } from '@shared/agent-env-isolation';
import { classifySettingsConflicts } from '@shared/claude-settings';
import type { SettingsConflict } from '@shared/claude-settings';

// Every env-based avenue (one key each), plus the gateway routing and benign
// env that must survive. Grouped by avenue for readability; the snapshot sorts.
Expand Down Expand Up @@ -91,46 +89,4 @@ describe('credential-isolation paths (snapshot)', () => {
);
expect(disposition).toMatchSnapshot();
});

it('settings-file conflicts: neutralize / warn / fail-closed disposition', () => {
const conflicts: SettingsConflict[] = [
// writable project file — SDK reads it; wizard can remove it
{
source: 'project',
path: '/proj/.claude/settings.json',
keys: ['ANTHROPIC_BASE_URL'],
writable: true,
},
// org-managed — always read, unremovable
{
source: 'managed',
path: '/managed/managed-settings.json',
keys: ['apiKeyHelper'],
writable: false,
},
// user global — ignored under settingSources:['project']
{
source: 'user',
path: '/home/.claude/settings.json',
keys: ['ANTHROPIC_API_KEY'],
writable: false,
},
// project-local — ignored under settingSources:['project']
{
source: 'project-local',
path: '/proj/.claude/settings.local.json',
keys: ['CLAUDE_CODE_USE_BEDROCK'],
writable: false,
},
];

const { autoFix, failClosed, warnOnly } =
classifySettingsConflicts(conflicts);

expect({
autoFix_neutralize: autoFix.map((c) => c.source),
failClosed_userFixes: failClosed.map((c) => c.source),
warnOnly_alreadyIgnored: warnOnly.map((c) => c.source),
}).toMatchSnapshot();
});
});
Loading
Loading