From ce2ac82fea024be7992b2889273b0b17b791d1cd Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Tue, 15 Sep 2026 11:11:49 -0700 Subject: [PATCH] fix(agent-status): replace Reflect.get with typed property access in legacy freeze helper 9ab0a18e82 (#20716) added src/shared/agent-status-legacy-adapter.ts with a freezeRecursively helper that reads each own key via Reflect.get, which trips the anti-slop/no-reflect-get static-analysis rule. That rule is currently failing CI on downstream PRs that rebase onto main via the merge ref. Narrow `value` to Record once (TypeScript's `object` type has no index signature, so this needs one assertion) and read each own key with typed bracket access instead of Reflect.get. Bracket access on an own key behaves identically to Reflect.get for both string and symbol keys, so the helper still freezes every reachable value in the graph exactly as before. --- src/shared/agent-status-legacy-adapter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/agent-status-legacy-adapter.ts b/src/shared/agent-status-legacy-adapter.ts index cbed5778a78..b432633b8dc 100644 --- a/src/shared/agent-status-legacy-adapter.ts +++ b/src/shared/agent-status-legacy-adapter.ts @@ -91,8 +91,10 @@ function freezeRecursively(value: unknown, seen: WeakSet): void { return } seen.add(value) + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the typeof switch and null check above leave only a non-null object here; Reflect.ownKeys enumerates only that object's own keys, so this assertion only restores the indexable shape TypeScript's `object` type erases. + const ownProperties = value as Record for (const key of Reflect.ownKeys(value)) { - freezeRecursively(Reflect.get(value, key), seen) + freezeRecursively(ownProperties[key], seen) } Object.freeze(value) }