Skip to content

fix(app): stop reporting a failed template install as success - #10100

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
aryanorastar:fix/10074-app-install-feedback
Jul 20, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
aryanorastar:fix/10074-app-install-feedback

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Creating a summary template from a conversation no longer reports "App created and installed!" when the install actually failed. The sheet now installs through AppProvider.toggleApp — the existing owner of enable/disable — and reports the real outcome: on failure the user sees Failed to install {app}. Please try again. (existing l10n string) plus the provider's standard error dialog, instead of a false success and the summarized-apps picker.
  • AppProvider.toggleApp now returns Future<bool> (whether the toggle stuck). All existing callers ignore the return value and are source-compatible unchanged.

App-side half of #10074; the server-side honor fix landed in #10078's scope (preferred app admitted by the setter is now honored at generation time). This closes the flow that created the never-enabled default in the first place.

Root cause

create_template_bottom_sheet.dart called the raw enableAppServer API and ignored its result (if (success) with no else): a failed enable still showed the success snackbar, opened the picker, and let the user set the never-enabled template as default. Meanwhile AppProvider.toggleApp — used by every other enable surface — already handles the failure path (error dialog, no false local state). Classic sibling-caller divergence; the fix routes the sheet through the shared owner instead of patching the raw call site.

Failure class

Failure-Class: none

No registered class covers a UI flow reporting success for a failed side effect; the nearest theme (one authoritative owner per decision) is the shape of the fix, not a registered class.

Validation

  • Not run locally — this machine has no Flutter SDK (same constraint stated in fix(users): gate multi-language mode by the live STT capability policy #10097). The change is confined to the sheet's install branch and a Future<void> → Future<bool> signature widening; the app CI lane compiles, analyzes, and runs the app test suite over it.
  • No hermetic regression test is included, stated plainly: the sheet's flow calls five top-level API functions (getGeneratedDescriptionAndEmoji, submitAppServer, getAppDetailsServer, plus enable) with no injection seams, and the repo's app tests have no network-mocking harness for them. Introducing that seam is a refactor beyond this fix's scope; the change instead reduces untested surface by deleting a raw API call site in favor of the provider path that every other enable surface already exercises.
  • Reviewed against all toggleApp call sites (chat/page.dart, apps/list_item.dart) — all ignore the return value; app_detail.dart uses its own wrapper, untouched.

Out of scope, named

  • An injectable API seam for app-flow widget tests (would unlock hermetic coverage for this and several sibling sheets) — refactor with its own review.
  • The store/detail surfaces already surface enable failures via the provider dialog; no change needed there.

Review in cubic

Creating a summary template from a conversation called enableAppServer
directly and ignored its result: on failure the sheet still showed
'App created and installed!', opened the summarized-apps picker, and let
the user set the never-enabled template as their default — the app-side
half of BasedHardware#10074 (the server-side honor fix landed in BasedHardware#10078).

The sheet now installs through AppProvider.toggleApp — the existing
owner of enable/disable, which already reverts prefs/app-list state and
shows the failure dialog — and reports the real outcome: success keeps
the current flow, failure shows 'Failed to install {app}' instead of a
false success, and the created-but-not-installed template stays visible
in the store to retry. toggleApp now returns whether the toggle stuck
(all existing callers ignore the return, unchanged).

Not run locally (no Flutter SDK on this machine): change is confined to
the sheet's install branch and a Future<void>->Future<bool> provider
signature; app CI lane compiles and analyzes it.

Failure-Class: none

Co-Authored-By: Claude Fable 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @aryanorastar — this is a clean, well-scoped fix. Routing the create-template install through AppProvider.toggleApp (the existing single owner of enable/disable, prefs, and failure UX) rather than the raw enableAppServer call is the right structural fix, not just a patched call site.

Quick review notes:

  • Static-checked toggleApp: all return paths are covered (early return false on in-flight toggle, return success at the end), and the existing failure dialog + snackbar path now fires correctly.
  • Future<void> → Future<bool> widening is source-compatible — all other callers (list_item.dart, chat/page.dart, etc.) fire-and-forget the result, so they are unaffected.
  • Verified failedToInstallApp is present in app_en.arb and AppSnackbar.showSnackbarError exists, so the new error branch resolves.
  • Latest CI on this head is green (analyze, flutter tests, generated files, Android smoke all pass). No security/dependency/workflow surfaces touched.

One ask before this lands: a small widget/unit test covering the failed-install branch (the exact regression this PR fixes), so the false-success path cannot silently return. Added needs-tests for that.

Not approving formally (human maintainer sign-off on the UX/string choice), but this looks good to merge once a regression test is added.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the needs-tests PR introduces logic that should be covered by tests label Jul 20, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed by automated PR reviewer — scoped, correct, CI acceptable. Approving + merging.

@kodjima33
kodjima33 merged commit d134754 into BasedHardware:main Jul 20, 2026
29 of 33 checks passed
Git-on-my-level pushed a commit that referenced this pull request Jul 21, 2026
Follow-up to #10100 which changed toggleApp from Future<void> to
Future<bool> routed the create-template sheet through it. The
reviewer requested a test covering the failure path so the
false-success regression cannot return silently.

Adds a minimal test seam (enableAppOverride) to AppProvider to
allow mocking enableAppServer without a mocking library.

Test: app/test/providers/app_provider_toggle_test.dart
- toggleApp returns false when enableAppServer fails
- toggleApp returns true when enableAppServer succeeds
Git-on-my-level pushed a commit that referenced this pull request Jul 21, 2026
Follow-up to #10100 which changed toggleApp from Future<void> to
Future<bool> routed the create-template sheet through it. The
reviewer requested a test covering the failure path so the
false-success regression cannot return silently.

Adds a minimal test seam (enableAppOverride) to AppProvider to
allow mocking enableAppServer without a mocking library.

Test: app/test/providers/app_provider_toggle_test.dart
- toggleApp returns false when enableAppServer fails
- toggleApp returns true when enableAppServer succeeds
Git-on-my-level added a commit that referenced this pull request Jul 21, 2026
…10121)

# Summary

Adds a regression test for the failed-install branch that PR #10100
fixed. The PR changed `toggleApp` from `Future<void>` → `Future<bool>`
and routed the create-template sheet through it. The reviewer
[requested](#10100 (comment))
a test covering the failure path so the false-success regression cannot
silently return.

# Changes

## `app/lib/providers/app_provider.dart` (+10/-3)

Adds two minimal test seams:

| Seam | Purpose |
|------|---------|
| `enableAppOverride` | Mocks `enableAppServer` in tests for the
failed-install branch |
| `disableAppOverride` | Mocks `disableAppServer` for the disable path |

Both fall through to the real functions when null — existing callers
unaffected.

## `app/lib/utils/alerts/app_dialog.dart` (+3/-1)

Makes `AppDialog.show()` null-safe: returns early when no navigator is
mounted. Prevents a hard crash on the failure path in edge-case
production scenarios and in tests without a widget tree.

## `app/test/providers/app_provider_toggle_test.dart` (new, ~85 lines)

Three tests, all pure `test()` (no widget tree needed):

| Test | What it covers |
|------|---------------|
| `returns false when enableAppServer fails (regression guard)` | The
exact regression #10100 fixed — `toggleApp` must surface failure to its
caller |
| `returns true when enableAppServer succeeds` | Happy path — the
override is plumbed correctly and success propagates |
| `does not call enableAppOverride when disabling` | Disable path uses
its own override, not the enable one |

# Verification

```
$ flutter test test/providers/app_provider_toggle_test.dart
00:00 +3: All tests passed!
```

Existing provider tests also pass (no regressions):

```
$ flutter test test/widget_test.dart test/providers/add_app_provider_test.dart
00:00 +20: All tests passed!
```

pre-push checks: 10/10 passed.
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 22, 2026
…on (BasedHardware#10074)

BasedHardware#10100 fixed the quick-template sheet so a failed install is reported as
an error instead of a false success, but shipped without a regression
test: the decision was inline in the widget's post-await branch, which a
hermetic test can't reach without a full widget harness (five stubbed
API calls plus path_provider channels).

This extracts only that decision — the success/error polarity of the
terminal outcome — into templateCreationOutcomeIsError, a pure function
the sheet now derives its install-branch snackbar from. Orchestration,
analytics timing, getApps ordering, and the mounted gating are all
byte-identical to BasedHardware#10100; the only change is that the install branch
sources its success/error choice from the tested classifier instead of
an inline bool, so the failed-install-reads-as-success regression cannot
be silently reintroduced.

Tests pin the full outcome table, including installFailed -> error (the
BasedHardware#10074 guarantee) and installed/createdWithoutInstall -> success. Pure
unit tests, no widget pumping, no plugin channels.

Not run locally (no Flutter SDK on this machine); hermetic, app CI lane
runs them.

Co-Authored-By: Claude Fable 5 <[email protected]>
undivisible added a commit that referenced this pull request Jul 24, 2026
…on (#10074) (#10170)

# Summary

The regression test #10100 deferred. #10100 fixed the quick-template
sheet so a failed install is surfaced as an **error** instead of a false
success (#10074), but shipped **without a regression test** — the
decision lived inline in the widget's post-`await` branch, unreachable
by a hermetic test without a full widget harness (five stubbed API calls
plus `path_provider` platform channels).

This extracts **only that decision** — the success/error polarity of the
terminal outcome — into `templateCreationOutcomeIsError`, a pure
function the sheet now derives its install-branch snackbar from.
Everything else is byte-identical to #10100.

- New `TemplateCreationOutcome` enum + `templateCreationOutcomeIsError`
(one pure file, no Flutter deps).
- The sheet's install branch sources its success/error choice from the
classifier instead of an inline `bool`; the arm order flips
(error-first) but the behavior is identical.
- Unit tests pin the full outcome table, including `installFailed →
error` — the #10074 guarantee — so the failed-install-reads-as-success
regression cannot be silently reintroduced.

## Behavior identity (verified line-by-line)

Diff is the import line + the install-branch arm-swap; **nothing else in
`_createTemplate` changed**. Confirmed unchanged vs the #10100 baseline:
`quickTemplateCreated` analytics timing (still fires on submit success,
before install), `getApps()` ordering (still before install), the `if
(mounted && createdApp != null)` gating (so a mid-flow sheet dismissal
still cancels install exactly as before), the
`createdWithoutInstall`/`submitFailed` branches, and the catch block.

- `success → installed → not error → appCreatedAndInstalled +
summarized-apps sheet`
- `!success → installFailed → error → failedToInstallApp` (provider
already showed its dialog)

## Failure class

Failure-Class: none

`test:` commit — adds the regression coverage a prior `fix:` (#10100)
deferred; no new triggering defect.

## Product invariants affected

none (verified with `scripts/pr-preflight --suggest`)

## Validation

- Five hermetic unit tests
(`app/test/unit/template_creation_outcome_test.dart`) pin the table:
`installFailed → true` and `submitFailed → true` (errors); `installed →
false` and `createdWithoutInstall → false` (success); plus an
exhaustiveness assertion that exactly `{submitFailed, installFailed}`
read as errors. Each calls the exact function production calls —
flipping the classifier fails the test.
- **Not run locally — no Flutter SDK on this machine** (same stated
constraint as #10097/#10100/#10126, all merged/approved); tests are
hermetic and the app CI lane runs them.
- Behavior identity and analyzer-cleanliness (imports used, exhaustive
switch, no `use_build_context_synchronously` regression,
`createdApp.name` non-null promotion intact) independently reviewed
against the #10100 baseline before opening.
- `make preflight` (local lane, this PR body) → all selected checks
pass.

## Out of scope, named

- The `submitFailed`/`createdWithoutInstall` outcomes are classified and
tested but the sheet's other two branches still snackbar inline (they
were never the #10074 surface and have a single, unconditional
polarity). Routing them through the classifier too would be ceremony,
not safety.
- A broader flow-orchestration extraction was considered and dropped: it
drifted analytics timing, `getApps()` ordering, and mid-dismiss install
behavior for no gain over this focused pin.

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10170?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
undivisible added a commit that referenced this pull request Jul 24, 2026
…nt mirror (after #10097) (#10126)

# Summary

Follow-up to #10097, doing exactly what its out-of-scope note and
Git-on-my-level's review both pointed at: the client-side mirror of
`MODULATE_SUPPORTED_LANGUAGES` is deleted, and the app trusts the
`single_language_mode` the server already returns from `PATCH
/v1/users/language`.

- `setUserPrimaryLanguage` now returns the server-decided mode (`bool?`,
null on any failure) instead of discarding the parsed field;
`updateUserPrimaryLanguage` syncs local state from that response.
- No eligibility decision remains client-side — future policy changes
(new languages, provider swaps) reach the app with zero client releases
and zero drift risk.
- **Stacked on #10097** (its branch is the base of this diff; merge it
first — this PR then shows only the one commit).

# Why now

#10097 made the mirror byte-for-byte correct; the review verified that
equality manually. That manual verification is exactly the maintenance
burden this removes: the wire response is the contract, so the list and
its normalization helper go away entirely.

# Failure class

Failure-Class: none

This PR's own commit is a `refactor:` with no triggering defect; the
declaration covers the stacked #10097 `fix:` commit in this diff range
(same call as #10097's own body — divergent read-side policy copies, no
registered class).

# Product invariants affected

none (verified with `scripts/pr-preflight --suggest`)

# Validation

- The mirror's unit test is replaced by a wire-contract test
(`app/test/unit/language_update_response_test.dart`): the response
carries `single_language_mode`, both values round-trip, and a response
missing the field **fails loudly instead of defaulting** — the property
that makes trusting the server safe.
- **Not run locally — no Flutter SDK on this machine** (same stated
constraint as #10097/#10100, both since approved/merged); the test is
hermetic and the app CI lane compiles and runs it.
- Call-site sweep: `setUserPrimaryLanguage` has exactly one consumer
(`updateUserPrimaryLanguage`);
`supportsLiveMultilingualMode`/`multiLanguageSupported` have zero
remaining references after deletion.
- `make preflight` (local lane, this PR body) → all selected checks
pass.

# Out of scope, named

- Offline-set language: with no client list, local
`single_language_mode` state updates only on a successful server
response — identical to today's behavior for the persisted preference
(the server was already the only writer of the durable value; the mirror
only fed optimistic local state).

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10126?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-tests PR introduces logic that should be covered by tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants