Repository navigation
fix(widget-dev): give dev-session listings a source so a sourced install cannot pick them - #609
Merged
Merged
Conversation
…all cannot pick them Dev-session listings sat in front of the composed directory with no origin, so an install from a marketplace card that named its source accepted a session's build of the same id and version. They now name their own source, widget-dev, which the installed generation records and the session's own installs choose. Tests cover that refusal and the default fresh-node path: the official Marketplace on but never fetched, and a broken index file.
Contributor
Author
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
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.
What
Widget dev-session listings now carry a directory source of their own,
widget-dev(kindwidget-dev), so #571's source rules apply to them like any other listing.readNodeDirectory(apps/runtime/src/application/widget-dev-store.ts) recordsWIDGET_DEV_DIRECTORY_SOURCEas the origin of every dev listing, in all three cases: no source configured, remote sources with nothing to list, and a composed directory. Dev listings stay in front, so a listing key shared with another source resolves to the session's listing, as the entry lookup already did.directorySourceKindSchemagainswidget-dev. The change only adds a kind: generations recorded before it still parse.sourceId: "widget-dev"on the request and on its reused consent approval). The session's ownidConflictcheck still guards the package id, and generations installed before this change, which recorded no source, are not refused on their next rebuild.Why
Before this change, a dev listing had no origin. On a fresh node (official Marketplace on but never fetched, no index file) the session's collision check could not see an id@version that a marketplace lists once it is fetched. After that fetch, pressing Install on the marketplace card (which sends its
sourceId) passedsourceRefusalbecause the found entry had no origin, and it installed the dev session's files under a card that named another source. It now answers409 DIRECTORY_SOURCE_CHANGED, and what runs stays the session's build.Tests
New block in
apps/runtime/test/widget-dev-sessions.spec.tsthat runs with the node's defaults: no index, no custom feed, official Marketplace on.DIRECTORY_SOURCE_CHANGED. The generation recordswidget-dev, and the next build is refused withPACKAGE_LISTED. This test fails onmain, where the install is accepted and no source is recorded.CC_OFFICIAL_MARKETPLACE=offhad hidden. With the Marketplace on but never fetched and no index file, a session activates and serves its files. With a broken index file, activation is refused withDIRECTORY_UNREADABLE.Verification on 43e8f21:
widget-dev-sessions,marketplace-directory-install,update-checks,directory-sources, contracts,marketplace-directory-sources,open-interfaces: 58 files and 1044 tests passedpnpm typecheck: passedpnpm invariants: all 14 checks passed (docs/manifest.jsonrewritten for the two edited widget-development docs)pnpm verify: passed (561 test files, 7495 tests passed, 37 skipped)Docs
docs/open-interfaces.mdanddocs/widget-development.mddescribe thewidget-devsource and the refusal, with their Vietnamese pairs. Official docs (clarkcant-web) are not affected: they do not describe directory source ids or this refusal.Notes
An install approval for a dev build that was still pending when the node upgraded recorded no source. After the upgrade the inbox hides it, and a decision on it answers
DIRECTORY_SOURCE_CHANGED, because its recorded source (none, so the index file) no longer matches. That session's build stays waiting until the approval is resolved or expires. This only affects dev builds that were waiting when the upgrade happened (#531 merged hours ago), so no migration path was added.Fixes #583
Refs #496, #531, #571