[PR #6465] [CLOSED] fix(environment): normalize recorded empty absence responses #7359

Closed
opened 2026-11-01 21:47:18 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6465
Author: @WenyuChiou
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: fix/compare-empty-missing-response


📝 Commits (2)

  • 0284442 fix(environment): normalize recorded empty absence responses
  • 839a199 test(environment): cover missing response body representations

📊 Changes

2 files changed (+95 additions, -1 deletions)

View changed files

📝 src/application/environment/environmentCompare.ts (+7 -1)
📝 tests/boundary/cli/environmentCompareCli.test.ts (+88 -0)

📄 Description

Summary

Fixes #6432. Normalize recorded empty-text absence responses when comparing a served environment, while preserving a JSON empty string and genuine JSON error differences.

Problem and expected behavior

A missing-item GET answered from a recorded empty 404 was classified as state-produced and skipped recorded-body normalization. The same empty text normalized to null on the probe side, producing a false root difference and agreement 0.5 instead of 1.

Change and scope

Keep normalization in the comparison owner. A state.view === "missing" answer replays a recorded absence, so inspect its existing format-aware recorded body just like other replayed answers. Other state-rendered bodies remain unchanged. Add four public compiled-CLI cases: empty text, matching JSON errors, changed JSON errors, and JSON empty string versus no body.

Contract and boundary impact

  • Semantic owner / earliest changed stage: environmentCompare.ts answer normalization.
  • Scope decision: not applicable; routine fix inside the existing offline captured-Evidence comparison workflow.
  • CLI/MCP schemas, tool catalog, providers, bridges, target formats, provenance and installation: unchanged.
  • Existing captured files are read. No target execution, instrumentation, network contact, protection recovery, or authority expansion is introduced. Tests use temporary synthetic Evidence and owned CLI subprocesses.
  • Generated metadata and release/package files: unchanged.

Evidence and regression coverage

Executed on Linux x64 with pinned Node 24.18.0, npm 11.16.0, and locked dependencies installed with lifecycle scripts disabled.

  • On unchanged production base e32a0494d42dedd5e79ca341d20c53f07479d9bb, the updated CLI file reported 1 failure / 5 passes: empty 404 returned equal: 1, agreement: 0.5 with root live: "null", env: "\"\"".
  • With the fix, 6/6 CLI cases pass. Empty 404 now reports steps: 2, equal: 2, agreement: 1 and no differences.
  • Matching JSON retains agreement 1; changed JSON retains the /detail difference; JSON empty string versus no body retains the root difference.

Validation performed

  • npm run build:cached — passed before and after.
  • node node_modules/vitest/vitest.mjs run --project cli-boundary tests/boundary/cli/environmentCompareCli.test.ts --maxWorkers=1 — base 1 failed / 5 passed; fixed 6 passed.
  • node node_modules/vitest/vitest.mjs run src/application/environment/environmentCompare.test.ts src/application/environment/environmentCompareDiff.test.ts src/application/environment/environmentCompareIds.test.ts --maxWorkers=1 — 56 passed.
  • npm run check — passed (typecheck, lint/module boundaries, formatting, knip, metadata and architecture guards; lint 0 errors, repository warnings remain).
  • git diff --check — passed.
  • Independent AI source review — no blocking finding; not human review.

Compatibility, safety, and release

No breaking changes, migrations, provider or package changes. Full deterministic suite and CI remain separate; no real provider, browser, target binary, live application, model, macOS or Windows verification was run. No performance improvement is claimed.

Author readiness

Human owner: @WenyuChiou

AI-assisted draft; human review and initial readiness declaration are pending.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6465 **Author:** [@WenyuChiou](https://github.com/WenyuChiou) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/compare-empty-missing-response` --- ### 📝 Commits (2) - [`0284442`](https://github.com/morluto/rea/commit/028444269b78b29b6e34d158e17def1560dfcb07) fix(environment): normalize recorded empty absence responses - [`839a199`](https://github.com/morluto/rea/commit/839a1992d041adc8a4cc1bda162d95134cb76615) test(environment): cover missing response body representations ### 📊 Changes **2 files changed** (+95 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/application/environment/environmentCompare.ts` (+7 -1) 📝 `tests/boundary/cli/environmentCompareCli.test.ts` (+88 -0) </details> ### 📄 Description ## Summary Fixes #6432. Normalize recorded empty-text absence responses when comparing a served environment, while preserving a JSON empty string and genuine JSON error differences. ## Problem and expected behavior A missing-item GET answered from a recorded empty 404 was classified as state-produced and skipped recorded-body normalization. The same empty text normalized to `null` on the probe side, producing a false root difference and agreement 0.5 instead of 1. ## Change and scope Keep normalization in the comparison owner. A `state.view === "missing"` answer replays a recorded absence, so inspect its existing format-aware recorded body just like other replayed answers. Other state-rendered bodies remain unchanged. Add four public compiled-CLI cases: empty text, matching JSON errors, changed JSON errors, and JSON empty string versus no body. ## Contract and boundary impact - Semantic owner / earliest changed stage: `environmentCompare.ts` answer normalization. - Scope decision: not applicable; routine fix inside the existing offline captured-Evidence comparison workflow. - CLI/MCP schemas, tool catalog, providers, bridges, target formats, provenance and installation: unchanged. - Existing captured files are read. No target execution, instrumentation, network contact, protection recovery, or authority expansion is introduced. Tests use temporary synthetic Evidence and owned CLI subprocesses. - Generated metadata and release/package files: unchanged. ## Evidence and regression coverage Executed on Linux x64 with pinned Node 24.18.0, npm 11.16.0, and locked dependencies installed with lifecycle scripts disabled. - On unchanged production base `e32a0494d42dedd5e79ca341d20c53f07479d9bb`, the updated CLI file reported **1 failure / 5 passes**: empty 404 returned `equal: 1, agreement: 0.5` with root `live: "null", env: "\"\""`. - With the fix, **6/6 CLI cases pass**. Empty 404 now reports `steps: 2, equal: 2, agreement: 1` and no differences. - Matching JSON retains agreement 1; changed JSON retains the `/detail` difference; JSON empty string versus no body retains the root difference. ## Validation performed - `npm run build:cached` — passed before and after. - `node node_modules/vitest/vitest.mjs run --project cli-boundary tests/boundary/cli/environmentCompareCli.test.ts --maxWorkers=1` — base 1 failed / 5 passed; fixed 6 passed. - `node node_modules/vitest/vitest.mjs run src/application/environment/environmentCompare.test.ts src/application/environment/environmentCompareDiff.test.ts src/application/environment/environmentCompareIds.test.ts --maxWorkers=1` — 56 passed. - `npm run check` — passed (typecheck, lint/module boundaries, formatting, knip, metadata and architecture guards; lint 0 errors, repository warnings remain). - `git diff --check` — passed. - Independent AI source review — no blocking finding; not human review. ## Compatibility, safety, and release No breaking changes, migrations, provider or package changes. Full deterministic suite and CI remain separate; no real provider, browser, target binary, live application, model, macOS or Windows verification was run. No performance improvement is claimed. ## Author readiness Human owner: @WenyuChiou AI-assisted draft; human review and initial readiness declaration are pending. - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:47:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7359
No description provided.