A store with paid titles had nothing to tell this client and no way for it to listen: the catalog carried no price, no entitlement and no sign-in, so a gated download could only come back 403 and leave the window guessing why. The knowledge belongs on the server, not here. This client serves whichever catalog a registry names, so anything it knew about a particular shop would be a rule that breaks every other one. WarpEngine 0.5 answers GET /api/service with what it offers and puts an `access` block on every entry; this reads both. There is no store name anywhere in the diff. - **0.5 is a dialect of its own**, the older shape with `access` added. The version list is exhaustive over the selector, so adding it was a compile error until somebody said what it reads like — which is what that switch is for. - **A card shows a price and a Buy button** when a title is not yours, opening the store's own page. Buying stays in a browser: a checkout rebuilt here would be a second place to get card handling wrong. - **Signing in is the device grant**: a short code, the person's own browser, and no password crossing this window. The token goes in the OS keychain through safeStorage — one per store — and where no keychain exists it is not stored at all rather than written out in the clear. - **Owned / To buy** join the categories, since owning something is not the same as having installed it. Three things worth stating about the shape: The bearer token stops at the origin that issued it. A gated download redirects to signed storage — often somebody else's host — and some object stores refuse a request outright when an Authorization header arrives alongside the signature. An absent access block is not "free". It is an engine too old to have an opinion, and only one of those two is a reason to offer somebody a sign-in, so the three states are kept apart all the way to the card. state.json does not carry entitlement. Whether somebody may download a title is the server's answer to a question asked now; a copy on disk would go stale on the next purchase or refund, and a stale yes is the dangerous direction. A store with no sign-in shows none, and every WarpEngine before 0.5 is such a store: no Account block, no prices, no new categories. The smoke test against the live catalog reports exactly that — `sign-in: not offered`, `access: open:13`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -123,10 +123,44 @@ class SmokeTest {
|
||||
}
|
||||
const games = this.gameMapper.toDtoList(listing.games, listing.paths?.catalogBaseUrl ?? '')
|
||||
this.reportListing(games)
|
||||
this.reportAccess(listing, games)
|
||||
|
||||
if (logLines.length > 0) this.reportOk('stderr log', `${String(logLines.length)} lines (kept off stdout)`)
|
||||
}
|
||||
|
||||
/**
|
||||
* What the catalog said about who may have what.
|
||||
*
|
||||
* The load-bearing case is the boring one: an older engine says nothing, every title
|
||||
* comes back `open`, and the client behaves exactly as it did before any of this
|
||||
* existed. A gated catalog is where the rest of it starts mattering.
|
||||
*/
|
||||
private reportAccess (listing: CatalogListing, games: readonly GameDto[]): void {
|
||||
const account = listing.account
|
||||
this.reportOk('sign-in', account.signInAvailable
|
||||
? (account.signedIn ? 'offered, and signed in' : 'offered, not signed in')
|
||||
: 'not offered by this catalog')
|
||||
|
||||
const counts = new Map<string, number>()
|
||||
for (const game of games) {
|
||||
counts.set(game.accessVerdict, (counts.get(game.accessVerdict) ?? 0) + 1)
|
||||
}
|
||||
const summary = [...counts.entries()]
|
||||
.map(([verdict, count]: readonly [string, number]): string => `${verdict}:${String(count)}`)
|
||||
.join(', ')
|
||||
this.reportOk('access', summary)
|
||||
|
||||
// A price with nothing to click, or a purchase button with no price, is a card
|
||||
// somebody cannot act on.
|
||||
const unbuyable = games.filter((game: GameDto): boolean =>
|
||||
game.accessVerdict === 'purchasable' && game.purchaseUrl === null)
|
||||
if (unbuyable.length > 0) {
|
||||
this.reportBad('purchase links', `${String(unbuyable.length)} priced titles have nowhere to buy them`)
|
||||
} else if ((counts.get('purchasable') ?? 0) > 0) {
|
||||
this.reportOk('purchase links', 'every priced title has one')
|
||||
}
|
||||
}
|
||||
|
||||
private reportListing (games: readonly GameDto[]): void {
|
||||
const installable = games.filter((game: GameDto): boolean => game.installable)
|
||||
const native = installable.filter((game: GameDto): boolean => game.mode === 'app').length
|
||||
|
||||
Reference in New Issue
Block a user