✨ Add Data safety information to search results #16

Open
devhelper47607 wants to merge 1 commit from devhelper47607/v2-api:feat/search-data-safety into master
First-time contributor

Companion change for playsearch.kaki87.net/v2-web#41 (Data safety column).
The client (playsearch.kaki87.net/v2-client) only transports what this server streams over Server-Sent Events, so the information summarized by the planned web column must be produced here.

Problem

For each Google Play result, /search currently streams: the search list item, the full app details and the permission list. The Google Play Data safety section (data collected, data shared, encryption in transit, data-deletion practice) is never fetched.

Root cause

google-play-scraper exposes a dedicated datasafety() endpoint next to app() and permissions(), but the /search SSE handler never calls it.

Solution

  • In the /search per-app fan-out queue, request googlePlay.datasafety({ appId }) and push { appId, dataSafety } into the SSE stream; the payload mirrors the upstream dump (collectedData, sharedData, securityPractices, privacyPolicyUrl).
  • A failure for a single app is caught, logged and replaced with an empty dataSafety: {} marker, so one slow or missing app never aborts the whole stream or blocks later phases.
  • The DONE marker is still pushed once the queue has drained, preserving the current client behavior.

Files changed

  • index.js: one best-effort fan-out phase in /search.

Verification

  • node --check index.js: success.
  • Started the server locally (node index.js) and requested /search?query=telegram: SSE responses included dataSafety upserts (e.g. com.viber.voip → 25 collected types, 7 shared types, practices “Data is encrypted in transit” and “You can request that data be deleted”); the stream ended with DONE as before.

Impact

  • One extra request per result to Google Play; scraper memoization applies.
  • Consumers ignoring unknown SSE fields (v2-client, existing v2-web) are unaffected.
  • A matching UI change (Data safety column) is opened on the v2-web repository.
Companion change for https://git.kaki87.net/playsearch.kaki87.net/v2-web/issues/41 (Data safety column). The client (`playsearch.kaki87.net/v2-client`) only transports what this server streams over Server-Sent Events, so the information summarized by the planned web column must be produced here. ## Problem For each Google Play result, `/search` currently streams: the search list item, the full app details and the permission list. The Google Play Data safety section (data collected, data shared, encryption in transit, data-deletion practice) is never fetched. ## Root cause `google-play-scraper` exposes a dedicated `datasafety()` endpoint next to `app()` and `permissions()`, but the `/search` SSE handler never calls it. ## Solution - In the `/search` per-app fan-out queue, request `googlePlay.datasafety({ appId })` and push `{ appId, dataSafety }` into the SSE stream; the payload mirrors the upstream dump (`collectedData`, `sharedData`, `securityPractices`, `privacyPolicyUrl`). - A failure for a single app is caught, logged and replaced with an empty `dataSafety: {}` marker, so one slow or missing app never aborts the whole stream or blocks later phases. - The `DONE` marker is still pushed once the queue has drained, preserving the current client behavior. ## Files changed - `index.js`: one best-effort fan-out phase in `/search`. ## Verification - `node --check index.js`: success. - Started the server locally (`node index.js`) and requested `/search?query=telegram`: SSE responses included `dataSafety` upserts (e.g. `com.viber.voip` → 25 collected types, 7 shared types, practices “Data is encrypted in transit” and “You can request that data be deleted”); the stream ended with `DONE` as before. ## Impact - One extra request per result to Google Play; scraper memoization applies. - Consumers ignoring unknown SSE fields (`v2-client`, existing `v2-web`) are unaffected. - A matching UI change (Data safety column) is opened on the `v2-web` repository.
devhelper47607 added 1 commit 2026-12-01 21:44:20 +01:00
Author
First-time contributor

Companion change for this PR: playsearch.kaki87.net/v2-web#49 — the web Data safety column that consumes the { appId, dataSafety } SSE messages introduced here (per-row Collected / Shared only / Encrypted values plus a tooltip on the four Data-safety criteria).

Verified live end-to-end together: a search for telegram produced the regular SSE app/permissions messages plus dataSafety upserts (e.g. com.viber.voip with 25 collected data types and 7 shared data types), ending with DONE; the web build renders the new column and degrades to - when an app returns no data.

Companion change for this PR: https://git.kaki87.net/playsearch.kaki87.net/v2-web/pulls/49 — the web Data safety column that consumes the `{ appId, dataSafety }` SSE messages introduced here (per-row `Collected` / `Shared only` / `Encrypted` values plus a tooltip on the four Data-safety criteria). Verified live end-to-end together: a search for `telegram` produced the regular SSE app/permissions messages plus `dataSafety` upserts (e.g. `com.viber.voip` with 25 collected data types and 7 shared data types), ending with `DONE`; the web build renders the new column and degrades to `-` when an app returns no data.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/search-data-safety:devhelper47607-feat/search-data-safety'
git checkout 'devhelper47607-feat/search-data-safety'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout 'master'
git merge --no-ff 'devhelper47607-feat/search-data-safety'
git checkout 'devhelper47607-feat/search-data-safety'
git rebase 'master'
git checkout 'master'
git merge --ff-only 'devhelper47607-feat/search-data-safety'
git checkout 'devhelper47607-feat/search-data-safety'
git rebase 'master'
git checkout 'master'
git merge --no-ff 'devhelper47607-feat/search-data-safety'
git checkout 'master'
git merge --squash 'devhelper47607-feat/search-data-safety'
git checkout 'master'
git merge --ff-only 'devhelper47607-feat/search-data-safety'
git checkout 'master'
git merge 'devhelper47607-feat/search-data-safety'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: playsearch.kaki87.net/v2-api#16
No description provided.