Skip to content

🤖 refactor: retarget tests from test-only wrappers to the functions production calls - #4487

Merged
ThomasK33 merged 1 commit into
test-audit/ws2-dead-utilsfrom
test-audit/ws2-test-only-wrappers
Sep 25, 2026
Merged

ThomasK33 merged 1 commit into
test-audit/ws2-dead-utilsfrom
test-audit/ws2-test-only-wrappers

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Deletes production wrappers that existed only so tests could call them, and points those tests at the functions production actually calls.

Changes

Wrapper (deleted) Production path Tests now call
evaluateGoalContinuation WorkspaceGoalService runs evaluateGoalContinuationBeforeGoal, loads the goal, then evaluateGoalContinuationGoal Same two stages, composed in the test the way the service does
7 memory Promise facades (listMemory … consolidateMemory) router.ts yields the *Effect functions via handlerGen Effect.runPromise(<name>Effect(...))
buildSystemMessage, readToolInstructions Since #4432, turnContextAssembler loads sources once, then buildSystemMessageFromSources/extractToolInstructionsFromSources Test helpers that run that same load-then-derive sequence; the composition doc moved onto buildSystemMessageFromSources
hasInterruptedStream, isEligibleForAutoRetry StreamingMessageAggregator/ChatPane read getInterruptionContext(...) getInterruptionContext(...).<field> (incl. one browser test file, mechanical)
scanHistoryRows historyReplacementRows opens its own handle and calls scanHistoryRowsFromHandle Path helper moved to historyRowScanner.testHarness.ts (excluded from the main build). "observes cancellation during file disposal" tested only the wrapper's own dispose path and is deleted

Comments that pointed at buildSystemMessage now name buildSystemMessageFromSources.

Validation

bun test for goalContinuationPolicy, memoryOperations, systemMessage, retryEligibility, StreamingMessageAggregator.tokenBudget, historyRowScanner, historyMessageEvidence, historyScalarEvidence, historyReplacementRows; make static-check.

Stack: 5/5.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $4.45

@ThomasK33
ThomasK33 added this pull request to stack #4488 September 25, 2026 08:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

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 ✅ Completed 2026-09-25T11:02:13.906838Z dbab755 New commits
🔒 Security Review ✅ Completed 2026-09-25T11:02:54.928945Z dbab755 New commits
ℹ️ 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.

@ThomasK33 ThomasK33 changed the title refactor: retarget tests from test-only wrappers to the functions production calls 🤖 refactor: retarget tests from test-only wrappers to the functions production calls Sep 25, 2026
@ThomasK33
ThomasK33 force-pushed the test-audit/ws2-test-only-wrappers branch from da212d3 to 97ffb7d Compare September 25, 2026 09:11
@ThomasK33
ThomasK33 added this pull request to the merge queue Sep 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Sep 25, 2026
@ThomasK33
ThomasK33 added this pull request to the merge queue Sep 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Sep 25, 2026
@ThomasK33
ThomasK33 force-pushed the test-audit/ws2-test-only-wrappers branch from 97ffb7d to cae4be7 Compare September 25, 2026 10:39
@ThomasK33
ThomasK33 force-pushed the test-audit/ws2-test-only-wrappers branch from cae4be7 to dbab755 Compare September 25, 2026 10:59
@ThomasK33
ThomasK33 added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit 2f38f52 Sep 25, 2026
60 of 78 checks passed
@ThomasK33
ThomasK33 deleted the test-audit/ws2-test-only-wrappers branch September 25, 2026 11:49
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 25, 2026
…ervice context tests (coder#4530)

## Summary

Makes `WorkflowService.context.test.ts` independent of test order by
resetting the process-global workflow archive admission guard before
each test. Test-only.

## Background

`WorkspaceService`'s constructor installs a module-level guard with
`setWorkflowArchiveAdmissionGuard` that calls
`this.config.loadConfigOrDefault()`. Since coder#4475 split
`workspaceService.test.ts`, the split files can land in the same bun
unit shard as `WorkflowService.context.test.ts`. When one runs first
with a partial config double, the leftover guard throws
`this.config.loadConfigOrDefault is not a function` inside every
workflow start/resume, and 9 context tests fail.

Reproduced on current `main` (7c133d0) with one process:

```
bun test ./src/node/services/workspaceService.archive.test.ts ./src/node/services/workspaceService.bashAndFiles.test.ts ./src/node/services/workflows/WorkflowService.context.test.ts
```

Main's own CI passes only because shard balancing currently keeps those
files apart. The WS2 test-audit stack (coder#4483–coder#4487) removes test files,
which reshuffles the shards, and its merge groups failed `Test / Unit
(4/6)` on exactly these tests.

## Implementation

`beforeEach` resets the guard to admit everything, the same reset
`WorkflowService.test.ts` already uses. The underlying leak (every
`WorkspaceService` instance overwrites a process-global guard and never
unregisters it) belongs to the WorkspaceService owner and is reported to
that workstream rather than redesigned here.

## Validation

The reproduction command above: 9 failures before, 102 pass after. `bun
test src/node/services/workflows/` passes.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$4.45`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=4.45 -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Sep 25, 2026
…on sets, assisted matchers, workflow transitions) (coder#4483)

## Summary

Removes four production exports that only tests called, from the
test-audit follow-up campaign (WS2, crosscutting candidates coder#1–coder#4).
Behavior-preserving: no production caller changes.

## Removed

| Symbol | Why it was dead | Tests |
| --- | --- | --- |
| `isCopilotRoutableModel` (`copilot/modelRouting.ts`) | Always returned
`true`; no caller since coder#3104 | 2 tests restating the constant deleted |
| `gatherInstructionSets` (`instructionFiles.ts`) | No caller since
coder#439; `systemMessage.ts` calls `readInstructionSet` directly | 4 tests
deleted; `readInstructionSet` tests already cover null, local files,
scope and `projectName` |
| `findAssistedMatch`, `hunkMatchesAssisted` (`assistedReview.ts`) |
Replaced by the `*Candidate*` versions in coder#3370; only tests called them
| Range overlap, deletion fallback (old-side span), rename (`oldPath`),
first-match index and no-match cases moved onto
`findAssistedCandidateMatch`, the function `ReviewPanel` calls.
`hunkMatchesAssistedCandidate` is now module-private |
| `WorkflowRunStatusTransitionSchema` + its table
(`orpc/schemas/workflow.ts`) | Never enforced; coder#4089 kept it only
because a test imported it. Real enforcement lives in
`WorkflowService`/`WorkflowRunStore` (tested in
`WorkflowRunStore.test.ts`) and follows different rules | "rejects
impossible status transitions" deleted |

## Validation

- Mutation check: disabling the deletion fallback and the `oldPath`
match in `hunkMatchesPathAndRange` fails the two moved tests.
- `bun test src/common/utils/review/ src/common/utils/copilot/
src/node/utils/main/instructionFiles.test.ts
src/common/orpc/schemas/workflow.test.ts
src/node/services/tools/review_pane.test.ts`
- `make static-check` on the stack top.

Stack: 1/5 (coder#4483 → coder#4484 → coder#4485 → coder#4486 → coder#4487).
---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$4.45`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=4.45 -->
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