Skip to content
Merged
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
4 changes: 4 additions & 0 deletions docs/spec/03-runtime/08-error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Rules:
2. `message` is English source text (i18n key may map separately)
3. UI should prefer i18n key derived from `code` when available

The shared test suite verifies every live runtime and Edit code listed below
is present in `ErrorCodes`; reserved codes in §3.7 remain intentionally absent
until an implementation emits them.

## 3. Code registry

### 3.1 App / protocol
Expand Down
16 changes: 16 additions & 0 deletions docs/spec/06-delivery/04-e2e-test-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -7891,3 +7891,19 @@ are withdrawn with ADR 0165.
- **Status**: Unit-covered (`bundled-plugins.test.mjs`,
`plugin-complete.test.mjs`); full UI journey Draft (do not run E2E locally
unless explicitly requested)

#### E2E-190: Live AppError codes stay registered

- **Preconditions**: The shared package test suite is available.
- **Steps**:
1. Run the shared error helper tests.
2. Inspect the live runtime and Edit code list used by the test.
- **Expected**: Every live code in the error-code specification, including
context-compaction, empty-response, and Edit recovery failures, exists in
`packages/shared/src/errors.ts` with an identical key and value. Reserved
codes remain excluded until they are emitted.
- **Specs linked**: `03-runtime/08-error-codes.md`
- **Acceptance**: Quality
- **Milestone**: M5
- **Status**: Unit-covered (`packages/shared/src/errors.test.ts`); full UI
journey not applicable
23 changes: 23 additions & 0 deletions packages/shared/src/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,27 @@ describe("result helpers", () => {
expect(ErrorCodes.SHELL_NOT_FOUND).toBe("SHELL_NOT_FOUND");
expect(ErrorCodes.COMMAND_SHELL_INVALID).toBe("COMMAND_SHELL_INVALID");
});

it("registers every live runtime and Edit error code", () => {
const liveCodes = [
"CONTEXT_COMPACTION_FAILED",
"EMPTY_MODEL_RESPONSE",
"EDIT_TAG_REQUIRED",
"EDIT_TAG_MISMATCH",
"EDIT_TAG_UNKNOWN",
"EDIT_LINES_UNSEEN",
"EDIT_PARSE_FAILED",
"EDIT_RANGE_INVALID",
"EDIT_BLOCK_UNRESOLVED",
"EDIT_REGISTER_EMPTY",
"EDIT_REGISTER_AMBIGUOUS",
"EDIT_REPAIR_AMBIGUOUS",
"EDIT_NO_CHANGE",
"EDIT_AMPLIFICATION_LIMIT",
] as const;

for (const code of liveCodes) {
expect(ErrorCodes[code]).toBe(code);
}
});
});
14 changes: 14 additions & 0 deletions packages/shared/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const ErrorCodes = {
PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED",
PROVIDER_SECRET_MISSING: "PROVIDER_SECRET_MISSING",
CONTEXT_TOO_LARGE: "CONTEXT_TOO_LARGE",
CONTEXT_COMPACTION_FAILED: "CONTEXT_COMPACTION_FAILED",
STREAM_FAILED: "STREAM_FAILED",
EMPTY_MODEL_RESPONSE: "EMPTY_MODEL_RESPONSE",
PROMPT_ENHANCEMENT_EMPTY: "PROMPT_ENHANCEMENT_EMPTY",
SUBAGENT_IDLE_TIMEOUT: "SUBAGENT_IDLE_TIMEOUT",
SUBAGENT_DURATION_TIMEOUT: "SUBAGENT_DURATION_TIMEOUT",
Expand All @@ -66,6 +68,18 @@ export const ErrorCodes = {
MUTATION_RETRY_BUDGET_EXHAUSTED: "MUTATION_RETRY_BUDGET_EXHAUSTED",
PROCESS_RESOURCE_EXHAUSTED: "PROCESS_RESOURCE_EXHAUSTED",
TOOL_ABORTED: "TOOL_ABORTED",
EDIT_TAG_REQUIRED: "EDIT_TAG_REQUIRED",
EDIT_TAG_MISMATCH: "EDIT_TAG_MISMATCH",
EDIT_TAG_UNKNOWN: "EDIT_TAG_UNKNOWN",
EDIT_LINES_UNSEEN: "EDIT_LINES_UNSEEN",
EDIT_PARSE_FAILED: "EDIT_PARSE_FAILED",
EDIT_RANGE_INVALID: "EDIT_RANGE_INVALID",
EDIT_BLOCK_UNRESOLVED: "EDIT_BLOCK_UNRESOLVED",
EDIT_REGISTER_EMPTY: "EDIT_REGISTER_EMPTY",
EDIT_REGISTER_AMBIGUOUS: "EDIT_REGISTER_AMBIGUOUS",
EDIT_REPAIR_AMBIGUOUS: "EDIT_REPAIR_AMBIGUOUS",
EDIT_NO_CHANGE: "EDIT_NO_CHANGE",
EDIT_AMPLIFICATION_LIMIT: "EDIT_AMPLIFICATION_LIMIT",
COMMAND_SHELL_CHANGED: "COMMAND_SHELL_CHANGED",
SHELL_NOT_FOUND: "SHELL_NOT_FOUND",
COMMAND_SHELL_INVALID: "COMMAND_SHELL_INVALID",
Expand Down