[PR #1879] [MERGED] Fix Datacat fresh browser fallback #5331

Closed
opened 2026-10-22 04:15:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1879
Author: @cha1latte
Created: 6/2/2026
Status: ✅ Merged
Merged: 6/2/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/issue-1874-datacat-response


📝 Commits (6)

  • 68d4883 Fix Datacat fresh browser fallback
  • dfc2cf1 Address Datacat fallback review feedback
  • b70e648 Require Datacat fallback success flag
  • 83f9020 Mark Datacat weekly fallback unavailable
  • ac197f2 Surface Datacat partial fallback notice
  • d11f214 Keep Datacat fallback notice in empty state

📊 Changes

3 files changed (+183 additions, -12 deletions)

View changed files

📝 src-tauri/src/commands/storage/bot_browser.rs (+144 -2)
📝 src/features/shell/bot-browser/components/BotBrowserView.tsx (+28 -10)
📝 src/features/shell/bot-browser/types/provider-responses.ts (+11 -0)

📄 Description

Linked issue

Closes #1874

Why this change

  • DataCat's Fresh endpoint currently returns HTTP 200 with malformed JSON, which bubbles through the bot browser as error decoding response body.
  • The DataCat browser should still show character tiles instead of failing the whole provider when the Fresh endpoint is malformed.

What changed

  • Added a narrow DataCat Fresh fallback in the Rust bot-browser command: only upstream_json_error from the Fresh endpoint falls back to DataCat recent-public.
  • Validates the recent-public fallback payload before reshaping it so bad fallback input stays an upstream error.
  • Adapted the recent-public response into the existing Fresh response shape (windows.last24h.characters) and marks the unobservable thisWeek bucket unavailable/partial so the degraded response stays honest.
  • Carries the partial fallback contract through the DataCat response type and Bot Browser rendering path so users see a provider notice while character tiles still render.
  • Added focused Rust unit tests for the fallback response shape and malformed fallback inputs.

Refactor impact

Primary owner:

Rust storage / bot browser provider commands.

Impact areas reviewed:

  • src-tauri/src/commands/storage/bot_browser.rs
  • src/features/shell/bot-browser/components/BotBrowserView.tsx
  • src/features/shell/bot-browser/types/provider-responses.ts
  • Hostable bot_browser_get remote-runtime path
  • DataCat fresh, recent, and tags command paths

Boundary notes:

  • The fix stays in src-tauri, where the upstream DataCat transport/response contract is owned.
  • React bot-browser code consumes the partial fallback marker as a notice while continuing to render the existing last24h character shape.

Pressure points touched:

  • DataCat branch of the bot browser storage command.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix only; no new discoverable behavior.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • Issue screenshot shows the visible failure state: error decoding response body.
  • This fix was verified through the production bot_browser_get remote-runtime command path rather than the desktop shell. Reviewer-visible command proof is linked above.

Summary by CodeRabbit

  • New Features
    • The bot browser now gracefully falls back to alternative data sources when fresh data is unavailable, ensuring uninterrupted access to bot listings.
    • Added informational notices that appear when the app retrieves data from fallback sources, keeping users informed about data availability.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1879 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/issue-1874-datacat-response` --- ### 📝 Commits (6) - [`68d4883`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68d48833a72ee3846436284ce4f01a4827fc48f2) Fix Datacat fresh browser fallback - [`dfc2cf1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dfc2cf116f5b03758e3d60042d1df6fa508ecec4) Address Datacat fallback review feedback - [`b70e648`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b70e6488edc25ccddabc42af35fca6c170c46e00) Require Datacat fallback success flag - [`83f9020`](https://github.com/Pasta-Devs/Marinara-Engine/commit/83f9020b29d40bbf97cbaf7612389a9c9eaafdb9) Mark Datacat weekly fallback unavailable - [`ac197f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ac197f2c536bb750b47a7065aefdc3f556f0abe5) Surface Datacat partial fallback notice - [`d11f214`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d11f214adc2d146c43f744340c34a470f814e74c) Keep Datacat fallback notice in empty state ### 📊 Changes **3 files changed** (+183 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/bot_browser.rs` (+144 -2) 📝 `src/features/shell/bot-browser/components/BotBrowserView.tsx` (+28 -10) 📝 `src/features/shell/bot-browser/types/provider-responses.ts` (+11 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1874 ## Why this change - DataCat's Fresh endpoint currently returns HTTP 200 with malformed JSON, which bubbles through the bot browser as `error decoding response body`. - The DataCat browser should still show character tiles instead of failing the whole provider when the Fresh endpoint is malformed. ## What changed - Added a narrow DataCat Fresh fallback in the Rust bot-browser command: only `upstream_json_error` from the Fresh endpoint falls back to DataCat `recent-public`. - Validates the recent-public fallback payload before reshaping it so bad fallback input stays an upstream error. - Adapted the recent-public response into the existing Fresh response shape (`windows.last24h.characters`) and marks the unobservable `thisWeek` bucket unavailable/partial so the degraded response stays honest. - Carries the partial fallback contract through the DataCat response type and Bot Browser rendering path so users see a provider notice while character tiles still render. - Added focused Rust unit tests for the fallback response shape and malformed fallback inputs. ## Refactor impact Primary owner: Rust storage / bot browser provider commands. Impact areas reviewed: - `src-tauri/src/commands/storage/bot_browser.rs` - `src/features/shell/bot-browser/components/BotBrowserView.tsx` - `src/features/shell/bot-browser/types/provider-responses.ts` - Hostable `bot_browser_get` remote-runtime path - DataCat `fresh`, `recent`, and `tags` command paths Boundary notes: - The fix stays in `src-tauri`, where the upstream DataCat transport/response contract is owned. - React bot-browser code consumes the partial fallback marker as a notice while continuing to render the existing `last24h` character shape. Pressure points touched: - DataCat branch of the bot browser storage command. ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri\Cargo.toml datacat_recent_fallback` passed. - Live before proof: DataCat Fresh returned HTTP 200 and failed JSON decoding with `unexpected end of hex escape`. - Production remote-runtime proof after fix: `bot_browser_get` for `/bot-browser/datacat/fresh?sortBy=score&limit24=80&limitWeek=0` returned `fresh_count=50 top_last24h_count=50 week_count=0 week_unavailable=True partial=True unavailable_windows=thisWeek success=True fallback_source=recent-public sortBy=recent-public`. - Adjacent checks: `datacat/recent?limit=80&offset=0` returned `recent_count=50 totalCount=212807`; `datacat/tags` returned `tags_count=58445 groups=6`. - `pnpm typecheck` passed after the Bot Browser fallback-notice wiring. - `pnpm check` passed after the Rust and UI follow-ups. - Proof gist: https://gist.github.com/cha1latte/706f5818514066cb6f88141b40cd4f57 - Raw proof output: https://gist.githubusercontent.com/cha1latte/706f5818514066cb6f88141b40cd4f57/raw/e0a69808512a9ac213d0578cadefa958ba8b4738/datacat-proof-output.txt ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix only; no new discoverable behavior. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - Issue screenshot shows the visible failure state: `error decoding response body`. - This fix was verified through the production `bot_browser_get` remote-runtime command path rather than the desktop shell. Reviewer-visible command proof is linked above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The bot browser now gracefully falls back to alternative data sources when fresh data is unavailable, ensuring uninterrupted access to bot listings. * Added informational notices that appear when the app retrieves data from fallback sources, keeping users informed about data availability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:19 +07:00
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#5331
No description provided.