Skip to content

[heft] Validate plugin parameters before cleaning or watching - #6202

Open
Yashwanth Reddy Verupaka (yashwanth195) wants to merge 2 commits into
microsoft:mainfrom
yashwanth195:user/yverupaka/heft-parameter-preflight
Open

Yashwanth Reddy Verupaka (yashwanth195) wants to merge 2 commits into
microsoft:mainfrom
yashwanth195:user/yverupaka/heft-parameter-preflight

Conversation

@yashwanth195

@yashwanth195 Yashwanth Reddy Verupaka (yashwanth195) commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow Heft plugins to declare parameters incompatible with cleaning or watch mode. Reject those combinations before lifecycle hooks, plugin application, output deletion, or watch startup.

Details

  • Add optional allowWithClean and allowInWatchMode metadata to all seven plugin parameter kinds.
  • Validate parsed effective values, including configured defaults, scoped names, short names, and alias defaults. True flags, nonempty lists, and defined scalars are active, including 0 and empty strings.
  • Restrictions are opt-in: omitted or true metadata preserves existing behavior, as does the standalone clean command. Validation runs once before action startup.

This is a standalone change based directly on main. It contains no plugin-selection or sharding changes and requires no other PR. The build produced no public API report changes.

The CI follow-up also replaces a timing-dependent daemon test with the existing deferred-write integration-test pattern and a fake-timer unit regression. This checks write-completion ordering and idle-to-active tracking without relying on real-time deadlines or socket buffer sizes; daemon production code is unchanged.

How it was tested

Windows, Node.js 24.22.1, repository Rush 5.182.0. All checks used this branch's own build outputs.

Command Result
node common\scripts\install-run-rush.js build --to @rushstack/heft Passed: 17 successful operations, 2 no-ops; includes TypeScript, lint, and API extraction.
From apps\heft: node ..\..\common\scripts\install-run-rushx.js _phase:test --test-path-pattern Parameter --disable-code-coverage Passed: 2 suites, 78 tests.
node common\scripts\install-run-rush.js build --to @rushstack/rush-daemon Passed: 28 successful operations, 17 restored from cache, 4 no-ops; includes TypeScript, lint, and API extraction.
From libraries\rush-daemon: node ..\..\common\scripts\install-run-rushx.js _phase:test --find-related-tests lib-commonjs\test\ConnectingClientTracker.test.js --find-related-tests lib-commonjs\test\DaemonRequestWirePhased.test.js --disable-code-coverage Passed: 2 suites, 18 tests.
node common\scripts\install-run-rush.js prettier Passed on the scoped staged changes.
node common\scripts\install-run-rush.js change --verify --target-branch upstream/main Passed.
git diff --cached --check and git diff --check Passed.

The 68 parameter-manager tests cover every parameter kind, schema validation, inactive values, independent clean/watch restrictions, defaults, aliases, and scoped collisions. The 10 CLI tests launch the built Heft executable and verify preserved output sentinels, absent lifecycle/task markers, and immediate watch rejection, plus successful normal cleaning and unrestricted execution.

For the daemon follow-up, all 10 tracker unit tests and 8 phased-request wire integration tests passed. The new cases assert the delayed send completes before the daemon refreshes activity, and use fake timers to verify the idle-to-active transition. Existing Heft validation was reused rather than rerunning unchanged suites.

Impacted documentation

The schema descriptions and TypeScript metadata documentation explain the opt-in behavior and effective-value rules. No heft-plugin.json init template exists in this repository. The CLI documentation can mention the preflight behavior: https://heft.rushstack.io/pages/intro/cli/

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant