Skip to content

fix: fail closed for unmodeled Go runtime inputs - #36

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/go-runtime-input-safety
Oct 22, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/go-runtime-input-safety

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Summary

Close the Go runtime-input false negative left outside the previous four safety patches. A Go test calling os.ReadFile("data/settings.json") could receive an empty successful selective plan when that JSON changed outside testdata, because go list does not report arbitrary runtime reads.

  • Record the exact source and embed paths contributed by the Go adapter, separately from generic or other-language graph membership.
  • Require full validation for every changed path without that evidence, independent of its extension or directory. Check additions, deletions, copy identities, and both sides of renames, including paths absent at HEAD.
  • Traverse modeled embed relationships before generic unknown/documentation classification, preserving package and transitive-owner selection for JSON, YAML, extensionless, binary-named, and MDX assets.
  • Preserve existing discovery-excluded (testdata, hidden, underscore) and excluded-module fallback rules.
  • Fail closed for old cached Go profiles without the new ownership evidence. No cache schema bump is needed for safety: missing evidence cannot authorize a selective plan.

This is an independent patch on 9d575cef7b1dd118300cd6298c9f85a8c1a44ad8, with no dependency on PRs #32–35. It also applies cleanly to their locally validated combination.

Regression coverage

The synthetic repository contains a package reading JSON at runtime, a dependent service package, and an unrelated package. Valid synthetic go list descriptors feed the real graph builder, impact analyzer, planner, command synthesis, and graph cache.

The new suite covers 21 unmodeled filename/path variants, all relevant change identities, generic non-Go graph nodes, unchanged runtime inputs during a source-only edit, production/test/external-test embeds, nonstandard embed extensions, discovery-excluded paths, and fresh/legacy cache behavior. Unsafe cases must produce FULL, retain all discovered tests, skip none, and emit no selective command.

Run the focused suite with:

node --import tsx --test --test-concurrency=1 tests/repo/go-runtime-inputs.test.ts

Before the implementation, this suite reports 5 passing and 36 failing tests/subtests. After the implementation, all 41 pass. These counts include parent test groups, not 36 distinct bug classes.

Validation

  • Full serial test suite: 374 passed, 0 failed, 0 skipped.
  • npm run typecheck: passed.
  • npm run build: passed.
  • npm run audit:boundary: passed, including the new regression file in release-files.json.
  • git diff --check: passed.
  • Independent patch review: no blocking findings; 43 adversarial checks passed, including a Go/Maven hybrid and reuse of the same analyzer across language profiles.
  • All five patches combined: 413 tests passed, 0 failed; typecheck, build, and boundary audit passed. The final patch applies without conflicts to the original baseline and the four-patch combination.

Full serial command:

node --import tsx --test --test-concurrency=1 $(find tests -name '*.test.ts' | sort)

Limits and tradeoffs

  • Unmodeled documentation and other ordinary non-Go files now trigger full validation in Go repositories. This is intentionally conservative; filenames do not prove runtime irrelevance.
  • This does not infer arbitrary file reads from source text. Additional runtime reads of already-modeled source/embed files by unrelated packages, external inputs, and dynamically supplied inputs remain outside the model. It is not a zero-false-negative guarantee.
  • Existing Go workspace, nested-module, cgo, generated/linkname/plugin, build-context, and metadata-availability boundaries remain in force.
  • Verification used Linux Node v24.19.0 with npm 11.9.0 and synthetic Go metadata. Native Go compilation/tests were not run: the available /usr/bin/go is an unrelated board-game executable, not a Go toolchain. Node 22 and Windows were not tested locally.
  • The repository's serial Node test runner was used because the earlier default parallel run lost suite processes in this environment. Remote CI remains authoritative.

@adityankale190895

Copy link
Copy Markdown
Member

Hi @FredApps, we're relicensing DiffCI Core from AGPL-3.0-only to MIT and need your consent for this contribution. Details and the one-line consent reply are in #43. Thank you!

@adityankale190895

Copy link
Copy Markdown
Member

@FredApps thanks again for #32–#36. Those five fail-closed fixes are still what keeps DiffCI honest when it's unsure. DiffCI now covers Go, Maven and pytest too, and is growing into build and deploy decisions. If it's been useful to you, a ⭐ on the repo helps others find it. No pressure either way.

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.

2 participants