Skip to content

fix(lib): match the exact dotnet package name in debug output - #537

Merged
eduardomourar merged 1 commit into
open-constructs:mainfrom
eduardomourar:fix/commons-dotnet-package-version-match
Nov 2, 2026
Merged

eduardomourar merged 1 commit into
open-constructs:mainfrom
eduardomourar:fix/commons-dotnet-package-version-match

Conversation

@eduardomourar

Copy link
Copy Markdown
Contributor

Related issue

Fixes #31

Description

A substring match picked up prebuilt provider packages such as Io.Cdktn.Providers.Aws instead of Io.Cdktn.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

@eduardomourar
eduardomourar requested a review from a team as a code owner October 31, 2026 12:48
@eduardomourar eduardomourar changed the title fix(commons): match the exact dotnet package name in debug output fix(lib): match the exact dotnet package name in debug output Oct 31, 2026

@jsteinich jsteinich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Matching the exact token after > is the right change, and it fixes more than the title says: getPackageVersion(language, "cdktn" | "cdktf") also feeds cdktn provider add. That command passes cdktfVersion ?? cdktnVersion, so the old > HashiCorp.Cdktf substring match on HashiCorp.Cdktf.Providers.* could hand it a provider's version as the cdktf version.

I checked the new match against sample dotnet list package --include-transitive output:

  • Io.Cdktn that only appears transitively, next to a top-level Io.Cdktn.Providers.Aws: the old code returned the provider's version, the new code returns the core version.
  • The same for legacy HashiCorp.Cdktf next to HashiCorp.Cdktf.Providers.*: fixed.
  • Constructs, Amazon.JSII.Runtime, and rows with the (A) auto-reference marker: unchanged.

The one thing blocking this is a regression test; details inline. The other comments are optional.

Two nits that GitHub won't let me attach inline:

  • debug.ts:223: the comment about waiting on NuGet/Home#7752 is out of date: dotnet list package --format json shipped in .NET SDK 7.0.200. You don't need to switch here, but the comment could be updated or removed.
  • PR title: this is CLI behaviour (cdktn debug, cdktn provider add) living in @cdktn/commons. Earlier fixes to this file used fix(cli) (#280, #412), and lib is the scope for the core construct library in the changelog. Could you rename the title to fix(cli): …?

Comment thread packages/@cdktn/commons/src/debug.ts Resolved
Comment thread packages/@cdktn/commons/src/debug.ts Resolved
@eduardomourar
eduardomourar force-pushed the fix/commons-dotnet-package-version-match branch from acff5dd to 9a291e9 Compare November 1, 2026 00:35
@eduardomourar
eduardomourar force-pushed the fix/commons-dotnet-package-version-match branch from 9a291e9 to 0032da5 Compare November 1, 2026 01:40

@jsteinich jsteinich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the four tests each fail on the old substring match and pass with the fix, and the case-insensitive comparison closes the io.cdktn gap. LGTM.

@eduardomourar
eduardomourar merged commit 86293e7 into open-constructs:main Nov 2, 2026
267 checks passed
@eduardomourar
eduardomourar deleted the fix/commons-dotnet-package-version-match branch November 2, 2026 17:11
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.

cdktf/cdktn library version detection isn't accurate for dotnet

2 participants