[PR #2691] [MERGED] test: share repeated boundary preambles to restore the jscpd gate #5315

Closed
opened 2026-10-31 01:05:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2691
Author: @NIU-123370
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: test/share-repeated-boundary-preambles


📝 Commits (2)

  • 78510c6 test: share repeated boundary preambles to restore the jscpd gate
  • 781d659 chore: merge main into shared boundary test fixtures

📊 Changes

6 files changed (+165 additions, -279 deletions)

View changed files

📝 src/domain/reconstructionCoverage.fixture.ts (+10 -0)
📝 src/domain/reconstructionCoverage.test.ts (+26 -62)
📝 src/native/NativeUiObservation.test.ts (+31 -95)
📝 tests/boundary/cli/captureCleanup.test.ts (+36 -57)
📝 tests/boundary/filesystem/installScript.test.ts (+16 -21)
📝 tests/boundary/filesystem/setupClientConfigCleanupOwnership.test.ts (+46 -44)

📄 Description

Main fails its own duplicate-code gate

npm run jscpd is the step that exits 1 inside Static checks, and it does so on
current main, not because of any one branch. .jscpd.json sets "threshold": 3.0.
Measured on this box against three trees:

Tree Scanned files Clones Duplicated lines npm run jscpd
bb540826 — base a recently green PR branch used 2321 1427 2.98% exit 0
bf34d0d2 — current main 2367 1480 3.0097% exit 1
this branch 2367 1460 2.9641% exit 0

The main run for 4276aaf1 already concluded failure at 06:58Z today on the same
step, which is why open PRs such as #2486 show a Static checks red while their own
diff contributes nothing to it.

What this changes

Five test files repeat blocks inside themselves, and one shared fixture gains the
narrowing those repeats each re-state. No production code, no assertion, and no test
case is added or removed: the same set of files reports 79 passed before and after
this change on this box.

  • reconstructionCoverage — one fixture helper returns the complete workspace with
    its first verifier result and boundary narrowed, replacing six copies of the same
    preamble; the two "newest observation fails" cases share one evaluation helper.
  • NativeUiObservation — one PNG payload builder and one screenshot observation call
    replace five literal copies. The builder reads width/height from the buffer, so
    each payload keeps exactly the values the copies hardcoded for these fixtures.
  • installScript — the fixture installer environment is built once and spread by the
    exec, pipe and PTY runs, keeping each one's ...process.env and ...overrides
    position.
  • setupClientConfigCleanupOwnership — the VS Code setup preamble and the
    release-then-close assertion tail are each stated once.
  • captureCleanup — the two "refuse before the service is reached" cases share one
    CLI harness; each still asserts its own stdout substring.

Net effect: 15807 → 15564 duplicated lines, 1480 → 1460 clones, 3.0097% → 2.9641%.

Deliberately not touched: the largest new duplication is
src/captures/TsharkCaptureProvider.ts against src/signals/SigrokRecordingProvider.ts
(15 clones, 304 lines, from #2487 and #2496). That is a cross-domain design decision for
those authors rather than a mechanical collapse, so this PR leaves it alone.

Verification

Command Result
npm run jscpd exit 0, 2.96%
npx tsc --noEmit exit 0
npx oxlint exit 0, 0 errors
npx oxfmt --check . exit 0 (3028 files)
npx knip exit 0
npm run verify:architecture-guards exit 0 (1297 source files)
npm run verify:test-discovery exit 0 (1036 test files, each discovered once)
npm run scan:todos exit 0
the five focused test files 79 passed, identical to the same command on bf34d0d2
tests/boundary/mcp/reconstructionCoverageMcp.test.ts (other consumer of the changed fixture) 1 passed

Node 26.11.1 on macOS. No file here is touched by any of the 203 currently open PRs.

Note on the threshold

This buys back headroom (≈190 duplicated lines before the gate trips again), it does
not make the gate self-maintaining. If the project would rather have a ratchet — a
committed ceiling that only ever goes down, checked in check:ci — say so and I can
look at that separately.


🔄 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/2691 **Author:** [@NIU-123370](https://github.com/NIU-123370) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `test/share-repeated-boundary-preambles` --- ### 📝 Commits (2) - [`78510c6`](https://github.com/morluto/rea/commit/78510c6d805f54a92a9fbb480140370e0bdaa58d) test: share repeated boundary preambles to restore the jscpd gate - [`781d659`](https://github.com/morluto/rea/commit/781d65922788600e767b2da9ae78f10922c384f7) chore: merge main into shared boundary test fixtures ### 📊 Changes **6 files changed** (+165 additions, -279 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/reconstructionCoverage.fixture.ts` (+10 -0) 📝 `src/domain/reconstructionCoverage.test.ts` (+26 -62) 📝 `src/native/NativeUiObservation.test.ts` (+31 -95) 📝 `tests/boundary/cli/captureCleanup.test.ts` (+36 -57) 📝 `tests/boundary/filesystem/installScript.test.ts` (+16 -21) 📝 `tests/boundary/filesystem/setupClientConfigCleanupOwnership.test.ts` (+46 -44) </details> ### 📄 Description ## Main fails its own duplicate-code gate `npm run jscpd` is the step that exits 1 inside **Static checks**, and it does so on current main, not because of any one branch. `.jscpd.json` sets `"threshold": 3.0`. Measured on this box against three trees: | Tree | Scanned files | Clones | Duplicated lines | `npm run jscpd` | | --- | --- | --- | --- | --- | | `bb540826` — base a recently green PR branch used | 2321 | 1427 | 2.98% | exit 0 | | `bf34d0d2` — current main | 2367 | 1480 | **3.0097%** | **exit 1** | | this branch | 2367 | 1460 | 2.9641% | exit 0 | The main run for `4276aaf1` already concluded `failure` at 06:58Z today on the same step, which is why open PRs such as #2486 show a `Static checks` red while their own diff contributes nothing to it. ## What this changes Five test files repeat blocks inside themselves, and one shared fixture gains the narrowing those repeats each re-state. No production code, no assertion, and no test case is added or removed: the same set of files reports **79 passed** before and after this change on this box. - `reconstructionCoverage` — one fixture helper returns the complete workspace with its first verifier result and boundary narrowed, replacing six copies of the same preamble; the two "newest observation fails" cases share one evaluation helper. - `NativeUiObservation` — one PNG payload builder and one screenshot observation call replace five literal copies. The builder reads `width`/`height` from the buffer, so each payload keeps exactly the values the copies hardcoded for these fixtures. - `installScript` — the fixture installer environment is built once and spread by the exec, pipe and PTY runs, keeping each one's `...process.env` and `...overrides` position. - `setupClientConfigCleanupOwnership` — the VS Code setup preamble and the release-then-close assertion tail are each stated once. - `captureCleanup` — the two "refuse before the service is reached" cases share one CLI harness; each still asserts its own stdout substring. Net effect: 15807 → 15564 duplicated lines, 1480 → 1460 clones, 3.0097% → 2.9641%. Deliberately **not** touched: the largest new duplication is `src/captures/TsharkCaptureProvider.ts` against `src/signals/SigrokRecordingProvider.ts` (15 clones, 304 lines, from #2487 and #2496). That is a cross-domain design decision for those authors rather than a mechanical collapse, so this PR leaves it alone. ## Verification | Command | Result | | --- | --- | | `npm run jscpd` | exit 0, 2.96% | | `npx tsc --noEmit` | exit 0 | | `npx oxlint` | exit 0, 0 errors | | `npx oxfmt --check .` | exit 0 (3028 files) | | `npx knip` | exit 0 | | `npm run verify:architecture-guards` | exit 0 (1297 source files) | | `npm run verify:test-discovery` | exit 0 (1036 test files, each discovered once) | | `npm run scan:todos` | exit 0 | | the five focused test files | 79 passed, identical to the same command on `bf34d0d2` | | `tests/boundary/mcp/reconstructionCoverageMcp.test.ts` (other consumer of the changed fixture) | 1 passed | Node 26.11.1 on macOS. No file here is touched by any of the 203 currently open PRs. ## Note on the threshold This buys back headroom (≈190 duplicated lines before the gate trips again), it does not make the gate self-maintaining. If the project would rather have a ratchet — a committed ceiling that only ever goes down, checked in `check:ci` — say so and I can look at that separately. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05:40 +00:00
bsakaguchi changed title from [PR #2691] [MERGED] test: share repeated boundary preambles to restore the jscpd gate to [PR #2691] test: share repeated boundary preambles to restore the jscpd gate 2026-11-03 13:29:18 +00:00
bsakaguchi changed title from [PR #2691] test: share repeated boundary preambles to restore the jscpd gate to [PR #2691] [MERGED] test: share repeated boundary preambles to restore the jscpd gate 2026-11-03 14:31:06 +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#5315
No description provided.