Repository navigation
pkg reads the canonical purl it writes, and carries the namespace to the driver - #871
Merged
Merged
Conversation
added 3 commits
September 8, 2026 15:23
A draft for review before any code. The constructor cuts at the first colon, so a purl's own scheme reads as an unknown manager, while the same function emits purl.String() as the URI. Found while sizing: the winget driver already joins namespace and name and has simply never been handed a namespace, so the fix is confined to the provider -- and five sites rebuild a PURL by hand, which is where a parsed namespace would still be lost. Refs #813. Claude-Session: https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW
…the driver The constructor cut a package string at its first colon, so a purl's own scheme read as an unknown manager named "pkg" while the same function emitted purl.String() as the resource's URI. It now checks the scheme first and parses through platform.ParsePURL; a malformed purl reports the parser's message rather than falling back, since a fallback turns a typo into a package name. The resource carries the namespace and qualifiers a purl exists to express, both identity and both in the URI, and one projection replaces the five hand-built PURLs that dropped them -- without which winget would still be asked for "Vim" rather than the "Vim.Vim" its driver already knows how to join. The schema documents the three accepted forms, and a scenario fixture plans a purl-named package on each platform's own manager. Refs #813. Claude-Session: https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW
5 tasks
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
pkg.Resourceemittedpurl.String()as a resource's identity and could not read that form back:buildCandidatecut a package string at its first colon and handed the prefix to the platform's type resolver, sopkg:winget/Vim/Vim?scope=machinewas refused as an unknown package manager namedpkg. This is the fix, in two halves.pkg:scheme is checked before the manager-prefix form, and the string goes throughplatform.ParsePURL. The two grammars are otherwise ambiguous, sincepkgreads as a legal manager prefix. Apkg:string the parser rejects is refused with the parser's message and never re-read as a prefix: once a string declares the scheme it is a purl, and a fallback would turn a typo into a package named after it. A well-formed purl whose type no manager answers to is refused naming the type.purl()method replaces the five sites that rebuilt aplatform.PURLfrom name and type alone. Without this half, parsing the namespace changes nothing: winget would still be asked forVimrather thanVim.Vim.Nothing in
pkg/platformchanges. The winget driver already joinsNamespace + "." + Name; it had simply never been handed a namespace.Also: the manifest schema documents the three accepted forms with an example of each, and a scenario fixture plans a purl-named package on each platform's own manager.
Plan:
docs/plans/fix/813-canonical-purl-form.md(complete). The ruling the issue recorded as pending was settled by its own acceptance criteria — option 1, the provider accepts the canonical form — and this PR does not reopen it.What the work found
DiscoverResource(env, r.URI())yield the same entry;URI()is the tag-wrapped form, while the contractunpackCatalogrelies on isReachabilityURI(), the scheme-specific part a provider emits and reads back. For pkg that part is the canonical purl, so the parse criterion and the round-trip criterion are one property read twice.devlore-test'sdata/*.starfiles are not auto-discovered. The fixture was added, the suite stayed green, and it had never executed — caught by running it explicitly.TestPkgCanonicalPurlnames it now.Acceptance — #813
pkg:winget/Vim/Vim?scope=machine,pkg:brew/[email protected]and the existingbrew:jq/jqforms all construct; a malformed purl is refused with the parser's message —TestNewResource_AcceptsTheCanonicalPurlForm,TestNewResource_AMalformedPurlReportsTheParsersMessage,TestNewResource_AnUnknownPurlTypeIsRefusedTestResource_URIRoundTripsThroughTheConstructor, pinned on the reachability URI per the note aboveschema/packages-manifest.jsondocuments every accepted form ofnamepkg/op/provider/pkg, and adevlore-testfixture that plans a purl-named packagewrit deploy noblefactor --dry-runon DANOBLE-WD11-3 passes the personal layer's Windows manifest — yours: it needs the VM, which is parked, and the reversal of the workaround commit on Personal (the manifest returns topkg:winget/Vim/Vim?scope=machine)Closes #813.
https://claude.ai/code/session_01SqQVFZz7AdiLZkGoAcUqRW
Time
Computed by the algorithm of noblefactor-ops#188 at merge.