Skip to content

fix: resolve storage entry collision by adding storeId and refactor s… - #20

Merged
buivietphi merged 2 commits into
mainfrom
feat/inspector-improvements
Aug 8, 2026
Merged

buivietphi merged 2 commits into
mainfrom
feat/inspector-improvements

Conversation

@buivietphi

@buivietphi buivietphi commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

…tate inspector with tabbed JSON view

Description

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation update
  • Performance improvement
  • CI/CD or build configuration
  • Other (describe below)

Testing

  • Tested on macOS
  • Tested on Windows
  • Flutter analyze passes
  • SDK build passes (if applicable)

Screenshots (if applicable)

Summary by CodeRabbit

  • New Features
    • Storage entries now distinguish between separate instances or namespaces, improving organization when multiple stores share a type.
    • State comparisons now provide independent Tree and Pretty views for both Before and After data.
  • Bug Fixes
    • Selected event details remain visible while event data refreshes or is temporarily cleared.
    • Console entries and storage events now refresh reliably without losing newly received records.
    • Storage reports display the specific instance label when available.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@buivietphi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 31141296-5297-4803-9396-abdfafbc1b32

📥 Commits

Reviewing files that changed from the base of the PR and between 526b781 and 461e932.

📒 Files selected for processing (1)
  • lib/features/all_events/presentation/pages/all_events_page.dart
📝 Walkthrough

Walkthrough

The PR adds instance-specific storage identity across reporting, parsing, modeling, and retention. It also preserves selected event details during refreshes, replaces console entries consistently, and gives Before and After state views independent Tree/Pretty tabs.

Changes

Storage identity flow

Layer / File(s) Summary
Storage instance identity and retention
client_sdks/devconnect-react-native/src/reporters/mmkvReporter.ts, lib/server/ws_message_handler.dart, lib/models/storage/storage_entry.dart, lib/features/storage_viewer/provider/storage_providers.dart
MMKV reports include mmkv:<label>. The server parses the type and optional storeId. StorageEntry stores the identifier. The viewer appends each event and applies retention trimming.

Event selection persistence

Layer / File(s) Summary
Pinned event detail state
lib/features/all_events/presentation/pages/all_events_page.dart
The detail panel pins the selected event, synchronizes it with refreshed data, and clears it when selection, all events, or the panel is cleared.

Console refresh handling

Layer / File(s) Summary
Console entry replacement
lib/features/console/presentation/pages/console_page.dart
Filtered-entry updates replace the list, synchronize counts, increment _generation, rebuild the page, and conditionally auto-scroll.

State inspection viewers

Layer / File(s) Summary
Independent Before and After tabs
lib/features/state_inspector/presentation/pages/state_inspector_page.dart
The parent JSON mode toggle was removed. Before and After views now each provide local Tree and Pretty tabs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MMKVReporter
  participant WebSocketHandler
  participant StorageEntry
  participant StorageNotifier
  MMKVReporter->>WebSocketHandler: send mmkv:<label> storage type
  WebSocketHandler->>StorageEntry: parse storage type and storeId
  StorageEntry->>StorageNotifier: append distinct storage event
Loading

Possibly related PRs

Suggested reviewers: phibvcfc

Poem

Labels ride in on storage streams,
Each namespace keeps its name.
Events stay pinned through refreshes,
Tree and Pretty share the frame.
Console entries march in order.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the storage collision fix and the state inspector refactor, which match the pull request objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/inspector-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
lib/features/state_inspector/presentation/pages/state_inspector_page.dart (2)

609-628: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Show the required saved toast after capture succeeds.

Line 635 captures the composed widget, but _takeScreenshot does not call showScreenshotSavedToast from toast_utils. Await successful capture and show the toast before returning control to the user.

As per path instructions, “Screenshot should use showScreenshotSavedToast from toast_utils.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/features/state_inspector/presentation/pages/state_inspector_page.dart`
around lines 609 - 628, Update _takeScreenshot to await the composed-widget
capture successfully, then call showScreenshotSavedToast from toast_utils before
returning control to the user. Keep the toast invocation after capture
completion so it is shown only when the screenshot is saved.

Source: Path instructions


609-628: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use a non-flex state view for screenshot capture.

Lines 609 and 628 insert _StateJsonTabView into screenshotWidget. _StateJsonTabView contains Expanded at Line 752, but the screenshot Column has intrinsic-height constraints. Flutter can throw a RenderFlex unbounded-height exception when the user captures a screenshot.

Use a screenshot-only state viewer without Expanded, or give each captured tab view a finite height.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/features/state_inspector/presentation/pages/state_inspector_page.dart`
around lines 609 - 628, The screenshot layout around the “Before” and “After”
_StateJsonTabView instances must avoid unbounded-height flex constraints from
the Expanded used inside _StateJsonTabView. Provide a screenshot-specific state
viewer without Expanded, or constrain each captured state view to a finite
height, while preserving the existing interactive viewer behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/features/all_events/presentation/pages/all_events_page.dart`:
- Around line 75-82: The refresh synchronization around `_selectedEventId` must
not clear `_pinnedSelectedEvent` when `_findEvent(selectedId)` returns null
because the refreshed `_events` omits the selected entry. Update this block to
replace the pinned event only when a matching event is found, while preserving
the existing pinned value otherwise; continue clearing it only through explicit
selection or reset paths.

---

Outside diff comments:
In `@lib/features/state_inspector/presentation/pages/state_inspector_page.dart`:
- Around line 609-628: Update _takeScreenshot to await the composed-widget
capture successfully, then call showScreenshotSavedToast from toast_utils before
returning control to the user. Keep the toast invocation after capture
completion so it is shown only when the screenshot is saved.
- Around line 609-628: The screenshot layout around the “Before” and “After”
_StateJsonTabView instances must avoid unbounded-height flex constraints from
the Expanded used inside _StateJsonTabView. Provide a screenshot-specific state
viewer without Expanded, or constrain each captured state view to a finite
height, while preserving the existing interactive viewer behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 291038fb-5801-42c4-9ee8-39fdca1efc56

📥 Commits

Reviewing files that changed from the base of the PR and between 2684613 and 526b781.

⛔ Files ignored due to path filters (5)
  • docs/superpowers/specs/2026-08-07-state-page-tree-json-tabbar-design.md is excluded by none and included by none
  • lib/models/storage/storage_entry.freezed.dart is excluded by !**/*.freezed.dart and included by lib/**
  • lib/models/storage/storage_entry.g.dart is excluded by !**/*.g.dart and included by lib/**
  • test/features/storage_viewer/storage_notifier_test.dart is excluded by none and included by none
  • test/server/ws_message_handler_test.dart is excluded by none and included by none
📒 Files selected for processing (7)
  • client_sdks/devconnect-react-native/src/reporters/mmkvReporter.ts
  • lib/features/all_events/presentation/pages/all_events_page.dart
  • lib/features/console/presentation/pages/console_page.dart
  • lib/features/state_inspector/presentation/pages/state_inspector_page.dart
  • lib/features/storage_viewer/provider/storage_providers.dart
  • lib/models/storage/storage_entry.dart
  • lib/server/ws_message_handler.dart

Comment thread lib/features/all_events/presentation/pages/all_events_page.dart
@buivietphi
buivietphi merged commit a6183e3 into main Aug 8, 2026
5 checks passed
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