Skip to content

test(skills): cover the market preview race and aggregator wiring - #346

Merged
vastsa merged 1 commit into
vastsa:mainfrom
muzimu217:fix/skill-market-review-followup
Sep 14, 2026
Merged

vastsa merged 1 commit into
vastsa:mainfrom
muzimu217:fix/skill-market-review-followup

Conversation

@muzimu217

Copy link
Copy Markdown
Contributor

Follow-up to the #290 review, on top of current main (0c08f81b).

Audit first: what the integration already landed

Before writing anything I re-verified every finding against current main, and most of the review is already satisfied by what followed the merge:

Review item Current main
#2 E2E plan glued paragraph Repaired — the steering Status is clean, no test:e2e:layout remnant
#3 English-first builtin catalog Done — entries are English-only, asserted by skill-market-panel.test.mjs
#4 id alignment Done — sanitizeSkillCatalogId in shared, used at scan time, host-legal slugs tested
#5 128KiB preview/install Done — preview assembles the expanded body and surfaces tooLarge; install refuses before skills.create; MAX_SKILL_DOCUMENT_BYTES mirrors host-core
#6 shared network classifier Done — packages/shared/public-network.ts exists and skill-catalog.ts imports isSafePublicHttpsSourceUrl from it
Non-blocking: sourceName/badges, retry comment, css leftovers Done — sourceName includes default sources; the inaccurate retry comment and the MCP is-* leftovers are gone
Spec: settings IA market view Done in both locales (skills page items describe the market view and the oversize refusal)

What this PR adds (the genuinely missing pieces)

  1. Preview race regression (skill-market-panel.test.mjs): the gate lifecycle is now pinned — LatestWinsGate token on open, isCurrent(token) before applying a fetched document, invalidate() when the sheet closes, and document state reset on every open. This is the A→B / close-reopen regression the review asked for.
  2. Main-aggregator wiring contract (skill-market-scan.test.mjs): the main-process catalog module must build createPublicHttpsClient over Electron net.fetch and pass client.request into createSkillMarketAggregator, with no direct node:http(s) use. Together with the existing public-https-fetch.test.mjs (DNS classification, per-hop redirect revalidation, policy failures never retried) this is the main-process coverage the review asked for, in the same deterministic + source-contract shape that the MCP market suite uses.
  3. Egress policy defined in the IPC spec (en + zh-CN): the market fetch channel now states what the policy is — syntactic URL guard, DNS classification, per-hop redirect revalidation, bounded responses, and that the renderer never reaches the network directly.
  4. Doc hygiene: a duplicated line in the settings IA spec is dropped.

Verification

  • Full local gates green on this head: pnpm build:js, desktop typecheck, style-token lint, pnpm -r test (desktop 1611/1611), architecture budgets, check-locales (77 pairs).
  • Targeted: node --test apps/desktop/test/skill-market-panel.test.mjs apps/desktop/test/skill-market-scan.test.mjs → 12/12.

Still open from the non-blocking list, deliberately not in this PR: SkillMarketPanel.tsx is 673 lines (guidance ~500) — splitting it deserves its own review; happy to take it next if you want it. pnpm test:e2e:skill-market remains the deterministic headless suite; no live-network journey exists for this surface.

Follow-up to the vastsa#290 review. Auditing current main first: most findings
were already landed by the integration that followed the merge
(English-first builtin catalog, id sanitization, the shared public-network
module consumed by the skill catalog, the 128KiB gate in both preview and
install, source badges incl. default sources, panel/tests contracts, and
the previously glued paragraph in the E2E plan are all verified
present). What remained untested or undocumented ships here:

- The preview race gate gets its panel regression: opening a preview must
  take a LatestWinsGate token, a resolving fetch may only apply while its
  token is current, and closing the sheet must invalidate whatever is
  still in flight, with the document state reset on every open.
- The main-process aggregator gets its wiring contract: the module must
  build the public-network client over Electron's net.fetch and hand
  client.request to the aggregator, with no direct http/https module use.
- The IPC spec now defines what the market's egress policy actually is
  (syntactic URL guard, DNS classification, per-hop redirect revalidation,
  bounded responses; the renderer never reaches the network directly) in
  both locales, and a duplicated line in the settings IA spec is dropped.
@vastsa
vastsa merged commit f94a583 into vastsa:main Sep 14, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants