Skip to content

fix(environment): disclose truncated comparison differences - #7673

Merged
morluto merged 1 commit into
morluto:mainfrom
WenyuChiou:codex/fix-environment-compare-truncation-7621
Nov 3, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
WenyuChiou:codex/fix-environment-compare-truncation-7621

Conversation

@WenyuChiou

@WenyuChiou WenyuChiou commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7621. environment-compare returned the same 20 diagnostic entries for steps with 20, 21 or 25 differences, leaving callers unable to identify omitted entries. Each step now includes differences_total, differences_omitted and differences_truncated.

Problem and expected behavior

Equality and category counts already use all computed differences. The defect is the loss of coverage information when the report keeps its first 20 entries. A bounded result should disclose that omission.

Change and scope

stepOf owns the bounded report and derives the new fields from its complete difference list and returned prefix. The existing 20-entry ceiling, ordering, comparison rules, equality and category calculations remain unchanged. The guide and fidelity specification explain the fields and the recovery limitation: omitted entries are not retained, and --full-output cannot restore them; further investigation uses the original capture and probe Evidence.

This is an ordinary correction within the existing contribution scope; an advance maintainer capability decision is not applicable. It does not change the diff engine addressed by #7161.

Contract and boundary impact

  • Owner: src/application/environment/environmentCompare.ts, before CLI result formatting.
  • Additive CLI report fields; command inputs are unchanged. No MCP schema or provider code changes.
  • Capture/probe provenance and caller-selected files are preserved. No package, dependency, installation or generated metadata changes are included.
  • Runtime target effects remain local reads of captured data. Verification starts local CLI processes against synthetic HAR fixtures; recorded URLs are never fetched.

Evidence and regression coverage

Executed on Windows x64 with pinned Node 24.22.1/npm 11.16.0 and the existing unchanged-lockfile dependency installation, against base 40b9c03f996270e944ff07cafb63be15ce903708:

  • Offline public CLI workflow: synthetic HAR inspection, manifest projection, comparison, and --full-output control. On the base, 20/21/25 differences each returned 20 entries without coverage fields. After the change:
Computed differences Returned differences_total differences_omitted differences_truncated
0 0 0 0 false
19 19 19 0 false
20 20 20 0 false
21 20 21 1 true
25 20 25 5 true
  • Both phases preserve equality/category results, the full-output data matches the ordinary report, and input HAR/Evidence/manifest bytes remain unchanged within each workflow. HAR bytes match between phases.
  • A new source regression fails on the unmodified producer (52 existing tests pass, the new regression fails) and passes with the fix. It also checks a category present only beyond the returned prefix.
  • The added CLI regression covers the five boundaries, ordinary/full output and unchanged input files, through the public commands. Existing agreement and invalid-probe CLI controls were selected beside it.

Applicable boundary coverage: bounded projection facts, zero/ceiling/over-ceiling distinctions, retained source identity and public success/error delivery. No lifecycle behavior changes.

Validation performed

  • Exact source tests, one worker: environmentCompare.test.ts and environmentCompareDiff.test.ts — 121 passed, no skips.
  • Exact CLI test file with the new coverage case and two existing controls selected by name — 3 passed; 5 other cases were not selected.
  • Public scripts/rea.mjs synthetic workflow before and after — all five commands in each completed workflow exited 0.
  • Targeted oxlint — exit 0, with two warnings (file length and existing function complexity).
  • Formatting of all five changed files and git diff --check — passed.
  • Full node scripts/run-typescript.mjs --noEmit — passed (291 seconds); this was not a --noCheck run.
  • All seven checks underlying docs:check:built — passed: package/skill/catalog/completion metadata, documentation facts, error schema and dependency-license inventory. README conformance — 9 passed, no skips.
  • Module boundaries — passed across 3,274 files; architecture guards — passed across 2,185 source files.

Runtime preparation used the pinned compiler with --noCheck, followed by catalog recording and bundling; the separate full typecheck above subsequently passed. Checks used the already installed, matching ancestor dependencies without another installation. The normal discovery script hardcodes checkout-local node_modules and fails in this arrangement. Its canonical compareTestDiscovery, using the existing Vitest installation, found all 2,687 files exactly once, with no missing or unexpected files.

VitePress rendering was attempted with one rendering worker but failed before page generation: Windows returned EPERM when VitePress tried to symlink the existing Vue dependency into this worktree. Rendered-page/link coverage was unavailable locally; the hosted result is recorded below. No permission or dependency changes were made to work around it. Full local npm run check and aggregate suites were not run. MCP, live applications and real analysis providers were not exercised. The completed hosted CI result is recorded below.

Hosted CI

Run 40611771298 passed on 0916d35592dd1abd5680770e955f83ab617c8576. Its checkout was merge f8ae065347c62a7a87e9105013bbffd911a55a03, whose tree exactly matches the reviewed tree. Source tests: 20,985 passed, 15 skipped. All eight built-test shards passed (16,132 passed, 229 skipped); the Linux CLI comparison file ran all eight tests, including the new coverage regression. Standard npm run docs:check and npm run docs:build passed in the hosted Documentation job. Static checks, package builds, agentenv, Linux package validation, Portable tests and the required CI gate passed. Nineteen optional jobs were skipped; this does not establish coverage of those provider/platform lanes.

Compatibility, safety, and release

JSON consumers gain three coverage fields. No paging or retained complete diagnostic list is introduced. Existing comparison behavior and resource ceiling remain in place. No credentials, network target interactions or release metadata changes are part of the patch.

Author readiness

Human owner: @WenyuChiou

  • 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.

Before merge

  • Required review, current CI, remaining verification and human readiness are complete.
  • Material scope and authority questions are resolved.

The human owner confirmed readiness for initial maintainer review. Merge requires separate explicit approval.

Preserve the twenty-entry diagnostic prefix and report the full count,
omitted count and truncation fact at the owning report projection. Document
the recovery limitation and cover the public HAR-to-comparison workflow.

Fixes morluto#7621

Validation: 121 source tests; three selected CLI regressions (five other
cases unselected); nine README conformance cases; full --noEmit typecheck;
documentation facts/metadata/schema/licenses; module boundaries and
architecture guards. VitePress rendering is blocked by Windows EPERM on its
worktree-local Vue symlink. Full aggregate coverage remains for Draft CI.

Independent code review: APPROVE, relayed by parent task
01a17716-6299-75fe-87e9-b0398b8c9019. Trigger: >=50 changed lines / >=3 files.
Reviewed tree: ba964ef
Reviewed full-index patch SHA256:
972dcfc219dd7b9606175b1848068f92210fa3f7d0a8a244c1ac7ce296ae32d9
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The code appears safe to merge; no actionable issues were found.

Summary

environment-compare now reports how many differences were computed and omitted from each step.

  • Each comparison step shows when its difference list leaves entries out.

Review used source inspection; tests were not rerun. Whether another PR supersedes this one could not be checked because GitHub access was unavailable.

Reviews (1) · Last reviewed commit: "fix(environment): disclose truncated com..." · Reviewed by Greptile

@WenyuChiou
WenyuChiou marked this pull request as ready for review October 28, 2026 01:09
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T01:09:48.149780Z
We couldn’t complete this review. Comment @codex review to try again.
0916d35 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit f5cfe09 into morluto:main Nov 3, 2026
45 of 46 checks passed
@morluto morluto added bug Something isn't working area: setup Setup, packaging, upgrade, install, Doctor, and client registration labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] environment-compare does not disclose when a step's difference list is truncated

2 participants