Skip to content

fix(affected): narrower pnpm-workspace.yaml selection; chain-first admission - #381

Merged
calvin-archastro merged 1 commit into
mainfrom
features/calvin-affected-scheduling
Nov 11, 2026
Merged

calvin-archastro merged 1 commit into
mainfrom
features/calvin-affected-scheduling

Conversation

@calvin-archastro

@calvin-archastro calvin-archastro commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Review on ArchCode

Problem and author intent

Two scheduling problems seen in firstlanding CI.

  1. A pnpm-workspace.yaml edit ran every Node project in full.
    • The lockfile rule in src/related/engine.rs marked every nodejs project under the file's directory with "pnpm-workspace.yaml changed; running in full".
    • That includes projects the workspace excludes, which the file can't affect.
    • pnpm-lock.yaml edits were already narrowed to the importers they change; the workspace file was not.
    • Example: firstlanding run 42439191201 only added one entry to packages:, yet it selected 112 dependents, including the 10-minute Rust e2e lane.
  2. Execution admission was a race.
    • Every ready target polled the slot locks every 20 ms, and the first poll after a slot freed won.
    • So a target gating a long chain could wait behind targets that gate nothing.

What changed

  1. pnpm-workspace rule (src/related/engine.rs, src/git/affected.rs, src/plugins/nodejs.rs):
    • The root project is always reached.
    • Only the packages: list changed → only packages whose membership changed are reached. The lockfile rule judges their importers.
    • Any other setting changed (overrides, patches, catalogs, linker, hoisting) → reached:
      • every package listed on either side;
      • unlisted projects that resolve from the root node_modules (no pnpm-workspace.yaml, pnpm-lock.yaml or node_modules of their own).
    • An unreadable packages: list reaches everything, as before.
    • Comments are stripped only where YAML does (# after whitespace, outside quotes), so a # inside a value can't hide an edit.
  2. Admission order (src/executor/admission_order.rs, admission.rs):
    • Before: whichever waiting target's poll came first after a slot freed won.
    • After: a per-invocation gate orders waiting targets by the longest chain of dependents they gate, then by request order. ReadyQueue also releases longest chain first.
    • A target blocked on an exclusive resource steps out of the line, so it can't hold up the others or deadlock with the resource's holder.
    • Other invocations on the host still compete through the OS locks.
    • Unix-only pieces are behind #[cfg(unix)].

Scope and risk

Planner and executor. Medium risk.

  • The workspace rule now selects fewer projects. The settings branch keeps every package that could resolve differently, and an unparseable file still means everything.
  • Admission changes start order, not concurrency.

User impact

Fewer targets for packages:-only workspace edits, and chain-gating targets start earlier. No CLI or config change.

Testing

  • Canonical end-to-end proofs: both drive the real aster binary.
    • a_pnpm_workspace_edit_runs_only_the_packages_it_can_reach in tests/related.rs covers packages:-only edits, settings edits, unlisted nested projects and # in values.
    • the_target_gating_the_longest_chain_takes_a_slot_before_independent_targets in tests/execution_capacity.rs runs 4 slots and 9 ready targets, with z-gate gating a chain. Against the old binary it failed 6 of 6 times, with a different random admitted set each time.
  • firstlanding, run 42439191201's diff, --related --dry-run:
    • "pnpm-workspace.yaml changed" lines: 100 → 0;
    • dependents: 112 → 20;
    • the e2e-rust lane is no longer selected.
  • Simulated clock over the real ReadyQueue (12 independent 5 s targets, a 1 s → 10 s → 10 s chain, 4 slots): 36 s → 25 s.
  • The CONTRIBUTING checks pass: fmt, clippy -D warnings, cargo doc -D warnings, and cargo test --all-targets --all-features.
  • Not proven here:
    • The Windows build was not compiled locally (the C headers it needs are missing); it rests on the cfg audit and this PR's CI.
    • CI effect in firstlanding needs a release and a pin bump.
    • Priority counts targets, not seconds, so a chain's last long target still queues in request order. Duration weighting needs per-target run times that Aster doesn't keep.

Follow-ups

Merge order: independent of the plan replay PR. Both touch src/git/affected.rs and tests/related.rs, so whichever merges second may need a rebase.

🤖 Generated with Claude Code

…gest dependent chain

A packages:-only edit to pnpm-workspace.yaml reaches the root and the packages
whose membership changed; other setting edits reach the packages that resolve
from the root. Waiting targets take free slots by the longest chain they gate,
then by request order, instead of whichever lock poll came first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@calvin-archastro
calvin-archastro requested a review from a team November 11, 2026 00:40
@calvin-archastro

calvin-archastro commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

ArchDev is watching this pull request. State: settled (cycle 1 of 1 for head b15c81c).

when trigger decision result
2026-11-11T00:52:03.018Z verify head enqueue job_feba52fc52d91bc33b7a0320 no change

Paused by the no-autofix label or a draft; never resolves reviewer threads. Jobs: job_feba52fc52d91bc33b7a0320.

@calvin-archastro
calvin-archastro merged commit 10000c8 into main Nov 11, 2026
16 checks passed
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