Skip to content

isMarketplaceBrowsePattern excludes install-local by bare startsWith, so an adjacent spelling is claimed by neither derived flag #8467

Description

@os-zhuang

Observation, filed while implementing #8388 (PR #8466). Dormant today — no route in the repo has the shape below — so it is recorded rather than fixed, and #8388 deliberately did not touch it because changing it is a behaviour change to #8356's key.

packages/cloud-connection/src/runtime-config-plugin.ts now derives two flags from the same route ledger with two predicates that share one prefix constant, but test membership at different strictness:

// browse (#8356): bare startsWith for the exclusionfunctionisMarketplaceBrowsePattern(pattern: string): boolean{if(pattern.startsWith(MARKETPLACE_INSTALL_LOCAL_PREFIX))returnfalse;
...
}// install-local (#8388): segment boundary for the inclusionfunctionisMarketplaceInstallLocalPattern(pattern: string): boolean{if(!pattern.startsWith(MARKETPLACE_INSTALL_LOCAL_PREFIX))returnfalse;constrest=pattern.slice(MARKETPLACE_INSTALL_LOCAL_PREFIX.length);returnrest===''||rest.startsWith('/');}

So a hypothetical /api/v1/marketplace/install-locality/... route is subtracted from browse (it matches the bare startsWith) and not counted as install-local (it fails the segment boundary). It would be claimed by neither flag.

Why it was left alone

Both halves fail in the under-reporting direction, which is the direction this whole family of fixes chose deliberately: a runtime never announces a capability whose route 404s, it only ever stays quiet about one it has. And the resolveFeatures seam still lets a host declare anything it knows it serves. So there is no reachable defect here today.

Tightening browse's exclusion to the same segment boundary would make the two predicates a clean partition of the namespace, but it would also newly count such a path as browse — a behaviour change to the key #8356 owns, which #8388's scope did not cover.

Suggested disposition when triaged

Either tighten isMarketplaceBrowsePattern's exclusion to the segment boundary (making the partition exact, with a pin for the adjacent spelling in runtime-config-marketplace-derivation.test.ts), or record the asymmetry as intentional and leave it. The current code comments state it as deliberate, so "leave it" is a legitimate outcome.

The install-local side is already pinned in both directions by packages/cloud-connection/src/runtime-config-install-local-derivation.test.ts ("an adjacent spelling is not the install-local namespace"). The browse side has no such pin.

Backlink: #8388, #8356.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions