Skip to content

[maestro] Treat unguarded Rust test modules as package-impacting#798

Closed
haasonsaas wants to merge 3 commits into
mainfrom
guardrail/604-release-train-drift
Closed

[maestro] Treat unguarded Rust test modules as package-impacting#798
haasonsaas wants to merge 3 commits into
mainfrom
guardrail/604-release-train-drift

Conversation

@haasonsaas

Copy link
Copy Markdown
Contributor

Summary

Guardrail for #604 (release-train-drift).

stripRustTestModules in scripts/release-impact-filter.mjs stripped every inline mod tests { } block regardless of whether it was gated by #[cfg(test)]. An unguarded mod tests block is compiled in production builds, so edits inside it are package-impacting — but they were dropped from the release diff, letting packageChangedSinceTag return false and a tag mismatch pass without the required version bump.

This is the representative feedback shape from PR #601: "Treat unguarded Rust test modules as package-impacting."

Change

  • Root-cause fix: stripRustTestModules now collects the contiguous outer-attribute group preceding mod tests and only strips the module when a #[cfg(test)] attribute is present. Unguarded modules are retained in production content, so edits inside them remain package-impacting.
  • Regression tests (test/scripts/release-impact-filter.test.ts):
    • unguarded inline mod tests { } edit → packageChangedSinceTag is true
    • #[cfg(test)]-gated inline mod tests { } edit → still false (test-only path preserved)
  • Guardrail registry: adds the release-train-drift entry to scripts/guardrail-regression-suite.json, pointing at the fix and its tests.

Acceptance (#604)

  • A repo-local guardrail fails for the representative feedback shape (the unguarded-inline test fails without the fix, passes with it).
  • Wired into the smallest relevant test target — test/scripts/release-impact-filter.test.ts, run by ci-nx-tests.sh / Nx maestro:test.
  • Sentinel re-scan reports the release-train-drift fingerprint closed/absent (happens after merge).

Verification

  • bunx vitest --run test/scripts/release-impact-filter.test.ts — 18 passed
  • bunx vitest --run test/scripts/ci-guardrails.test.ts — 67 passed (manifest evaluation)
  • node scripts/check-guardrail-regression-suite.mjs — covers 12 bug classes
  • bun run bun:lint — clean (exit 0)

Closes #604.

…acting

stripRustTestModules stripped every inline `mod tests { }` block regardless
of #[cfg(test)], so edits inside an unguarded inline test module were dropped
from the release diff and packageChangedSinceTag could return false even
though compiled package sources changed. Gate stripping on a preceding
#[cfg(test)] attribute so only test-only modules are stripped; unguarded
modules stay package-impacting and force the required version bump.

Adds inline regression coverage (unguarded = impacting, cfg(test)-gated =
ignored) and registers the release-train-drift guardrail in the regression
suite manifest.

Refs #604
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cursor

cursor Bot commented Jun 20, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes release/version-bump detection logic for Rust packages; incorrect gating could either miss real releases or force unnecessary bumps.

Overview
Fixes release train drift where edits inside an unguarded inline mod tests { } were stripped from release diffs and could let packageChangedSinceTag return false without a required version bump.

stripRustTestModules now inspects the contiguous #[...] attribute group immediately above mod tests and strips the module only when #[cfg(test)] is present. Unguarded mod tests bodies stay in rustProductionContent, so those edits count as package-impacting. #[cfg(test)]-gated inline modules (including when separated from mod tests by comments or blank lines) still strip as test-only.

Adds regression coverage in release-impact-filter.test.ts and a release-train-drift entry in guardrail-regression-suite.json.

Reviewed by Cursor Bugbot for commit 72d72bf. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

This PR changes mirrored Maestro source files in the public repo, but it does not link the matching private source-of-truth PR.

Add one of these to the PR body, then re-run the check:

  • https://github.com/evalops/maestro-internal/pull/<number>
  • evalops/maestro-internal#<number>
  • maestro-internal#<number>

Mirrored files touched:

  • scripts/guardrail-regression-suite.json
  • scripts/release-impact-filter.mjs
  • test/scripts/release-impact-filter.test.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Cfg test gate skips blank lines
    • Updated Rust test-module stripping to keep #[cfg(test)] gates across blank/comment gaps and added a regression test for separated inline modules.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 41a6c2a. Configure here.

Comment thread scripts/release-impact-filter.mjs
@haasonsaas

Copy link
Copy Markdown
Contributor Author

Closing as superseded. This change landed in the source-of-truth repo (evalops/maestro-internal) via maestro-internal#2829 and is propagating to public through the generated sync PR #797.

Direct public edits to mirrored files get overwritten by the mirror sync (prepare-public-release-mirror.mjs copies them verbatim from internal), so the durable path is internal-first — which is what #797 now carries (the release-impact-filter.mjs fix, the two regression tests, and the release-train-drift guardrail-suite entry).

@haasonsaas haasonsaas closed this Jun 20, 2026
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.

[codex] Guardrail candidate: Release train drift (release-train-drift)

2 participants