Skip to content

feat(go): model in-repository replace targets under root-module scope - #110

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
sarankumar1325:fix/go-scope-internal-replace
Nov 11, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
sarankumar1325:fix/go-scope-internal-replace

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Closes #81 (part of #76)

Problem

With "go": { "scope": "root-module" }, any local replace added the blocker Go root-module scope with local replacements requires full validation. So every analysis of a monorepo that uses replace example.com/x => ./x fell back to the full suite. That was true even for changes nowhere near x/.

Change (src/repo/adapters/go.ts)

  • The Go adapter now collects each package's Module.Replace.Dir. If every local replace points at a nested module root inside the repository, there is no blocker, and those roots are dropped from goExcludedModuleRoots. The replaced packages that the root build uses already appear in the go list -deps output, with Dir inside the checkout. So their files are modelled sources, and a change there selects the root packages that import them.
  • go list -json also reports TestGoFiles/XTestGoFiles for dependency packages. A replaced module's tests belong to that module and can't run as go test ./x from the root. So for packages with Module.Replace.Dir, test files, test embeds and test imports are no longer selectable tests or modelled sources. Without this, x/x_test.go was selected with test package ./x.
  • Still falls back:
    • a replace to a directory that isn't a nested module root (keeps the existing blocker)
    • a replace outside the repository (unchanged: Go local module replacement lies outside the repository)
    • edits to files of the replaced module that the root build doesn't use: its own tests and packages the root doesn't import (Go runtime inputs outside source/embed metadata …)
    • x/go.mod (the language/framework config rule)
    • nested modules that are not replaced (Changes in a Go module outside the declared root-module scope …)

I updated the reason table in docs/using-diffci.md.

Tests

New tests/repo/go-scope-local-replace.test.ts runs the real go list offline through analyzeCheckout on a temporary repository: a root module with go.scope: root-module, replace example.com/x => ./x, app/ importing example.com/x, and an unrelated other/. When go isn't installed, it skips with a reason.

  1. A change to x/x.go gives SELECTIVE, selects app/app_test.go and skips other/other_test.go, with no fallback reasons.
  2. Same as 1, with the replace target written as ./x/.
  3. A change to x/x_test.go gives FULL (runtime-inputs reason).
  4. A change in a second, non-replaced nested module legacy/ gives FULL (outside-scope reason).

Without the adapter change, all four fail: every case falls back with the old replace blocker. Registered in release-files.json.

npm test: 903 passed (Go 1.27 installed locally, so the new tests ran). npm run typecheck is clean, and so are npm run build and npm run audit:boundary.

With go.scope set, any local replace added a blocker, so every analysis
of a monorepo using replace example.com/x => ./x fell back. When every
local replace points at a nested module root inside the repository, that
module is now modelled: it is removed from goExcludedModuleRoots, and
the packages go list reports for the root build select their importers.
Tests of a replaced module are not selectable or modelled (they cannot
run from the root), so editing them, an unused package or x/go.mod still
falls back. A replace to any other directory keeps the blocker.

Closes DiffCI#81

Signed-off-by: sarankumar1325 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T08:11:39.201437Z 08ffe03 PR opened
ℹ️ 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.

@adityankale190895
adityankale190895 merged commit 76e3cbe into DiffCI:main Nov 11, 2026
11 checks passed
adityankale190895 added a commit that referenced this pull request Nov 11, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
adityankale190895 added a commit that referenced this pull request Nov 11, 2026
Engine pin moves from a50b0ef to 8b8c5f5, picking up the Core engine
changes since 0.3.38: path-literal edges and narrowed computed-load
selections, relative imports of build output followed to source, Jest
confined to its sub-package, tsd/tstyche scoped to their own tests, Go
replace targets under root-module scope, every lockfile hashed and
reported (bun.lock included), and a babel.config-only change running
every test (#105-#110, #118-#120).

Descriptions across npm, the MCP registry, plugins and the Action now
read "verification for AI coding agents".
Records the Muse marketplace digest for the 0.3.39 package tree, computed
by the pinned Muse 1.4.11-R6667.1 build from an LF archive (the same
method reproduces 0.3.38's recorded digest).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]>
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.

Follow replace directives that point inside the repository

2 participants