Skip to content

fix(review): resolve findings from omni-code-review battery (release/v3.8.51 vs main, api/v1 + image handlers) - #14365

Merged
diegosouzapw merged 8 commits into
release/v3.8.51from
fix/omni-code-review-e2e-areas
Sep 22, 2026
Merged

diegosouzapw merged 8 commits into
release/v3.8.51from
fix/omni-code-review-e2e-areas

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

What

Resolves the approved FIX / FIX+TEST items of the /omni-code-review battery run 2026-09-21_release-v3.8.51_vs_main_e2e-areas (15 lenses over src/app/api/v1/{_helpers,files,batches} + open-sse/handlers/imageGeneration.ts,imageUpscale; 102 raw findings → 45 ledger entries; run record in _tasks/reviews/omni-code-review/2026-09-21_release-v3.8.51_vs_main_e2e-areas/). This is Task 3 of the family's E2E validation plan.

commit ledger items change
11d71e9 LEDGER-3/9 (11 lenses), 39, 41 getApiKeyRequestScope surfaces an additive keyState: "none" | "unresolved" | "invalid" | "valid"; DELETE /v1/batches/delete-completed drops its redundant validateApiKey re-check (the helper is the single lifecycle gate since #13881), its comment now tells the truth and the audit reason is honest (invalid vs unresolved, previously unreachable). Tests: helper keyState cases, audit reason for revoked vs unknown key, source guard that the route no longer imports validateApiKey.
8a587a7 LEDGER-4/40 (10 lenses), 6/24/28/29, 12, 32, 42 Retirement guards derive the model prefix once and both return HTTP_STATUS.GONE; image_size is forwarded only when supplied (no silent 1K default), invalid values still clamp to 1K, camelCase alias dropped, doc comment; tests for the four image_size outcomes and for hasUsableImage (blank url, non-object item, well-formed, edit path); SSRF option bag hoisted into one constant; split imports merged.
25951c1 + 6167c0a LEDGER-22/37 The upscale call-log sink no longer renders errors with a bare String(opts.error) (crashed on the sanitizer's null-prototype objects): new shared open-sse/handlers/imageErrorLog.ts (stringifyImageErrorForLog + redactSensitiveErrorText), used by both image sinks; imageGeneration.ts drops its private copy. Tests: Authorization value masked, null-prototype payload does not throw, source guard against re-duplication.

DISCUSS items of the same run were opened as issues instead of fixed here: #14332 (anonymous/revoked-key writes create null-owner rows), #14333 (candidates route + key×cookie precedence), #14334 (dashboard ignores hasMore), #14335 (five image-gen follow-ups).

Validation

Per commit: focused suites RED → GREEN (batches-delete-completed-route-scope 11→13/13, batch-delete-completed-ownership-wvxc 5→6/6, image-generation-handler 50→59/59, image-upscale-error-log new 7/7, image-upscale 34/34), npx prettier --check and npx eslint --suppressions-location config/quality/eslint-suppressions.json clean on every changed file, npm run typecheck:core and npm run check:open-sse-typecheck clean. Re-review rounds of the battery over this diff are recorded in the run directory (round 2 = full roster, 671 changed lines).

No production behaviour changes beyond the ledger items: revoked/expired/banned keys still get 401 on the sweep route (pinned by the existing tests); image_size omitted now lets the upstream default apply (previously forced to 1K — LEDGER-6).

⚠️ base-red inherited: #13866 — Docs sync (1 key missing from .env.example), reproduces on the base tip.

The /v1/images/upscale call-log sink rendered error: unknown with a bare
String(opts.error), which throws on the null-prototype objects
sanitizeUpstreamDetails() produces and forwarded credential-bearing Error
messages verbatim. Lift the generation sink's total stringifier into
open-sse/handlers/imageErrorLog.ts, add credential redaction, and use it
from imageUpscale/shared.ts.
… own file (file-size gate)

tests/unit/image-generation-handler.test.ts is frozen at 2235 lines by
check:file-size; commit 8a587a7 grew it to 2389. The nine new cases
(LEDGER-6/24/28/29 image_size outcomes, LEDGER-12 hasUsableImage) now live in
tests/unit/image-generation-size-and-payload-guard.test.ts; the original file
is back to 2232 lines with its other content unchanged.
@diegosouzapw
diegosouzapw force-pushed the fix/omni-code-review-e2e-areas branch from 5ac500e to 7107cb7 Compare September 22, 2026 01:08
The LEDGER-3/9 source-text guard in
tests/unit/batch-delete-completed-ownership-wvxc.test.ts matched prose as
well as code: its `\bvalidateApiKey\s*\(` alternative was one comment
reflow (or a `@see validateApiKey(key)`) away from failing the suite with
a message that falsely claims the route re-runs the lifecycle check.

- Extract the guard into `routeReRunsValidateApiKey(src)` and strip
  block and line comments (`/\/\*[\s\S]*?\*\/|\/\/.*$/gm`) before
  matching, so the assertion is about code only.
- Add a fixture case that feeds the guard a comment containing
  `validateApiKey (` and `@see validateApiKey(key)` — RED against the old
  regex, GREEN after the strip — plus a mutation check proving a real
  import or call in code still trips it.

The route file is untouched.
…/67 (omni-code-review round 3)

LEDGER-47: Antigravity call-log test fixture returns a real inlineData candidate and
asserts result.data.data.length === 1, instead of an empty candidates array.
LEDGER-48: normalizeImageGenerationSize now returns { value, clamped } so an
unrecognised image_size logs a log.warn line naming the raw value and the clamp.
LEDGER-49: stringifyImageErrorForLog's object branch is pinned against a
credential-bearing null-prototype payload, asserting redaction to [REDACTED].
LEDGER-50: added fetchUntrustedRemoteImage() to src/shared/network/remoteImageFetch.ts
and switched imageGeneration.ts and imageUpscale/shared.ts to call it, removing the
per-file duplicated public-only/pinDns option literal and rationale comment.
LEDGER-52: imageErrorLog.ts's relative import of redactSensitiveErrorText now carries
the explicit .ts extension used by every other relative import in open-sse/handlers/.
LEDGER-54: captureAntigravityImageRequest now reads the persisted call-log row's
requestBody (image_size / image_size_applied) via getCallLogById, not just the
upstream envelope.
LEDGER-56: stringifyImageErrorForLog's Error branch renders name/message
defensively inside the same safety net as the other branches, so a non-string
name/message or a throwing message getter cannot escape as an unhandled throw.
LEDGER-57: normalizeImageGenerationSize's docblock hedges the 1K/2K/4K enum and the
clamp rationale as observed behaviour (#11952), not a confirmed upstream contract.
LEDGER-58: logRequestBody records both image_size (raw caller value, null when
absent) and image_size_applied (what went upstream, "default" when omitted), so the
persisted call-log body never silently drops the caller's original value.
LEDGER-59: same call-log fix as LEDGER-58 (two ledger findings, one change).
LEDGER-60: same call-log fix as LEDGER-58 (two ledger findings, one change).
LEDGER-63: imageErrorLog.ts's relative imports use explicit .ts extensions, matching
every other relative import in open-sse/handlers/.
LEDGER-64: imageUpscale/shared.ts imports imageErrorLog.ts and utils/error.ts with
explicit .ts extensions, matching the sibling import in imageGeneration.ts.
LEDGER-66: the non-object-item 502 test case in image-generation-handler.test.ts now
also asserts the "without an image payload" message, pinning isJsonObject(item)
rather than any 502 from the outer catch.
LEDGER-67: the new LEDGER-12/LEDGER-6 test comments are qualified with the
omni-code-review run id, avoiding a collision with other runs' LEDGER numbering.
@diegosouzapw
diegosouzapw merged commit 1c213eb into release/v3.8.51 Sep 22, 2026
31 of 32 checks passed
@diegosouzapw
diegosouzapw deleted the fix/omni-code-review-e2e-areas branch September 22, 2026 12:04
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.

1 participant