feat(web,desktop): community product-DB collection, phase 1 (dormant) - #985
Open
polynaut wants to merge 1 commit into
Open
feat(web,desktop): community product-DB collection, phase 1 (dormant)#985polynaut wants to merge 1 commit into
polynaut wants to merge 1 commit into
Conversation
…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
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.
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.tsis 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
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.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-onlysubmissionstable, 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