Remove enable_corepack_for_npm_and_yarn feature flag#14377
Conversation
fd53d1c to
794d4a6
Compare
|
@copilot fix the lint and npm_and_yarn ci failures |
Fixed the lint failure in e49c83a — removed the now-unnecessary For the npm_and_yarn CI failures: I've analyzed the 25 test failures in detail. The code paths are identical before and after this change — the experiment was always mocked to |
…and test code Co-authored-by: pavera <660677+pavera@users.noreply.github.com>
…odLength disable directives Co-authored-by: pavera <660677+pavera@users.noreply.github.com>
e49c83a to
089787a
Compare
|
@copilot use the github mcp to check the issues in https://github.com/dependabot/dependabot-core/actions/runs/22778967801/job/66079502447?pr=14377. Pay attention to the changes made in this branch and how they may have impacting these previously passing tests. |
…code only Keep test mocks in place to avoid any subtle RSpec stubbing interaction issues. The mocks are harmless since production code no longer checks the flag - they simply stub a method call that never happens. Co-authored-by: markhallen <420873+markhallen@users.noreply.github.com>
Investigated the CI failures in detail using the GitHub MCP tools. All 12 consistent failures (PNPM lockfile format, Yarn berry, npm 8) appeared across all 3 CI runs on this branch. After thorough analysis, I couldn't find a functional difference between the experiment-enabled code path (which tests used on main) and my flag-removed code path — they're identical. However, to resolve the failures, I reverted all test file changes in This approach should produce identical CI behavior to main since the test setup is unchanged. |
Wow! |
…nd_yarn tests Replace all allow(Dependabot::Experiments).to receive(:enabled?).with(:flag) stubs with direct Dependabot::Experiments.register(:flag, val) calls to avoid partial double issues. Collapse duplicate context blocks in helpers_spec.rb that tested both enabled/disabled states of the removed flag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Properly fixed in |
What are you trying to accomplish?
Remove the
enable_corepack_for_npm_and_yarnfeature flag, making corepack-based command execution the permanent code path.Anything you want to highlight for special attention from reviewers?
Production code (3 files):
helpers.rb:run_npm_command,run_pnpm_command,run_single_yarn_commandnow unconditionally usepackage_manager_run_command(corepack). Removed directnpm/yarn/pnpmshell invocation fallbacks.package_manager.rb:setup: Consolidated to alwaysrequested_version(name) || guessed_version(name)and install. The old path had special-cased pnpm-only installs for guessed versions. Removed now-unnecessaryMetrics/AbcSizeandMetrics/MethodLengthrubocop disable directives since the method is simpler.install: Always delegates toHelpers.install. Removed duplicatecorepack installshell command path.version_resolver.rb:corepack_registry_override_envno longer early-returns — registry override always applies.Test code (11 files):
let(:enable_corepack_for_npm_and_yarn)and associatedallow(Dependabot::Experiments).to receive(:enabled?).with(:enable_corepack_for_npm_and_yarn)mocks.allow(Dependabot::Experiments).to receive(:enabled?).with(:flag).and_return(val)stubs with directDependabot::Experiments.register(:flag, val)calls. This avoids RSpec partial double side effects — with partial doubles,allow().with()passes unmatched arguments through to the original method, so removing one.with()constraint changed behavior for allExperiments.enabled?calls in the code path, causing 12 consistent CI failures (PNPM lockfile format, Yarn berry running v1, npm 8 peer dependencies). UsingExperiments.registersets values directly without creating method doubles.helpers_spec.rbforparse_npm8?— both had identical assertions since the flag was never checked in that method.How will you know you've accomplished your goal?
Zero remaining references to
enable_corepack_for_npm_and_yarnin the codebase (production and test code). Existing test suite validates that the corepack path (previously the "enabled" path) continues to work correctly. Linter passes with no offenses.Checklist
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.