mirror of
https://github.com/morluto/rea.git
synced 2026-12-07 04:33:10 +08:00
fix(source-maps): report details.limit for source_map_limits refusals (#14797)
Share source_map_limits bounds through a domain-owned SOURCE_MAP_BUDGETS table and attach details.limit across local source-map read, decoder admission, codec reply, and memory/output limit refusals (Refs #14234). Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
@@ -6,11 +6,13 @@ import {
|
||||
import { traceSourceMap } from "./TraceSourceMap.js";
|
||||
import {
|
||||
isSourceMapFailure,
|
||||
isSourceMapLimit,
|
||||
SOURCE_MAP_FORMAT,
|
||||
sourceMapLimitFailure,
|
||||
} from "../../domain/sourceMapFormat.js";
|
||||
import { malformedInput } from "../../domain/parseFailure.js";
|
||||
import {
|
||||
codecSourceMapLimitFieldSchema,
|
||||
sourceMapCodecInputSchema,
|
||||
sourceMapCodecReplySchema,
|
||||
} from "./SourceMapCodecProtocol.js";
|
||||
@@ -63,6 +65,9 @@ const execute = async (): Promise<string> => {
|
||||
)
|
||||
)
|
||||
throw cause;
|
||||
const parsedLimit = isSourceMapLimit(cause)
|
||||
? codecSourceMapLimitFieldSchema.safeParse(cause.failure.limit.name)
|
||||
: undefined;
|
||||
return JSON.stringify({
|
||||
state: "failure",
|
||||
reason:
|
||||
@@ -72,6 +77,14 @@ const execute = async (): Promise<string> => {
|
||||
? "malformed"
|
||||
: cause.kind,
|
||||
message: cause.message,
|
||||
...(parsedLimit?.success && isSourceMapLimit(cause)
|
||||
? {
|
||||
limit: {
|
||||
field: parsedLimit.data,
|
||||
maximum: cause.failure.limit.maximum,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user