Skip to content

[sentry:7871817832] Fixed: user-input validation in the TUI operation editor now throws AtcError('ATC_USAGE', ...) instead of plain Error. In `src/tui/workspace/operations/operation-mode - #116

Open
Ooooze wants to merge 1 commit into
mainfrom
codex/sentry-fix/7871817832

Conversation

@Ooooze

@Ooooze Ooooze commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Fixed: user-input validation in the TUI operation editor now throws AtcError('ATC_USAGE', ...) instead of plain Error. In src/tui/workspace/operations/operation-model.ts, inputObject and parseField (minimum, maximum, number/integer, object/array shape and malformed-JSON paths, routed through a small parseJson helper) keep their original message texts for the schema guards. expectedFailure in src/telemetry/failures.ts already treats any non-operational AtcError as expected, so failureReport returns null and the workspace.action boundary no longer emits tui workspace.action: unknown. The throw still escapes activate, so the existing WorkspaceApp catch still shows the message via oneLine and the editor overlay is not closed - refusal behavior is unchanged. The carried regression test, extended to cover minimum, maximum, integer, array-shape, non-object body and malformed JSON, fails on the base at expect(thrown).toBeInstanceOf(AtcError) and passes with the fix. Existing operation-model.test.ts assertions only match message fragments ('Minimum', 'Maximum', 'integer', 'array', 'object'), all preserved.

Evidence:
Event b09cf3310e5342fb8f6a22baebca546a release atc@0.2.21 dist 55067cf equals base 55067cf; release_diffs empty.
Stack line operation-model.ts:62 was if (field.minimum != null && value < field.minimum) throw new Error(Minimum: ${field.minimum}), column 67 is the new Error( start.
src/telemetry/failures.ts expectedFailure returns true for error instanceof AtcError && !OPERATIONAL.has(error.code); ATC_USAGE is not in OPERATIONAL, so failureReport returns null.
FailureReport on the base returned a report with error_code from reportCodeOf (undefined for plain Error), matching the event's failure_reason: unknown.
src/tui/workspace/WorkspaceApp.tsx:202 catch still runs captureFailure(...) then patch({ message: oneLine(e), busy: false, ... }); captureFailure returns early on an excluded refusal, so only the message changes.
operation-actions.ts save-edit branch: on a throw, the following patch({ overlay: null, edit: '', focus: 'operation-run' }) is skipped, so the editor stays open on refusal as before.
Check of src/tui/workspace/operations/operation-input-refusal.test.ts passed: 1 test, 0 failures, fullName 'operation form input refusals minimum field value is a usage refusal'.
Existing operation-model.test.ts toThrow assertions use only fragments 'integer', 'Minimum', 'Maximum', 'array', 'object'; the fix preserves each of those substrings in the AtcError messages.
docs/decisions ADR for this refusal was not added because the saved plan permits only the two source/test paths and the controller rejects docs paths; this is recorded for the human reviewer.

Regression tests: src/tui/workspace/operations/operation-input-refusal.test.ts

Full CI and human review are required.

Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/83fa79e8-0e25-4055-9ccd-65fb11f7617c

Sentry: https://atomic-chat.sentry.io/issues/7871817832/

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant