From bc20797d061e803c87269eddc8262e9745025c42 Mon Sep 17 00:00:00 2001
From: RahulGautamSingh <rahultesnik@gmail.com>
Date: Tue, 21 Jan 2025 12:04:06 +0530
Subject: [PATCH] fix(manager/bundler): drop strict flag (#33713)

---
 lib/modules/manager/bundler/artifacts.spec.ts | 65 -------------------
 lib/modules/manager/bundler/artifacts.ts      | 32 +--------
 2 files changed, 3 insertions(+), 94 deletions(-)

diff --git a/lib/modules/manager/bundler/artifacts.spec.ts b/lib/modules/manager/bundler/artifacts.spec.ts
index ad0ee829c8..857afb0b66 100644
--- a/lib/modules/manager/bundler/artifacts.spec.ts
+++ b/lib/modules/manager/bundler/artifacts.spec.ts
@@ -679,71 +679,6 @@ describe('modules/manager/bundler/artifacts', () => {
         ]);
       });
 
-      it('handles failure of strict updating for version solving', async () => {
-        const execError = new ExecError('Exec error', {
-          cmd: '',
-          stdout: '',
-          stderr: 'version solving has failed',
-          options: { encoding: 'utf8' },
-        });
-        fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
-        const execSnapshots = mockExecSequence([
-          execError,
-          { stdout: '', stderr: '' },
-        ]);
-        git.getRepoStatus.mockResolvedValueOnce(
-          partial<StatusResult>({
-            modified: ['Gemfile.lock'],
-          }),
-        );
-
-        const res = await updateArtifacts({
-          packageFileName: 'Gemfile',
-          updatedDeps: [{ depName: 'foo', updateType: 'minor' }],
-          newPackageFileContent: '{}',
-          config,
-        });
-
-        expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]);
-        expect(execSnapshots).toMatchObject([
-          { cmd: 'bundler lock --minor --strict --update foo' },
-          { cmd: 'bundler lock --minor --conservative --update foo' },
-        ]);
-      });
-
-      it('handles failure of strict updating for missing gem', async () => {
-        // See https://github.com/rubygems/rubygems/issues/7369
-        const execError = new ExecError('Exec error', {
-          cmd: '',
-          stdout: '',
-          stderr: "Could not find gems matching 'foo ",
-          options: { encoding: 'utf8' },
-        });
-        fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
-        const execSnapshots = mockExecSequence([
-          execError,
-          { stdout: '', stderr: '' },
-        ]);
-        git.getRepoStatus.mockResolvedValueOnce(
-          partial<StatusResult>({
-            modified: ['Gemfile.lock'],
-          }),
-        );
-
-        const res = await updateArtifacts({
-          packageFileName: 'Gemfile',
-          updatedDeps: [{ depName: 'foo', updateType: 'minor' }],
-          newPackageFileContent: '{}',
-          config,
-        });
-
-        expect(res).toMatchObject([{ file: { path: 'Gemfile.lock' } }]);
-        expect(execSnapshots).toMatchObject([
-          { cmd: 'bundler lock --minor --strict --update foo' },
-          { cmd: 'bundler lock --minor --conservative --update foo' },
-        ]);
-      });
-
       it('updates the Gemfile.lock when upgrading ruby', async () => {
         // See https://github.com/renovatebot/renovate/issues/15114
         fs.readLocalFile.mockResolvedValue('Current Gemfile.lock');
diff --git a/lib/modules/manager/bundler/artifacts.ts b/lib/modules/manager/bundler/artifacts.ts
index 071bd1a652..6dd081147c 100644
--- a/lib/modules/manager/bundler/artifacts.ts
+++ b/lib/modules/manager/bundler/artifacts.ts
@@ -105,8 +105,8 @@ export async function updateArtifacts(
       }
 
       const updateTypes = {
-        patch: '--patch --strict ',
-        minor: '--minor --strict ',
+        patch: '--patch ',
+        minor: '--minor ',
         major: '',
       };
       for (const [updateType, updateArg] of Object.entries(updateTypes)) {
@@ -120,12 +120,9 @@ export async function updateArtifacts(
           additionalArgs = '--conservative ';
         }
         if (deps.length) {
-          let cmd = `bundler lock ${updateArg}${additionalArgs}--update ${deps
+          const cmd = `bundler lock ${updateArg}${additionalArgs}--update ${deps
             .map(quote)
             .join(' ')}`;
-          if (cmd.includes(' --conservative ')) {
-            cmd = cmd.replace(' --strict', '');
-          }
           commands.push(cmd);
         }
       }
@@ -226,29 +223,6 @@ export async function updateArtifacts(
       memCache.set('bundlerArtifactsError', BUNDLER_INVALID_CREDENTIALS);
       throw new Error(BUNDLER_INVALID_CREDENTIALS);
     }
-    if (
-      recursionLimit > 0 &&
-      (output.includes('version solving has failed') ||
-        output.includes('Could not find gem'))
-    ) {
-      logger.debug('Failed to lock strictly, retrying non-strict');
-      const newConfig = {
-        ...config,
-        postUpdateOptions: [
-          ...(config.postUpdateOptions ?? []),
-          'bundlerConservative',
-        ],
-      };
-      return updateArtifacts(
-        {
-          packageFileName,
-          updatedDeps,
-          newPackageFileContent,
-          config: newConfig,
-        },
-        recursionLimit - 1,
-      );
-    }
     const resolveMatches: string[] = getResolvedPackages(output).filter(
       (depName) => !updatedDepNames.includes(depName),
     );
-- 
GitLab