[patch] Fix build: restore failure, SDK analyzer errors, Spectre.Console API break - #105
Merged
Merged
Conversation
…ole API break The build failed at restore, which masked three further layers of breakage. NU1506 duplicate PackageVersion: global.json pins MSTest.Sdk 4.3.3, which injects its own PackageVersion items for MSTest.TestAdapter, MSTest.TestFramework and Microsoft.Testing.Extensions.CodeCoverage under central package management. Directory.Packages.props declared the same three at older versions. Removed ours so the SDK owns them. ktsu.Sdk 2.16.1 analyzers: the bump from 2.15.0 enabled two rules that had never run here. KTSU0005 flagged 11 orphaned PackageVersion entries, now removed. KTSU0006 flagged types used from packages that only arrived transitively, so explicit PackageReference entries were added for Spectre.Console.Ansi, ktsu.Semantics.Strings, ktsu.Semantics.Paths, SixLabors.ImageSharp, Microsoft.Extensions.DependencyInjection.Abstractions and ktsu.AppDataStorage. Spectre.Console API break: Spectre.Console was bumped 0.55 -> 0.57 while Spectre.Console.Cli stayed at 0.55.0. In that pairing AsyncCommand<T>.ExecuteAsync and Command<T>.Execute are protected and take a CancellationToken, but all 28 command classes still had the old public two-argument signature. Updated them all and threaded the token into ScanAsync, AskAsync and ConfirmAsync. Code quality rules as errors: with compilation finally reaching these projects, CA2007, CA1849, CA2016, CA1806, CA1002, IDE0005 and IDE0060 fired. Fixed at source rather than suppressed. Note CA1002 changed MergeHistorySettings.Entries from List<T> to Collection<T>; that type is persisted as JSON, and round-trips correctly. Build is clean with 0 warnings and all 43 tests pass.
|
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.




Summary
dotnet buildfailed at restore onmain. Fixing that exposed three further layers of breakage that the early failure had been masking. All four problems were pre-existing; none were introduced by this branch.Build is now clean with 0 warnings, and all 43 tests pass.
What was broken
1. Restore failure (NU1506)
global.jsonpinsMSTest.Sdk4.3.3, which injects its ownPackageVersionitems forMSTest.TestAdapter,MSTest.TestFramework, andMicrosoft.Testing.Extensions.CodeCoveragewhen central package management is on.Directory.Packages.propsdeclared those same three at older versions, so NuGet saw duplicates and failed the restore.Removed ours and left the SDK to own them, with a comment recording why they must not come back.
2. New
ktsu.Sdk2.16.1 analyzersThe recent bump from 2.15.0 brought two rules that had never run against this repo:
PackageVersionentries. Removed.PackageReferenceentries forSpectre.Console.Ansi,ktsu.Semantics.Strings,ktsu.Semantics.Paths,SixLabors.ImageSharp,Microsoft.Extensions.DependencyInjection.Abstractions, andktsu.AppDataStorage.3. Spectre.Console API break
Dependabot bumped
Spectre.Console0.55 → 0.56 → 0.57 whileSpectre.Console.Clistayed at 0.55.0. In that pairing,AsyncCommand<T>.ExecuteAsyncandCommand<T>.Executeareprotectedand take aCancellationToken, but all 28 command classes still had the oldpublictwo-argument signature.Updated every command, and threaded the token through to
ScanAsync,AskAsync, andConfirmAsyncwhere the analyzers flagged it.4. Code quality rules as errors
With compilation finally reaching these projects,
CA2007,CA1849,CA2016,CA1806,CA1002,IDE0005, andIDE0060fired. Fixed at source rather than suppressed.Worth a closer look during review
MergeHistorySettings.Entrieschanged fromList<T>toCollection<T>for CA1002. That type is persisted as JSON, so it is a serialization surface. It round-trips correctly and the history tests pass, but it is the one change here with a data shape attached to it.MergeCommandgained an unreachable guard. CA1806 objected to a discardedTryParseresult.Settings.Validate()already rejects unknown diff styles, so the new branch cannot be hit in practice. I mirrored the existing check in the batch branch rather than discarding the result, and marked it as belt-and-braces in a comment.Follow-up not in this PR
Spectre.Console.Cliat 0.55.0 againstSpectre.Console0.57.0 is the version skew that caused problem 3. It compiles now, but that pairing is worth aligning if a matching Cli release exists.Two unrelated items were left out of this branch, both still sitting dirty in the working tree:
icon.pnghas shrunk from 16,069 bytes to 130, which looks like a truncated or corrupted file rather than an intentional edit.dev/null/directory containing git hooks, the Windows artifact of a script redirecting to/dev/nullin a non-POSIX shell. Probably wants a.gitignoreentry.🤖 Generated with Claude Code