Stop reading the tool manifest from .config/dotnet-tools.json - #394
Conversation
The .NET 10 SDK creates the tool manifest as `dotnet-tools.json` in the repository root, and `bv` read `.config/dotnet-tools.json` alone. With a root manifest, `dotnet bv` never delegated, `bv self-update` reported the `bv` pin as added on every run, and `bv dependencies` listed no tool. `bv` fails on `.config/dotnet-tools.json` instead of ignoring it, because the dotnet CLI writes bv's pin into whichever file exists. `bv self-update` creates a missing manifest with `dotnet new tool-manifest` and names it with `--tool-manifest`, because the dotnet CLI picks a new manifest's directory by its own markers. Those markers can select an ancestor of the home directory. `bv dependencies` reads every `dotnet-tools.json` under the home directory, as it reads every project file. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@claude Please review this pull request. |
|
Claude finished @rdeago's task in 7m 36s —— View job Review
Two findings block. One premise I could not check from here, because this environment has no Blocking1. A
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #394 +/- ##
==========================================
+ Coverage 82.73% 82.83% +0.10%
==========================================
Files 278 278
Lines 8263 8314 +51
Branches 1606 1618 +12
==========================================
+ Hits 6836 6887 +51
Misses 1151 1151
Partials 276 276 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`ToolPinReader` skipped the `bv` entry of every tool manifest, on the ground that `bv self-update` moves it. `bv self-update` moves the entry of the home directory's manifest alone. A `bv` entry in a subdirectory manifest was therefore listed by nothing and moved by nothing. Delegation reads the home directory's manifest alone as well, so a `bv` entry elsewhere takes no part in the lockstep of the family. `bv dependencies` manages such an entry as a tool pin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`ToolPinReader.Read` parsed each tool manifest as the repository walk found it, and reported the manifests under `.config` after the walk. A repository with a manifest under `.config` and an unparseable one heard about the parse error alone. The walk collects both lists first, and the parse starts after the `.config` check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`ToolManifest.LegacyManifestError` proposed `git mv .config/dotnet-tools.json dotnet-tools.json` whatever the state of the destination. When both files exist, `git mv` refuses with "destination exists". That case is the one the failure exists for. The dotnet CLI reads the two files as one manifest, and writes the `bv` pin into the one under `.config`. When the destination exists, the message asks for a merge into it, and names the move otherwise. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`ToolManifest.RelativePath` and `ToolManifest.FileName` held one string, because the home directory's manifest is a file of that name in the home directory. Two names for one value invite the wrong one at the next call site. `FileName` reads right at every site, so `RelativePath` goes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`SelfVersionService.PinToolManifestAsync` ran `dotnet new tool-manifest` and passed the home directory's `dotnet-tools.json` to `dotnet tool install` without checking that the template had written it. The template writes the file in the working directory from the .NET SDK 10 on. Were a later SDK to write it under `.config` again, the install would fail on the missing path. The next `bv` run would then refuse the stray file. The check after the template run reports the missing file in one message, before the install. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
`docs/directory-structure.md` said `bv` stops when the home directory or a directory under it holds `.config/dotnet-tools.json`, and the changelog bullet said "when a repository holds one". `ToolManifest.EnsureNoLegacyManifest` tests the home directory alone. `ToolPinReader` is the one reader that walks the tree, and only the `tools` scope of `bv dependencies` runs it. The page and the bullet state the two reaches. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Round 1 addressed, in six commits. 1. A 2. Reach of the Question. Non-blocking.
@claude Please review the new commits. Items 1, 3, and 4 change behavior. |
|
Claude finished @rdeago's task in 3m 52s —— View job Review, round 2
No blocking findingsNon-blockingOne shape, three sites.
The code is right at all three sites. The comments and the page are what say otherwise. Fix this → |
The remarks of `BuildvanaFamily`, `DependencyPin`, and `DirectivePinReader` said that a family id never has a pin `bv dependencies` manages. A comment in `DependencyResolver`, one in `DependencyResolverTests`, the BV1203 entry of `docs/tool-diagnostics.md`, and the "Moving a pin past its policy" section of `docs/tool-commands/dependencies.md` said the same. `ToolPinReader` reads the `bv` entry of a tool manifest below the home directory as a tool pin. `bv self-update` moves the entry of the home directory's manifest alone, so nothing else would move such an entry. Each statement names that exception. The remark of `BuildvanaFamily` also said that `bv deps` did not exist yet. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Round 2 addressed in 4c34d8c. The three sites named are fixed, and four more of the same shape, found by searching for "lockstep", "invisible", "one command", and "family":
Each statement names the exception: a |
Checklist of related issues / discussions
Proposed changes
The .NET 10 SDK creates the tool manifest as
dotnet-tools.jsonin the repository root.dotnet tool installanddotnet new tool-manifestboth write it there, and the minimum .NET SDK of Buildvana is 10.0.400.bvread.config/dotnet-tools.jsonalone.With a root manifest,
dotnet bvnever delegated,bv self-updatereported the pin as added on every run, andbv dependencieslisted no tool.The post-release commit of
bv releaseleft the manifest alone.bvreadsdotnet-tools.jsonin the home directory, and fails on.config/dotnet-tools.jsonwith a message that names thegit mv, or the merge when both files exist.Ignoring the file would not do: the dotnet CLI writes the
bvpin into whichever file exists, so a filebvignored would keep receiving it.Reading both locations, as the CLI does, was considered and rejected: it is a dual-track design for a layout that only history produces, and its precedence rule would need documenting.
bv self-updatecreates the manifest withdotnet new tool-manifestwhen the home directory has none, and passes--tool-manifest dotnet-tools.jsonto everydotnet toolverb it runs.Left to
dotnet tool install, the CLI picks the directory by its own markers, which can be an ancestor of the home directory.When the template writes no
dotnet-tools.jsonin the home directory,bv self-updatefails before the install.bv dependenciesreads everydotnet-tools.jsonunder the home directory, as thepackagesscope reads every project file, and writes each pin back to its own file.A
.config/dotnet-tools.jsonin a subdirectory fails the read too, and the message names every such file.A
bventry in a manifest below the home directory is a tool pin like any other, because delegation andbv self-updateread the home directory's manifest alone.docs/directory-structure.mddescribes the location and gains a migration section,docs/getting-started.mddrops-o .config, andterminology.mdgains a "tool manifest" row.This repository keeps
.config/dotnet-tools.jsonfor now.The release that ships this change runs the pinned
bv, which rewrites that file.After the release, the new
bvrefuses to run here until the file moves, which is a single commit onmain: the manifest,Buildvana.slnx,.github/labeler.yml, the two workflows, the comments ofbuildvana.jsoncandbuildvana.next.jsonc, the constant ofRepositoryConfigFilesTests, and.claude/rules/dependency-management.md.Additional changes
None.
Types of changes
This pull request introduces the following types of changes:
.gitattributes,.gitignore)Breaking changes
This pull request introduces breaking changes:
Checklist
🤖 Generated with Claude Code