Skip to content

opt: Improve container parsing and error handling#1001

Merged
lollipopkit merged 11 commits intolollipopkit:mainfrom
GT-610:opt/container
Jan 17, 2026
Merged

opt: Improve container parsing and error handling#1001
lollipopkit merged 11 commits intolollipopkit:mainfrom
GT-610:opt/container

Conversation

@GT-610
Copy link
Collaborator

@GT-610 GT-610 commented Jan 11, 2026

Part of #1000.

This PR focuses on container parsing. It will undergo continuous submission and improvement, and will be transitioned from draft to open once it is fully completed.

Summary by CodeRabbit

  • New Features

    • Commands now return both exit status and captured output.
    • Detection of Podman Docker emulation with a new localized message in many languages.
    • New container error variant for Podman detection.
  • Bug Fixes

    • Fixed layout and text overflow in container statistics display.
    • Server suspend/shutdown/reboot operations now await command completion.
  • Chores

    • Improved null-client handling and safer execution/early-exit flow.
    • Removed macOS path provider plugin registration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

SSH execWithPwd now returns a (exitCode, output) tuple and callers updated. Container provider adds Podman-emulation detection, client/mounted guards, and error-precedence preservation. Server tab callbacks await execWithPwd. UI stat layout tweaked to avoid overflow. New localization keys for Podman detection added.

Changes

Cohort / File(s) Summary
Core SSH Client
lib/core/extension/ssh_client.dart
execWithPwd signature changed from Future<int?> to Future<(int?, String)>; callers updated to destructure and capture output; return value now (exitCode, output).
Container Data Provider
lib/data/provider/container.dart
Uses tuple (code, raw) from execWithPwd; added client-null early return, mounted-state guards, Podman-emulation detection (sets podmanDetected with localized message), filters sudo prompt from output, and preserves earlier errors when parsing fails.
Container Error Types
lib/data/model/app/error.dart
Added podmanDetected member to ContainerErrType enum.
Server Tab Callbacks
lib/view/page/server/tab/utils.dart
Converted suspend/reboot/shutdown callbacks to async and await execWithPwd; apply (null, '') fallback when tuple is missing.
Container Page Layout
lib/view/page/container/container.dart
Adjusted stat width calculation, set Row.mainAxisSize = MainAxisSize.min, wrapped stat text in Expanded with TextOverflow.ellipsis to prevent overflow.
Localization
lib/l10n/*.arb
lib/l10n/app_en.arb, .../app_de.arb, .../app_es.arb, .../app_fr.arb, .../app_id.arb, .../app_ja.arb, .../app_nl.arb, .../app_pt.arb, .../app_ru.arb, .../app_tr.arb, .../app_uk.arb, .../app_zh.arb, .../app_zh_tw.arb
Added podmanDockerEmulationDetected localization key across locales and adjusted surrounding commas for valid ARB syntax.
macOS Generated Plugins
macos/Flutter/GeneratedPluginRegistrant.swift
Removed PathProviderPlugin registration (import and register call deleted).

Sequence Diagram(s)

(omitted — changes are API and plumbing updates without a new multi-component sequential feature requiring visualization)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • fix: container parsing #948 — modifies lib/data/provider/container.dart to harden container parsing and Podman handling; likely related to the Podman-emulation detection and parsing guards.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change—improving container parsing and error handling—which is directly reflected in the changeset's focus on updating execWithPwd return types, enhancing error detection for Podman Docker emulation, and refining container output parsing logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fe464c and eb5c232.

📒 Files selected for processing (1)
  • macos/Flutter/GeneratedPluginRegistrant.swift
💤 Files with no reviewable changes (1)
  • macos/Flutter/GeneratedPluginRegistrant.swift

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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 and usage tips.

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 11, 2026

@coderabbitai Review.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

@GT-610: I'll review the changes in this PR focused on container parsing optimization.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (3)
lib/core/extension/ssh_client.dart (2)

115-151: Potential parsing regression: returned output may include stderr (e.g., sudo password prompt).
If exec() aggregates stderr into the returned string, consumers that parse stdout (like container output split/JSON) can break when sudo prompts/errors appear. Consider excluding stderr from the aggregated output for execWithPwd and relying on onStderr for stderr handling.

Proposed fix (stdout-only output)
 Future<(int?, String)> execWithPwd( String script, { String? entry, BuildContext? context, OnStdout? onStdout, OnStdout? onStderr, required String id, }) async { var isRequestingPwd = false; final (session, output) = await exec( (sess) { sess.stdin.add('$script\n'.uint8List); sess.stdin.close(); }, onStderr: (data, session) async { onStderr?.call(data, session); if (isRequestingPwd) return; if (data.contains('[sudo] password for ')) { isRequestingPwd = true; final user = Miscs.pwdRequestWithUserReg.firstMatch(data)?.group(1); final ctx = context ?? WidgetsBinding.instance.focusManager.primaryFocus?.context; if (ctx == null) return; final pwd = ctx.mounted ? await ctx.showPwdDialog(title: user, id: id) : null; if (pwd == null || pwd.isEmpty) { session.stdin.close(); } else { session.stdin.add('$pwd\n'.uint8List); } isRequestingPwd = false; } }, onStdout: onStdout, entry: entry, + stderr: false, ); return (session.exitCode, output); }

115-151: Update all execWithPwd call sites to consistently handle the record return type.

The SDK supports Dart 3.9.0+ (which supports record types), but call sites are inconsistent. Three calls in lib/view/page/server/tab/utils.dart (lines 52, 66, 80) discard the return value entirely, while two calls in lib/data/provider/container.dart (lines 91, 236) properly destructure it as (code, raw) and (code, _) respectively. Either explicitly destructure the record at all call sites or assign to variables if the return values are unused, for consistency and clarity.

lib/data/provider/container.dart (1)

87-116: Handle client == null explicitly to avoid misleading segmentsNotMatch errors.
Lines 88-92: if client is null, raw stays empty and you’ll fall into the segments-length error path (Lines 106-115). Prefer early-return with a clearer error.

Proposed tweak
 final cmd = _wrap(ContainerCmdType.execAll(state.type, sudo: sudo, includeStats: includeStats)); int? code; String raw = ''; if (client != null) { (code, raw) = await client!.execWithPwd(cmd, context: context, id: hostId); + } else { + state = state.copyWith( + isBusy: false, + error: ContainerErr(type: ContainerErrType.unknown, message: 'SSH client not available'), + ); + return; } if (!ref.mounted) return; state = state.copyWith(isBusy: false);
🧹 Nitpick comments (4)
lib/view/page/server/tab/utils.dart (2)

45-57: Avoid await on a nullable client; make the null-path explicit (and optionally handle the result).
Line 52: prefer final client = srv.client; if (client == null) return; await client.execWithPwd(...) for clearer typing/flow, and consider handling non-zero exit codes now that execWithPwd returns them.

Proposed tweak
 func: () async { if (Stores.setting.showSuspendTip.fetch()) { await context.showRoundDialog(title: libL10n.attention, child: Text(l10n.suspendTip)); Stores.setting.showSuspendTip.put(false); } - await srv.client?.execWithPwd( + final client = srv.client; + if (client == null) return; + await client.execWithPwd( ShellFunc.suspend.exec(srv.spi.id, systemType: srv.status.system, customDir: null), context: context, id: srv.id, ); },

63-75: Consider making _askFor.func awaitable so errors/ordering are observable.
Lines 65-71 and 79-85: these are now async, but _askFor currently invokes func() without awaiting (Line 132), so failures are effectively “fire-and-forget”. If the intent is “wait for completion” for these ops, making _askFor take Future<void> Function() and awaiting it in the OK handler will align behavior.

Proposed tweak (signature + call site)
- void _askFor({required void Function() func, required String typ, required String name}) { + void _askFor({required Future<void> Function() func, required String typ, required String name}) { context.showRoundDialog( title: libL10n.attention, child: Text(libL10n.askContinue('$typ ${l10n.server}($name)')), actions: Btn.ok( - onTap: () { + onTap: () async { context.pop(); - func(); + await func(); }, ).toList, ); }

Also applies to: 77-89

lib/view/page/container/container.dart (1)

233-258: Clamp computed width to avoid negative sizes on very small layouts.
Line 237: cons.maxWidth / 2 - 6.5 can go negative; prefer clamping to >= 0.

Proposed tweak
 builder: (_, cons) { - final width = cons.maxWidth / 2 - 6.5; + final width = math.max(0.0, cons.maxWidth / 2 - 6.5); return Column(
lib/data/provider/container.dart (1)

234-252: Tuple destructuring + fallback looks good; consider whether discarding output is intended.
Lines 236-245: (code, _) = ... ?? (null, null) is clean. Just double-check whether some failures only surface on stdout (you currently only return stderr-derived errs when code != 0).

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06070c2 and cffa318.

📒 Files selected for processing (4)
  • lib/core/extension/ssh_client.dart
  • lib/data/provider/container.dart
  • lib/view/page/container/container.dart
  • lib/view/page/server/tab/utils.dart
🧰 Additional context used
📓 Path-based instructions (2)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/container/container.dart
  • lib/view/page/server/tab/utils.dart
lib/data/provider/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

Organize Riverpod providers by feature under lib/data/provider/

Files:

  • lib/data/provider/container.dart
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 

Applied to files:

  • lib/view/page/container/container.dart
  • lib/data/provider/container.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: check
🔇 Additional comments (1)
lib/view/page/container/container.dart (1)

261-283: Expanded + TextOverflow.ellipsis is a solid fix for overflow here.
Lines 271-277: good change to keep stats values single-line without layout exceptions on narrow widths.

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 11, 2026

Noticed. I'll check these comments later.

@lollipopkit
Copy link
Owner

Still a draft?

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 13, 2026

Still a draft?

Yeah. I haven't reviewed CodeRabbit issues yet.
If finished I'll convert draft to Open.

… content Adjust the return type of the `execWithPwd` method to `(int?, String)` so that it can simultaneously return the exit code and output content Fix the issue in ContainerNotifier where the return result of execWithPwd is not handled correctly Ensure that server operations (shutdown/restart/suspend) are correctly pending until the command execution is completed
…ists Support the simultaneous display of multiple container operation errors, enhancing error handling capabilities
…text overflow Adjust the width calculation for the container page layout, changing from subtracting a fixed value to subtracting a smaller value to improve the layout Add overflow ellipsis processing to the text to prevent anomalies when the text is too long
Add detection for Podman Docker emulation in the container module. When detected, a prompt message will be displayed and users will be advised to switch to Podman settings. Updated the multilingual translation files to support the new features.
Fix the issue where the SSH client does not handle stderr when executing commands Error handling for an empty client in the container addition operation Fix the issue where null may be returned during server page operations
@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 17, 2026

@coderabbitai Review.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

@GT-610: I'll review the changes in this PR.


🧠 Learnings used
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 17, 2026

@codex review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@lib/data/provider/container.dart`: - Around line 282-291: The run() method currently falls back to a generic error when client is null; change it to explicitly detect a null SSH client and return/emit ContainerErrType.noClient similar to refresh(), by checking the `client` variable before calling `client?.execWithPwd` (e.g., at start of run()), avoid executing `_wrap`/`execWithPwd` when null, and ensure the state updates (like clearing `runLog`) and error handling (adding appropriate error entry or return value) consistently use `ContainerErrType.noClient` instead of the generic unknown error; reference `client`, `run()`, `refresh()`, `ContainerErrType.noClient`, `execWithPwd`, `runLog`, and `sudoCompleter` to locate where to add the null check and early return. In `@lib/l10n/app_pt.arb`: - Around line 297-298: The ARB file was updated with the new key "podmanDockerEmulationDetected" but the generated localization outputs are stale; run the Flutter localization generator (flutter gen-l10n) to regenerate the localization classes/resources so the new key is compiled into the app, then commit the updated generated files that reference podmanDockerEmulationDetected in the l10n output. In `@lib/l10n/app_ru.arb`: - Around line 297-298: The ARB file was updated (new keys like "podmanDockerEmulationDetected") but the generated localization Dart output wasn't regenerated; run the Flutter l10n generator to update the localization classes by executing `flutter gen-l10n` (or your project's configured gen-l10n command) so the new key appears in the generated LocalizationsDelegate/strings and avoids stale string lookups in code that references the generated localization symbols (e.g., AppLocalizations, lookup methods). 
♻️ Duplicate comments (8)
lib/l10n/app_uk.arb (1)

297-298: Regenerate localizations after ARB update.
Same reminder for ARB changes: run flutter gen-l10n. As per coding guidelines.

lib/l10n/app_nl.arb (1)

297-298: Regenerate localizations after ARB update.
Same reminder for ARB changes: run flutter gen-l10n. As per coding guidelines.

lib/l10n/app_es.arb (1)

297-298: Regenerate localizations after ARB update.
Same reminder for ARB changes: run flutter gen-l10n. As per coding guidelines.

lib/l10n/app_zh_tw.arb (1)

297-298: Regenerate localizations after ARB update.
Same reminder for ARB changes: run flutter gen-l10n. As per coding guidelines.

lib/view/page/server/tab/utils.dart (2)

66-72: Same async callback concern as above.


80-87: Same async callback concern as above.

lib/data/provider/container.dart (2)

162-177: Same Podman detection concern as above.


196-211: Same Podman detection concern as above.

🧹 Nitpick comments (3)
lib/core/extension/ssh_client.dart (1)

115-151: Confirm stdout-only output is sufficient for all execWithPwd callers.

execWithPwd now forces stderr: false and returns only stdout. If any caller relies on stderr (e.g., Docker/Podman diagnostics or emulation banners), that data will be dropped. Consider returning stderr separately or adding a flag, and verify all call sites handle the new tuple return.

lib/view/page/server/tab/utils.dart (1)

52-58: Async dialog action is still fire-and-forget.

_askFor accepts void Function(), so these async closures aren’t awaited; errors can go unhandled and the UI can proceed before the command finishes. Consider making _askFor accept Future<void> Function() and await it in the dialog action.

♻️ Suggested refactor
- void _askFor({required void Function() func, required String typ, required String name}) { + void _askFor({required Future<void> Function() func, required String typ, required String name}) { context.showRoundDialog( title: libL10n.attention, child: Text(libL10n.askContinue('$typ ${l10n.server}($name)')), actions: Btn.ok( - onTap: () { + onTap: () async { context.pop(); - func(); + await func(); }, ).toList, ); }
lib/data/provider/container.dart (1)

132-147: Prefer a single pre-parse Podman emulation check.

Right now detection depends on exception strings in multiple parsers and can miss cases like segment-count mismatches. Consider scanning raw once before parsing and short-circuiting to podmanDetected.

♻️ Suggested refactor
 if (code == 127 || raw.contains(_dockerNotFound)) { state = state.copyWith(error: ContainerErr(type: ContainerErrType.notInstalled)); return; } + if (raw.contains(_podmanEmulationMsg)) { + state = state.copyWith( + error: ContainerErr( + type: ContainerErrType.podmanDetected, + message: l10n.podmanDockerEmulationDetected, + ), + ); + return; + } // Check result segments count final segments = raw.split(ScriptConstants.separator);
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cffa318 and 8218e21.

⛔ Files ignored due to path filters (13)
  • lib/generated/l10n/l10n.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_de.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_en.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_es.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_fr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_id.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ja.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_nl.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_pt.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_ru.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_tr.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_uk.dart is excluded by !**/generated/**
  • lib/generated/l10n/l10n_zh.dart is excluded by !**/generated/**
📒 Files selected for processing (18)
  • lib/core/extension/ssh_client.dart
  • lib/data/model/app/error.dart
  • lib/data/provider/container.dart
  • lib/l10n/app_de.arb
  • lib/l10n/app_en.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_id.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_nl.arb
  • lib/l10n/app_pt.arb
  • lib/l10n/app_ru.arb
  • lib/l10n/app_tr.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_zh.arb
  • lib/l10n/app_zh_tw.arb
  • lib/view/page/container/container.dart
  • lib/view/page/server/tab/utils.dart
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/view/page/container/container.dart
🧰 Additional context used
📓 Path-based instructions (4)
lib/view/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

lib/view/**/*.dart: Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk)
Prefer using libL10n strings before adding new ones to project l10n
Split UI into build, actions, and utils; use extension on to separate concerns

Files:

  • lib/view/page/server/tab/utils.dart
lib/l10n/**/*.arb

📄 CodeRabbit inference engine (CLAUDE.md)

lib/l10n/**/*.arb: After modifying ARB files, run: flutter gen-l10n to regenerate localization
Keep localized strings in ARB files under lib/l10n/ (Flutter i18n)

Files:

  • lib/l10n/app_en.arb
  • lib/l10n/app_zh.arb
  • lib/l10n/app_fr.arb
  • lib/l10n/app_id.arb
  • lib/l10n/app_pt.arb
  • lib/l10n/app_zh_tw.arb
  • lib/l10n/app_uk.arb
  • lib/l10n/app_nl.arb
  • lib/l10n/app_es.arb
  • lib/l10n/app_tr.arb
  • lib/l10n/app_ja.arb
  • lib/l10n/app_ru.arb
  • lib/l10n/app_de.arb
lib/data/model/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

After modifying annotated model files, run: dart run build_runner build --delete-conflicting-outputs

Files:

  • lib/data/model/app/error.dart
lib/data/provider/**/*.dart

📄 CodeRabbit inference engine (CLAUDE.md)

Organize Riverpod providers by feature under lib/data/provider/

Files:

  • lib/data/provider/container.dart
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 

Applied to files:

  • lib/data/model/app/error.dart
  • lib/data/provider/container.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Use Riverpod with code generation (riverpod_annotation) for state management 

Applied to files:

  • lib/data/provider/container.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/server/**/*.dart : Place server management models under lib/data/model/server/ 

Applied to files:

  • lib/data/provider/container.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/view/**/*.dart : Prefer widgets/utilities from fl_lib for common UI (e.g., CustomAppBar, context.showRoundDialog, Input, Btnx.cancelOk) 

Applied to files:

  • lib/data/provider/container.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/view/**/*.dart : Prefer using libL10n strings before adding new ones to project l10n 

Applied to files:

  • lib/data/provider/container.dart
📚 Learning: 2026-01-11T05:42:59.995Z
Learnt from: GT-610 Repo: lollipopkit/flutter_server_box PR: 0 File: :0-0 Timestamp: 2026-01-11T05:42:59.995Z Learning: In lib/data/provider/server/single.dart, the `_updateServer()` method is kept as a separate method (rather than inlined) for abstraction and future extensibility, clearly separating the refresh lock logic from the actual data fetching operation. 

Applied to files:

  • lib/data/provider/container.dart
📚 Learning: 2025-10-08T09:36:41.682Z
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/ssh/**/*.dart : Place SSH models under lib/data/model/ssh/ 

Applied to files:

  • lib/data/provider/container.dart
🔇 Additional comments (14)
lib/l10n/app_zh.arb (1)

304-305: Regenerate localizations after ARB update.
Run flutter gen-l10n so generated localization code stays in sync. As per coding guidelines.

lib/data/model/app/error.dart (2)

19-30: Regenerate model code after updating data models.
Run dart run build_runner build --delete-conflicting-outputs to keep generated artifacts in sync. As per coding guidelines.


19-30: No action required. There are no switch/when statements over ContainerErrType in the codebase, so the new podmanDetected case doesn't need switch statement handling. Unlike SSHErr, ContainerErr doesn't use type-based switching in its solution getter and relies on implicit error handling through the message field.

Likely an incorrect or invalid review comment.

lib/l10n/app_en.arb (1)

307-308: LGTM! New localization key added correctly.

The English source string is clear and provides actionable guidance to the user. As per coding guidelines, ensure you run flutter gen-l10n to regenerate the localization files after these changes are merged.

lib/l10n/app_fr.arb (1)

297-298: LGTM!

French translation is accurate and follows the same structure as the English source.

lib/l10n/app_tr.arb (1)

297-298: LGTM!

Turkish translation is consistent with the English source message.

lib/l10n/app_id.arb (1)

297-298: LGTM!

Indonesian translation is consistent with the English source message.

lib/l10n/app_de.arb (1)

297-298: LGTM!

German translation is accurate and maintains the formal tone ("Sie") consistent with other entries in this locale file.

lib/l10n/app_ja.arb (1)

297-298: LGTM!

Japanese translation is accurate and uses appropriate polite form consistent with the application's tone.

lib/data/provider/container.dart (5)

9-9: No review needed.


22-22: Podman emulation marker constant looks good.


90-100: Null-client guard in refresh is solid.


102-102: No review needed.


235-239: Stats parse guard looks fine.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8218e21670

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

},
onStdout: onStdout,
entry: entry,
stderr: false,

Choose a reason for hiding this comment

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

P2 Badge Preserve stderr so Podman emulation warning is detectable

The new Podman-detection logic in ContainerNotifier.refresh() relies on parsing errors that include the Podman Docker-emulation warning string. However execWithPwd now hard-disables stderr capture (stderr: false), and the Podman warning is emitted on stderr. That means the returned raw stays clean JSON, parsing succeeds, and the errorMsg.contains(_podmanEmulationMsg) branches never trigger, so users running docker via Podman emulation won’t see the new warning. Consider allowing stderr in the returned output for this path or explicitly capturing stderr and checking it for _podmanEmulationMsg.

Useful? React with 👍 / 👎.

When the client is null, directly return an error to avoid null pointer exception
@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 17, 2026

stderr

@coderabbitai We tested the suggested modification but found that it would disrupt the error detection functionality. When Docker/Podman is not installed, a "command not found" error message appears in stderr, and our detection logic relies on this to display the correct error prompt to the user. If stderr is excluded, the detection will fail, the code will continue to execute, and ultimately a type error will be thrown. Therefore, for this specific container usage scenario, we need to keep stderr mixed in the output to ensure correct error detection.

I have reverted this fix.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Tip

For best results, initiate chat on the files or code changes.

@GT-610: Thank you for testing the suggestion and providing this detailed explanation. You're absolutely right—if your error detection logic relies on catching "command not found" messages from stderr to properly handle cases where Docker/Podman isn't installed, then keeping stderr mixed into the output is the correct approach. Excluding it would indeed cause the detection to fail and lead to unhelpful type errors downstream.

I appreciate you taking the time to verify the behavior and explain the reasoning. Your approach makes perfect sense for this use case.


✏️ Learnings added
Learnt from: GT-610 URL: https://github.com/lollipopkit/flutter_server_box/pull/1001 Timestamp: 2026-01-17T04:24:16.472Z Learning: In lib/core/extension/ssh_client.dart and lib/data/provider/container.dart, when executing Docker/Podman commands via SSH, stderr must be included in the output (not set to stderr: false) because the error detection logic relies on stderr messages like "command not found" to properly detect when Docker/Podman is not installed and display appropriate error prompts to users. 

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 
@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 17, 2026

@coderabbitai All l10n files have been re-generated, and I've checked these are in dart code files. Please review.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash # Search for usage of the new localization key podmanDockerEmulationDetected in Dart files rg -n --type=dart "podmanDockerEmulationDetected" -C 3 # Also search for where ContainerErrType.podmanDetected is used rg -n --type=dart "podmanDetected" -C 3 # Check if generated l10n files exist in lib/generated/ fd -t f "l10n" lib/generated/ 2>/dev/null || echo "No lib/generated/l10n directory found or no files" # List files in lib/generated/ to see structure ls -la lib/generated/ 2>/dev/null || echo "lib/generated/ directory not found" 

Length of output: 9747


@GT-610: Perfect! I've verified that the l10n changes are properly implemented. ✅

Verification results:

  1. ARB files: All 13 language files correctly include the new podmanDockerEmulationDetected key with appropriate translations
  2. Generated Dart files: The lib/generated/l10n/ directory contains all properly regenerated localization files with the new getter podmanDockerEmulationDetected
  3. Usage in code: The new localization string is correctly used in lib/data/provider/container.dart at three locations (lines 137, 167, and 201) where Podman Docker emulation is detected
  4. Integration: The ContainerErrType.podmanDetected enum properly corresponds to the localization message

The l10n workflow has been executed correctly, and the new error message will be properly displayed to users when Podman Docker emulation is detected. Everything looks good! 🎉


🧠 Learnings used
Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/data/model/container/**/*.dart : Place container/Docker models under lib/data/model/container/ 

Learnt from: GT-610 Repo: lollipopkit/flutter_server_box PR: 0 File: :0-0 Timestamp: 2026-01-17T04:24:16.472Z Learning: In lib/core/extension/ssh_client.dart and lib/data/provider/container.dart, when executing Docker/Podman commands via SSH, stderr must be included in the output (not set to stderr: false) because the error detection logic relies on stderr messages like "command not found" to properly detect when Docker/Podman is not installed and display appropriate error prompts to users. 

Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/view/**/*.dart : Prefer using libL10n strings before adding new ones to project l10n 

Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/generated/**/*.dart : Do not manually edit files in lib/generated (localization output) 

Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/l10n/**/*.arb : Keep localized strings in ARB files under lib/l10n/ (Flutter i18n) 

Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to lib/l10n/**/*.arb : After modifying ARB files, run: flutter gen-l10n to regenerate localization 

Learnt from: CR Repo: lollipopkit/flutter_server_box PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-10-08T09:36:41.682Z Learning: Applies to **/*.{g,freezed}.dart : Do not manually edit generated Dart files (*.g.dart, *.freezed.dart) 
@lollipopkit
Copy link
Owner

You need to mark as ready for review,then a auto incremental review will be applied

@GT-610 GT-610 marked this pull request as ready for review January 17, 2026 05:19
…r handling Move the Podman simulation detection to the initial parsing stage to avoid redundant checks Remove duplicated error handling code and simplify the logic
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a24e60dce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@GT-610
Copy link
Collaborator Author

GT-610 commented Jan 17, 2026

You need to mark as ready for review,then a auto incremental review will be applied

I know this, and at that time PR was not ready for merge, so I didn't set as ready for review, but I'd use CodeRabbit intentionally for checking code quality.

Now it's ready for merge.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 17, 2026
… execution Increase the inspection of error outputs, including handling situations such as sudo password prompts and Podman not being installed
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 17, 2026
@GT-610 GT-610 changed the title opt: Better performance on container parsing opt: Improve container parsing and error handling Jan 17, 2026
@lollipopkit lollipopkit merged commit 39a3e08 into lollipopkit:main Jan 17, 2026
3 checks passed
@lollipopkit lollipopkit linked an issue Jan 17, 2026 that may be closed by this pull request
@GT-610 GT-610 deleted the opt/container branch January 17, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants