Skip to content

fix: standardize API error response envelope#953

Merged
OneStepAt4time merged 1 commit intomainfrom
fix/399-standardize-error-response-envelope
Apr 3, 2026
Merged

fix: standardize API error response envelope#953
OneStepAt4time merged 1 commit intomainfrom
fix/399-standardize-error-response-envelope

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

  • add centralized JSON error-envelope normalizer for API responses
  • include standard fields: code, message, optional details, requestId
  • preserve backward compatibility by keeping legacy error field
  • wire normalizer once in server onSend hook (no per-route rewrites)
  • skip normalization for SSE payloads to avoid stream behavior changes

Closes #399

Test Evidence

  • npx tsc --noEmit
  • npm test -- src/tests/api-error-envelope.test.ts
  • npm run build

@OneStepAt4time OneStepAt4time force-pushed the fix/399-standardize-error-response-envelope branch from 7ef290d to a236b8c Compare April 3, 2026 11:20
Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review passed — centralized error envelope is clean. Approved.

@aegis-gh-agent
Copy link
Copy Markdown
Contributor

aegis-gh-agent bot commented Apr 3, 2026

Self-rebase failed — conflicts with merged release 2.8.0 across .release-please-manifest.json, CHANGELOG.md, package.json, package-lock.json, src/server.ts. Please rebase onto current main and force-push. Approved — will merge immediately on green CI.

@aegis-gh-agent
Copy link
Copy Markdown
Contributor

aegis-gh-agent bot commented Apr 3, 2026

Self-rebase failed — conflicts with merged PR #951 (MemoryBridge) across package.json, package-lock.json, .release-please-manifest.json, CHANGELOG.md, src/server.ts. Please rebase onto current main and force-push. Approved — will merge immediately on green CI.

aegis-gh-agent[bot]
aegis-gh-agent bot previously approved these changes Apr 3, 2026
Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Centralized error envelope normalizer via onSend hook is clean — SSE skip, backward compatible, requestId tracing. Approved.

@aegis-gh-agent
Copy link
Copy Markdown
Contributor

aegis-gh-agent bot commented Apr 3, 2026

Self-rebase failed — conflicts with release PR #941 across package.json, package-lock.json, CHANGELOG.md, and src/server.ts. Please rebase and resolve, keeping only the server.ts changes (discard package/changelog noise from the merge). Approved — will merge on green CI.

- Add normalizeApiErrorPayload() to wrap all error responses in
  consistent envelope: { code, message, details, requestId, error }
- Normalize error responses server-wide via onSend hook
- SSE responses pass through unchanged
- 2 new tests, 2172 total tests pass
Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standardized error envelope. Centralized normalizer in onSend hook, preserves legacy error field, skips SSE. Tests cover envelope fields and SSE bypass. Approved.

@OneStepAt4time OneStepAt4time merged commit d8beb53 into main Apr 3, 2026
5 checks passed
@OneStepAt4time OneStepAt4time deleted the fix/399-standardize-error-response-envelope branch April 3, 2026 11:35
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.

DX: Standardize error response format — inconsistent across endpoints

1 participant