Repository navigation
feat(version-manager): add side-effect-free version resolution - #1290
Conversation
There was a problem hiding this comment.
1 issue found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/generator-cli/src/app/services/config.service.spec.ts">
<violation number="1" location="apps/generator-cli/src/app/services/config.service.spec.ts:72">
P2: This regression test does not cover the absent-config case: its setup always returns an existing configuration object. Add a case with `fs.readJSONSync.mockReturnValue(undefined)` and assert that `ensureFileSync` and the write methods remain unused, so a missing `openapitools.json` cannot regress to being created.</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
| }); | ||
|
|
||
| it('ensures the config file', () => { | ||
| it('does not create or modify the config file', () => { |
There was a problem hiding this comment.
P2: This regression test does not cover the absent-config case: its setup always returns an existing configuration object. Add a case with fs.readJSONSync.mockReturnValue(undefined) and assert that ensureFileSync and the write methods remain unused, so a missing openapitools.json cannot regress to being created.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/generator-cli/src/app/services/config.service.spec.ts, line 72:
<comment>This regression test does not cover the absent-config case: its setup always returns an existing configuration object. Add a case with `fs.readJSONSync.mockReturnValue(undefined)` and assert that `ensureFileSync` and the write methods remain unused, so a missing `openapitools.json` cannot regress to being created.</comment>
<file context>
@@ -69,12 +69,10 @@ describe('ConfigService', () => {
});
- it('ensures the config file', () => {
+ it('does not create or modify the config file', () => {
fixture.get('some-path');
- expect(fs.ensureFileSync).toHaveBeenNthCalledWith(
</file context>
There was a problem hiding this comment.
Fixed in d7f0e8f. The tests now cover an absent configuration (readJSONSync returns undefined) and verify that no file creation or write occurs.
There was a problem hiding this comment.
1 issue found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/generator-cli/src/app/controllers/version-manager.controller.ts">
<violation number="1" location="apps/generator-cli/src/app/controllers/version-manager.controller.ts:111">
P2: This edit lands in `set`, not `resolve`. `set`'s no-match message now goes to stderr, a behavior change nobody asked for, and the `set` spec still expects `log`, so it will fail. Revert this line to `this.logger.log(`; `resolve` already uses `logger.error`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| return; | ||
| } | ||
|
|
||
| this.logger.error( |
There was a problem hiding this comment.
P2: This edit lands in set, not resolve. set's no-match message now goes to stderr, a behavior change nobody asked for, and the set spec still expects log, so it will fail. Revert this line to this.logger.log(; resolve already uses logger.error.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/generator-cli/src/app/controllers/version-manager.controller.ts, line 111:
<comment>This edit lands in `set`, not `resolve`. `set`'s no-match message now goes to stderr, a behavior change nobody asked for, and the `set` spec still expects `log`, so it will fail. Revert this line to `this.logger.log(`; `resolve` already uses `logger.error`.</comment>
<file context>
@@ -108,7 +108,7 @@ export class VersionManagerController {
}
- this.logger.log(
+ this.logger.error(
chalk.red(
`Unable to find version matching criteria "${versionTags.join(' ')}"`,
</file context>
| this.logger.error( | |
| this.logger.log( |
There was a problem hiding this comment.
This appears to be stale or misattributed. In the current code, set still uses logger.log, while only resolve uses logger.error, so no further change is needed.
|
thanks for the PR let's give it a try |
|
🎉 This PR is included in version 2.42.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
version-manager resolve <versionTags...>to print the highest matching version.openapitools.jsonis not created or modified.Testing
yarn lintyarn testyarn buildversion-manager resolve latestprints7.26.0without creating a config file or JAR.Fixes #1289
Summary by cubic
Adds a side-effect-free
resolvesubcommand toversion-managerthat prints the highest matching version, fixing #1289. Resolution now fails with a non-zero exit code when no version matches the given tags.version-manager resolve <versionTags...>prints the first matching version and skips generator bootstrap, downloads, and config writes; unmatched tags print an error to stderr and exit non-zero.--openapitoolsare skipped and it is not confused with pass-through arguments.ConfigServiceno longer creates or modifiesopenapitools.jsonwhen reading configuration—the file is only touched on writes.Written for commit 305bb54. Summary will update on new commits.