Skip to content

draft: Android taxonomy sync + hide built-in default chips - #6

Closed
djbclark wants to merge 5 commits into
mainfrom
draft/android-category-sync
Closed

draft: Android taxonomy sync + hide built-in default chips#6
djbclark wants to merge 5 commits into
mainfrom
draft/android-category-sync

Conversation

@djbclark

@djbclark djbclark commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Android client support for config-driven category taxonomy, gated so upstream mainline behavior is unchanged until GET /taxonomy exists.

Without /taxonomy (current upstream): same built-in chips, early-return after local SQLite, delta-only sync (including pull-to-refresh).

With /taxonomy (this fork / future upstream):

  • Always background-sync; pull-to-refresh can full-sync
  • Persist taxonomy_version and full-resync when it changes
  • use_default_categories = false → configured chips/edit options only

Upstream safety

Safe to land in one Android round: new paths are inert until the taxonomy API (and optionally custom categories.toml) ships. No separate fork APK required for mainline users.

Verified (fork)

Sideload builds on draft/android-category-sync against a taxonomy-enabled server; custom chips only; badges match after sync.

Test plan

  • Against server without /taxonomy: chips = product/places/food/…; cold start matches current upstream
  • Against taxonomy server + use_default_categories=false: custom chips only; sync picks up migrations
  • Pull-to-refresh / cold start on taxonomy server
  • Edit-post category picker follows taxonomy when present, builtins otherwise

Scope

  • superbrain-app/src/screens/HomeScreen.tsx
  • superbrain-app/src/screens/PostDetailScreen.tsx
  • superbrain-app/src/services/syncService.ts
  • superbrain-app/src/services/api.ts
  • superbrain-app/src/services/localDb.ts
  • superbrain-app/src/services/taxonomySupport.ts
  • superbrain-app/src/constants/categories.ts
  • backend/config/categories.toml.example (comment only)

Follow-ups

  • High “Other” share after migration — classifier/guidance, not APK

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bab84c0-c347-4b9c-a1f0-9751dd9a613e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@djbclark

Copy link
Copy Markdown
Owner Author

Sideload APK

Built from this branch and uploaded as a prerelease (does not overwrite latest):

https://github.com/djbclark/superbrain/releases/tag/apk-android-category-sync-78fb1df

Direct asset: superbrain-android-category-sync.apk

@djbclark

Copy link
Copy Markdown
Owner Author

Updated APK (taxonomy resync)

Server categories are fine (Politics/Technology/…); the phone was showing stale local SQLite.

New build: https://github.com/djbclark/superbrain/releases/tag/apk-android-category-resync-20260731-1315

Direct: https://github.com/djbclark/superbrain/releases/download/apk-android-category-resync-20260731-1315/superbrain-android-category-sync.apk

Without reinstall: open the current APK and pull-to-refresh — server updated_at was bumped so delta/full sync should rewrite categories.

Delta sync can miss category migrations if last_synced_at already advanced;
persist taxonomy_version and force a full post pull when it differs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@djbclark

Copy link
Copy Markdown
Owner Author

Stop seeding or merging legacy product/places/food chips when the server
taxonomy disables built-in defaults; clarify the config example.

Co-authored-by: Cursor <cursoragent@cursor.com>
@djbclark

Copy link
Copy Markdown
Owner Author

@djbclark djbclark changed the title draft: Android sync so taxonomy categories show posts draft: Android taxonomy sync + hide built-in default chips Jul 31, 2026
djbclark and others added 2 commits July 31, 2026 13:46
Keep upstream mainline chip/sync behavior when the taxonomy API is absent;
activate strict chips, always-sync, and version full-resync only for
taxonomy-aware servers.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Cache taxonomy result within each loadPosts cycle via taxonomyRef;
  pass pre-fetched payload to syncIfNeeded so it skips redundant fetch.
  Eliminates 2-3 extra GET /taxonomy round-trips per load on taxonomy
  servers and removes the 404 that upstream cold-start paths hit before
  early-return.
- Defer taxonomy gate behind testConnection so offline upstream users
  return immediately with zero network calls (matching original behavior).
- Save taxonomy_version after full sync regardless of post count (the
  version changed even if the server has 0 posts, avoiding repeated
  full-sync attempts).
@djbclark

Copy link
Copy Markdown
Owner Author

44a655d — review fix commit:

Findings addressed:

  1. Deduplicated GET /taxonomy callsloadPosts now caches the taxonomy result in a ref and passes the pre-fetched payload to syncIfNeeded via a new optional prefetchedTaxonomy parameter. Eliminates 2-3 redundant HTTP round-trips per load cycle on taxonomy servers.

  2. Removed extra 404 on upstream cold-start path — the taxonomy gate is now deferred behind testConnection, so offline upstream users return immediately with zero network calls (matching original upstream behavior). Online upstream users still get the single 404 that returns null and early-returns.

  3. taxonomy_version saved unconditionally after full sync — even if the server has 0 posts, the version is persisted so the next load cycle does not trigger another spurious full sync.

TypeScript compiles cleanly (tsc --noEmit passes with zero errors).

@djbclark

Copy link
Copy Markdown
Owner Author

Moved to upstream PR #7 (sidinsearch#7)

@djbclark djbclark closed this Jul 31, 2026
djbclark added a commit that referenced this pull request Jul 31, 2026
@djbclark
djbclark deleted the draft/android-category-sync branch July 31, 2026 18:31
@djbclark
djbclark restored the draft/android-category-sync branch July 31, 2026 18:40
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