mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
fix(environment)!: report recorded reads and target uncertainty (#7834)
* fix(environment)!: report recorded reads and target uncertainty BREAKING CHANGE: Environment state and coverage can report method-replay for non-GET safe reads; exhaustive reason consumers must handle it. * docs(environment): include safe-method replay reason
This commit is contained in:
1 parent
cc5a4062ff
commit
1e088c19ad
14 files changed
+205
-37
No files matched your search
@@ -16,6 +16,7 @@ import {
|
||||
identityCandidates,
|
||||
isObject,
|
||||
isQueryPost,
|
||||
isSafeHttpMethod,
|
||||
stateValueRetentionBytes,
|
||||
lastSegmentValue,
|
||||
STATE_BODY_LIMIT_BYTES,
|
||||
@@ -331,7 +332,7 @@ export class EnvironmentStateExtraction {
|
||||
this.#views.set(tool.name, { tool: tool.name, shape: "recorded", reason });
|
||||
}
|
||||
|
||||
/** GET tools may render from state; query POSTs stay recorded. */
|
||||
/** GET tools may render from state; other safe methods and query POSTs replay. */
|
||||
#candidates(): Candidate[] {
|
||||
const candidates: Candidate[] = [];
|
||||
for (const tool of this.#tools) {
|
||||
@@ -340,6 +341,8 @@ export class EnvironmentStateExtraction {
|
||||
this.#readOnly.has(tool.name)
|
||||
)
|
||||
this.#recorded(tool, "query-body");
|
||||
else if (tool.method !== "GET" && isSafeHttpMethod(tool.method))
|
||||
this.#recorded(tool, "method-replay");
|
||||
if (tool.method !== "GET") continue;
|
||||
candidates.push({ tool, ...readType(tool.path_template) });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user