r/FlutterDev • • Nov 01 '26

Tooling I built emergency recovery and signed patching into my mobile debugging tool, Looking for feedback

Hey everyone,
I’ve been working on two new features for BugCapsule, a debugging tool I’m building for Flutter, native Android, iOS, and Web.
The problem I’m trying to solve is pretty straightforward:
What do you do when a critical bug hits production, but shipping a new app version takes time?
I wanted to connect bug reproduction with production recovery, so I’ve been building two capabilities.
1. Emergency Recovery
For features that have been integrated with the recovery SDK, you can remotely:
Disable a broken feature without shipping a new build.
Switch functionality to read-only or maintenance mode.
Target specific app versions, platforms, or rollout percentages.
Gradually restore features while monitoring crash rates and other health metrics.
Automatically restore restrictions if a rollout fails its health checks.
Policies are cryptographically signed. Sensitive operations, like payments, also need server-side enforcement.
2. Signed Patch Engine (Early Access)
This one has been particularly challenging.
The engine supports updating explicitly registered business logic, UI surfaces, and assets without a full app release.
Patches are tied to an exact base build, signed, validated, and deployed through staged rollouts with rollback support.
It’s intentionally not arbitrary code push. Native code changes, new dependencies, and unregistered functionality still require a store release.
The first Flutter and native iOS prereleases are published. Native Android patch distribution is still in progress, and we’re continuing platform and distribution-policy validation.
Why combine these with debugging?
BugCapsule already captures application state, user actions, and network responses around failures for local deterministic replay.
The workflow I’m aiming for is:
Capture → Reproduce → Mitigate → Fix → Verify → Deploy → Monitor
The idea is to use the same recorded failure to investigate a bug, verify the fix, and prevent regressions in CI.
I’m not claiming this works for every application or every type of bug. The recovery features require prior integration, and patching has strict limitations.
I’m genuinely interested in how other teams approach this.
A few questions:
How do you currently handle critical production bugs while waiting for App Store approval?
Would remote feature controls be useful in your workflow?
What concerns would you have about a signed patching system in production?
I’d especially appreciate feedback on the security model and rollout strategy.
Project: https://bugcapsule.com
Docs: https://docs.bugcapsule.com

2 Upvotes

7 comments sorted by

1

u/Fun-Adhesiveness-362 26d ago

How does this handle pending offline writes? Say someone creates a few records offline, gets a patch when they reconnect, and then you have to roll it back before those records have synced.

Can the older version still read the local data and send the queued writes? I'd be interested in seeing that tested, especially if the patch changes the local schema or the format of queued operations.

1

u/Guilty-Iron1121 26d ago

BugCapsule handles this by keeping patches within the contracts already shipped in the app. The engine checks the registered input/output contracts and rejects incompatible patches. Local schema migrations aren't part of the supported patch scope.

That means you can patch a flow's logic while keeping the existing database and queued-operation format in place. Rolling back switches the patch generation; it doesn't restore an old database snapshot and discard the records the user created offline.

There's still an app-specific detail worth testing: a patch can produce different values within the same allowed type, so contract checks alone can't prove that every queued operation will make sense to the older logic.

Which local database and sync library are you using? That would help pin down the exact offline → patch → rollback → sync test for your flow.

2

u/Fun-Adhesiveness-362 26d ago

We use Flutter with PowerSync, with SQLite locally and PostgreSQL on the backend. The test I'd be interested in is creating a record offline with the patched logic, rolling back before it uploads, then reconnecting. Even without a schema change, a value could pass the patched validation and fail the older logic. Do you have a sample test for that, including what happens to the pending write if it's rejected?

1

u/Guilty-Iron1121 26d ago

You can test it yourself, it’s totally free until 26 nov

1

u/[deleted] Nov 01 '26

[removed] — view removed comment

1

u/Guilty-Iron1121 Nov 01 '26

Really appreciate the detailed feedback! These are exactly the concerns we designed the system around.
On security and code signing: The important part is establishing a strict trust boundary between the control plane and the client. Every patch needs to be cryptographically signed and verified before execution, with unauthorized or tampered payloads rejected. The same principle applies to policy integrity. Rollout permissions and rollback controls are equally important because a valid signature alone doesn’t guarantee a safe deployment.
On rollout safety: Percentage-based rollouts and automated rollback based on health checks are designed to limit the blast radius. A rollout should be stopped when the relevant failure thresholds are exceeded, rather than exposing the entire user base to a potentially broken change.
On propagation latency: You’re absolutely right about the race condition. Real-time propagation and policy enforcement are two different things. An active client may not receive a policy change immediately, particularly during startup, reconnection, or network interruptions.
The key is how the SDK handles that window. For critical features, policy evaluation needs to happen before feature activation, with cached policy expiration and configurable fail-safe behavior. For high-risk operations, server-side enforcement provides an additional layer of protection.
So the goal isn’t to promise zero-latency propagation. It’s to make the behavior predictable and safe even when delivery is delayed.
And I completely agree with your bigger point: a kill switch should never become another single point of failure.
Thanks again for digging into the architecture. This is exactly the kind of technical discussion I was hoping to start!