mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
chore: 移除 goalAudit stub 及其测试引用
- 删除 src/services/goal/goalAudit.ts(导出 COMPLETION_AUDIT_RULES/BLOCKED_AUDIT_RULES/isGoalTerminal 等未引用的 stub) - 同步移除 tests/integration/goal-lifecycle.test.ts 中对 goalAudit 的 import 和一个测试用例(budget_limited is terminal) Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
/**
|
|
||||||
* Audit rules constants for goal completion and blocked assessment.
|
|
||||||
* Shared by prompt templates and integration tests.
|
|
||||||
*/
|
|
||||||
import { BLOCKED_CONSECUTIVE_THRESHOLD, MAX_GOAL_TURNS } from './goalState.js'
|
|
||||||
import type { GoalStatus } from '../../types/logs.js'
|
|
||||||
|
|
||||||
export { BLOCKED_CONSECUTIVE_THRESHOLD, MAX_GOAL_TURNS }
|
|
||||||
|
|
||||||
export const COMPLETION_AUDIT_RULES = [
|
|
||||||
'Derive concrete requirements from the objective and any referenced files.',
|
|
||||||
'Preserve the original scope — do not redefine success around what is already done.',
|
|
||||||
'For every explicit requirement, identify authoritative evidence (test output, file content, command result).',
|
|
||||||
'Treat tests, manifests, and verifiers as evidence only after confirming they actually cover the requirement.',
|
|
||||||
'Treat uncertain or indirect evidence as "not achieved".',
|
|
||||||
'The audit must PROVE completion, not merely fail to find remaining work.',
|
|
||||||
] as const
|
|
||||||
|
|
||||||
export const BLOCKED_AUDIT_RULES = [
|
|
||||||
'The same blocking condition must persist across at least 3 consecutive continuation turns.',
|
|
||||||
'"Difficult", "slow", or "partially incomplete" is NOT blocked.',
|
|
||||||
'Only genuinely insurmountable obstacles qualify (missing credentials, external service down, etc.).',
|
|
||||||
] as const
|
|
||||||
|
|
||||||
export function isGoalTerminal(status: GoalStatus): boolean {
|
|
||||||
return (
|
|
||||||
status === 'complete' ||
|
|
||||||
status === 'blocked' ||
|
|
||||||
status === 'budget_limited' ||
|
|
||||||
status === 'usage_limited' ||
|
|
||||||
status === 'max_turns'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -38,12 +38,6 @@ import {
|
|||||||
buildGoalContextBlock,
|
buildGoalContextBlock,
|
||||||
} from '../../src/services/goal/prompts'
|
} from '../../src/services/goal/prompts'
|
||||||
|
|
||||||
import {
|
|
||||||
COMPLETION_AUDIT_RULES,
|
|
||||||
BLOCKED_AUDIT_RULES,
|
|
||||||
isGoalTerminal,
|
|
||||||
} from '../../src/services/goal/goalAudit'
|
|
||||||
|
|
||||||
const TEST_SESSION = 'test-integration-session'
|
const TEST_SESSION = 'test-integration-session'
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -123,10 +117,6 @@ describe('Goal lifecycle: budget limiting', () => {
|
|||||||
expect(getGoal(TEST_SESSION)!.status).toBe('budget_limited')
|
expect(getGoal(TEST_SESSION)!.status).toBe('budget_limited')
|
||||||
expect(getGoal(TEST_SESSION)!.tokensUsed).toBe(55_000)
|
expect(getGoal(TEST_SESSION)!.tokensUsed).toBe(55_000)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('budget_limited is terminal', () => {
|
|
||||||
expect(isGoalTerminal('budget_limited')).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Goal lifecycle: usage limiting', () => {
|
describe('Goal lifecycle: usage limiting', () => {
|
||||||
@@ -135,10 +125,6 @@ describe('Goal lifecycle: usage limiting', () => {
|
|||||||
markUsageLimited(TEST_SESSION)
|
markUsageLimited(TEST_SESSION)
|
||||||
expect(getGoal(TEST_SESSION)!.status).toBe('usage_limited')
|
expect(getGoal(TEST_SESSION)!.status).toBe('usage_limited')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('usage_limited is terminal', () => {
|
|
||||||
expect(isGoalTerminal('usage_limited')).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Goal lifecycle: blocked attempts', () => {
|
describe('Goal lifecycle: blocked attempts', () => {
|
||||||
@@ -197,20 +183,6 @@ describe('Goal lifecycle: turn limits', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('isGoalTerminal', () => {
|
|
||||||
test('active and paused are NOT terminal', () => {
|
|
||||||
expect(isGoalTerminal('active')).toBe(false)
|
|
||||||
expect(isGoalTerminal('paused')).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('complete, blocked, budget_limited, usage_limited are terminal', () => {
|
|
||||||
expect(isGoalTerminal('complete')).toBe(true)
|
|
||||||
expect(isGoalTerminal('blocked')).toBe(true)
|
|
||||||
expect(isGoalTerminal('budget_limited')).toBe(true)
|
|
||||||
expect(isGoalTerminal('usage_limited')).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Goal prompt templates', () => {
|
describe('Goal prompt templates', () => {
|
||||||
test('continuation prompt contains objective and audit rules', () => {
|
test('continuation prompt contains objective and audit rules', () => {
|
||||||
const goal = setGoal('Build dashboard', {
|
const goal = setGoal('Build dashboard', {
|
||||||
@@ -256,24 +228,6 @@ describe('Goal prompt templates', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Audit rules consistency', () => {
|
|
||||||
test('completion audit has 6 rules', () => {
|
|
||||||
expect(COMPLETION_AUDIT_RULES.length).toBe(6)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('blocked audit has 3 rules', () => {
|
|
||||||
expect(BLOCKED_AUDIT_RULES.length).toBe(3)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('continuation prompt embeds all completion audit rules', () => {
|
|
||||||
const goal = setGoal('Audit check', { sessionId: TEST_SESSION })
|
|
||||||
const prompt = buildContinuationPrompt(goal)
|
|
||||||
for (const rule of COMPLETION_AUDIT_RULES) {
|
|
||||||
expect(prompt).toContain(rule)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Format helpers', () => {
|
describe('Format helpers', () => {
|
||||||
test('formatGoalStatusLabel returns human-readable labels', () => {
|
test('formatGoalStatusLabel returns human-readable labels', () => {
|
||||||
expect(formatGoalStatusLabel('active')).toBe('Active')
|
expect(formatGoalStatusLabel('active')).toBe('Active')
|
||||||
|
|||||||
Reference in New Issue
Block a user