Skip to content

feat(web,desktop): community product-DB collection, phase 1 (dormant) - #985

Open
polynaut wants to merge 1 commit into
mainfrom
feature/product-share-phase1
Open

feat(web,desktop): community product-DB collection, phase 1 (dormant)#985
polynaut wants to merge 1 commit into
mainfrom
feature/product-share-phase1

Conversation

@polynaut

@polynaut polynaut commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Phase 1 of the community product database (the collect-and-aggregate half of the plan): opt-in sharing of product-scan results into a central catalog — the raw material for the later scraper/enrichment phases and the eventual DB that names unofficial products. Ships dormant; #984 tracks activation.

What a submission is — and isn't

lib/rom/product-share.ts is the privacy contract, pure and tested against the whole serialized payload: product facts only (name/SKU/artist/version/type/matchMethod; unmatched assets with content-relative source path, artist, version). Scene names, usage/usedBy, absolute paths, and anything about the user or machine are stripped client-side — and the Worker re-validates server-side (absolute-looking paths rejected, unknown keys rejected, reject-don't-repair). Payloads are deduped + sorted so identical libraries produce byte-identical bodies; the content hash is the dedupe key on both ends. No sender data is stored — no IP, no UA, no headers.

The pieces

  • Settings → General → "Community product database": the opt-in (shareProductScans, default off). With no endpoint configured the toggle renders disabled with a "not active in this build" note — visible honesty instead of a dead switch.
  • Submit path (api/product-share.ts): rides each product-scan ingest, fire-and-forget by contract; a capped sent-hash list in app-data stops resubmission of unchanged libraries; non-2xx leaves the hash unrecorded so the next ingest retries.
  • share.rs submit_product_share: the webview CSP allows IPC only, so the POST runs on the github.rs reqwest stack (https-only, 15 s timeout, status code as the primitive return — no fixture per the convention).
  • services/products-ingest/: dependency-free Cloudflare Worker + D1 — ONE append-only submissions table, UNIQUE on the body's SHA-256, raw blobs stored verbatim so later aggregation passes can be re-run over the full corpus. Deliberately outside the pnpm workspace (own package, extractable to its own repo when phase 2 starts); README carries the exact deploy steps.

Verified / not verified

Full local gate green: typecheck, lint, all JS tests (incl. 5 builder + 5 submit-guard cases), cargo 162 + clippy, 218 smoke (a new spec pins the disabled-toggle surface). Never run against a real Worker — the Worker has only been reviewed, not deployed; #984's step 3 is the live acceptance (toggle on → scan → row in D1). Guide note deferred to the endpoint-flip PR on purpose.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YSDm9hBkod1w2KN8GAGGHu

…984 activates)

Opt-in sharing of product-scan results into a central catalog of Daz
products - the raw-collection half of the products-database plan. Ships
DORMANT: PRODUCT_SHARE_ENDPOINT is '' until the Worker is deployed (#984),
so the Settings toggle renders disabled with a note and nothing submits.

- lib/rom/product-share.ts: the PURE payload builder = the privacy contract.
  v1 carries product facts only (name/sku/artist/version/type/matchMethod;
  unmatched assets with CONTENT-RELATIVE source, artist, version) - scene
  names, usage/usedBy and anything absolute are stripped, pinned by tests
  that scan the whole serialized payload. Deduped + sorted so identical
  libraries hash identically (FNV-1a content hash = client dedupe key).
- api/product-share.ts: fire-and-forget submit riding each product-scan
  ingest, guarded by endpoint + opt-in + non-empty + not-already-sent (a
  capped sent-hash list in app-data, per the housekeeping bound); non-2xx
  leaves the hash unrecorded so the next ingest retries.
- share.rs submit_product_share: the webview CSP allows IPC only, so the
  POST runs on the github.rs reqwest stack (https-only, 15s timeout,
  status code back as the primitive return - no fixture per the convention).
- Settings > General: "Community product database" section with the toggle
  (disabled + "not active in this build" while the endpoint is ''),
  settings.shareProductScans (default off).
- services/products-ingest: dependency-free Cloudflare Worker + D1 schema -
  append-only submissions table keyed UNIQUE on the body's SHA-256,
  server-side re-validation (reject-don't-repair, absolute paths refused),
  no sender data stored. Outside the pnpm workspace on purpose; README has
  the deploy steps.

Guide note deliberately deferred to the endpoint-flip PR (#984) - the
feature is invisible until then.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YSDm9hBkod1w2KN8GAGGHu
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.

1 participant