fix: support AL 18 flat VSIX bin layout for marketplace/bc-artifact TFM detection - #7
Merged
Merged
Conversation
…FM detection AL Language 18.0.2668733 moved Microsoft.Dynamics.Nav.CodeAnalysis.dll from extension/bin/Analyzers/ to a flat extension/bin/, which made `detect-tfm marketplace prerelease` fail with "Entry not found in ZIP: extension/bin/Analyzers/Microsoft.Dynamics.Nav.CodeAnalysis.dll". Replace the single hard-coded VSIX path with VSIX_DLL_PATH_CANDIDATES and probe the flat AL 18+ layout first, falling back to the legacy AL <= 17 path. The order is unambiguous: legacy VSIXs never place the DLL directly in extension/bin/. - add extractRemoteZipFirstEntry / extractZipFirstEntryFromBuffer, which read the central directory once and return the first matching candidate plus its path - marketplace detection reports an actionable error when no candidate matches, pointing at --detect-from nuget-devtools / --tfm; transport failures still surface as themselves - bc-artifact detection is fixed implicitly via detectTfmFromVsixBuffer - VSIX_DLL_PATH stays exported as a deprecated alias for the legacy path Refs: ALCops/azure-devops-extension#47 Refs: ALCops/Analyzers#442 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The layout details are already covered in the "AL 18 / BC 29 notes" section. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
detect-tfm marketplace prerelease(andALCopsDownloadAnalyzers@1withdetectFrom: marketplace) fails on AL Language 18.0.2668733 with:The DLL is still bundled in the VSIX — it moved. Verified against the real artifacts:
Microsoft.Dynamics.Nav.CodeAnalysis.dllextension/bin/Analyzers/(+ copies underbin/win32|linux|darwin)extension/bin/flat, noAnalyzers/, no platform folderstools/net8.0/any/andtools/net10.0/any/So this is a path fix, not a TFM mismatch.
src/types.tshard-coded the legacy path, used by both the marketplace detector (remote HTTP-Range extraction) anddetectTfmFromVsixBuffer(used by the bc-artifact VSIX fallbacks).Fix
VSIX_DLL_PATH_CANDIDATESreplaces the single constant: flatextension/bin/first (AL 18+ / BC 29), legacyextension/bin/Analyzers/second. The order is unambiguous — legacy VSIXs never place the DLL directly inextension/bin/.VSIX_DLL_PATHremains exported as a@deprecatedalias for the legacy path, so the public API stays source-compatible.extractRemoteZipFirstEntry(url, entryPaths, logger)(src/http-range.ts) andextractZipFirstEntryFromBuffer(zipBuffer, entryPaths, logger)(src/zip-local.ts): read the central directory once, probe candidates in order with exact path matching, return{ buffer, entryPath }. On a miss they throw... Probed: <a>, <b>. The existing single-path functions keep their current behaviour and error messages (including the basename fallback) and now share the central-directory helper.detectTfmFromVsixBufferanddetectFromMarketplaceuse the candidate list and log which layout matched (flat (AL 18+)/legacy (AL <= 17)).--detect-from nuget-devtools/--tfm. Only a genuine layout miss is wrapped — transport failures (TLS, HTTP) propagate unchanged rather than being reported as a missing DLL.src/detectors/bc-artifact.tsneeded no change: its VSIX fallbacks go throughdetectTfmFromVsixBuffer.src/index.ts:VSIX_DLL_PATH_CANDIDATES,describeVsixLayout,extractRemoteZipFirstEntry,extractZipFirstEntryFromBuffer.compiler-path/--tfmwhen building with the net8.0 toolset).Verification
npm run lint,npm run buildandnpm run bundleall pass.npm test: 206 passed (17 files), up from 189 — 17 new tests, none weakened:tests/shared/zip-local.test.tsandtests/shared/http-range.test.ts: flat-only, legacy-only, both-present (flat wins), neither (error lists both probed paths), and no basename fallback for candidate probing. The http-range suite serves a realfflate.zipSyncZIP over the mockedhttpslayer and asserts the central-directory range is requested exactly once.tests/shared/vsix-tfm.e2e.test.ts(new, unmocked): packs the realtests/fixtures/compiler-net80CodeAnalysis DLL into both layouts and assertsnet8.0/ assembly version17.0.0.0from each, plus the both-paths-probed error.tests/detectors/marketplace.test.ts: updated to the candidate call shape, plus the actionable-error case (asserts it mentionsnuget-devtools) and a case proving transport errors are not relabelled.Manual smoke check against the live marketplace (
node dist/cli.js):Both layouts resolve correctly against the real CDN artifacts.
Follow-ups (deliberately out of scope)
latest/previewrouter vscurrent/prereleasemarketplace vslatest/prereleaseALCops version).resolveDetectSourcedoc comment and README promise local-path →compiler-pathrouting that does not exist (src/resolve-detect-source.ts:16-23).detectFromMarketplacereportssource: 'vs-marketplace'while theDetectSourcetype says'marketplace'.Refs ALCops/azure-devops-extension#47, ALCops/Analyzers discussion #442.
🤖 Generated with Claude Code