test(backend): add error-envelope coverage matrix and fix e2e suite (… - #323
Merged
kilodesodiq-arch merged 1 commit intoJul 17, 2026
Conversation
Contributor
Author
|
@kilodesodiq-arch Kindly review the changes. Would be expecting your feedback. |
Contributor
|
Awesome work on this! Thanks for the contribution 🚀 Merging now. |
ifygreg01-best
pushed a commit
to ifygreg01-best/ChainForge
that referenced
this pull request
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #286.
Adds a coverage matrix meta-test that guarantees every 4xx/5xx error status documented in the OpenAPI spec has a corresponding error-envelope test — so a new documented error status can never silently ship without a test proving it returns the global envelope (
code,message,details?,traceId?,timestamp,path) produced byAllExceptionsFilter.How it works
app/backend/test/error-envelope-coverage.spec.ts(new) — a static-analysis test with no app bootstrap, DB, or Redis dependency, so it runs under the unit jest config on every CI push/PR:app/frontend/openapi.json(source of truth — controllers use shorthand decorators like@ApiBadRequestResponse, and CI'sspec:exportdrift check keeps the file fresh).test/error-handling.e2e-spec.tsfor literal.expect(NNN)assertions (comments stripped, so status codes mentioned in docs don't count as tested).Gap closed: 503
503 was documented (health endpoints) but had no envelope test. Rather than allowlisting it, this PR adds a real one: new
GET /test-error/service-unavailableendpoint throwingServiceUnavailableException(with@ApiServiceUnavailableResponse), a matching e2e case, and the regeneratedopenapi.json(+15 lines, only the new path).Pre-existing e2e suite repairs (required)
error-handling.e2e-spec.tscould not run at all onmain, which would have made the coverage guarantee hollow. Three minimal fixes:test/jest-e2e.json— added the missing^cache/(.*)$module mapping (aid.module.tsimportscache/redis.service, resolved by tsconfigbaseUrlbut not by jest).ApiKeyGuard401'd every request before reaching the controller; the suite now authenticates via the guard's env-key fallback (process.env.API_KEY+x-api-keyheader), the same pattern asverification-lifecycle.e2e-spec.ts./test-error/generic-errorbut the controller route has always beengeneric; the test was fixed to match the controller (the published API surface), not the other way around.Housekeeping
pnpm-lock.yaml: backfilled missing@sendgrid/*entries from Implement email receipt delivery via SendGrid #146 (dependency was added topackage.jsonwithout a lockfile update).Testing