Skip to content

Introduce PM3 core API and Desktop CLI backend; remove Android CI and upstream PM3 sync - #26

Merged
Babel36acl merged 1 commit into
mainfrom
codex-qawly9
Sep 4, 2026
Merged

Babel36acl merged 1 commit into
mainfrom
codex-qawly9

Conversation

@Babel36acl

Copy link
Copy Markdown
Owner

Motivation

  • Decouple the GUI from the upstream Proxmark3 build and provide a clear backend contract so desktop features can interact with PM3 in a platform-neutral way.
  • Provide a deterministic MockPm3Backend for feature development and unit tests without hardware.
  • Simplify CI by removing Android builds and the heavy sync-pm3 workflow to reduce CI resource usage and avoid producing upstream binaries in this repo.

Description

  • Add a small PM3 core API under lib/core/pm3/ with Pm3Backend, Pm3Controller, Pm3Command, Pm3ConnectionConfig, Pm3Event, and Pm3Result to standardize backend interactions.
  • Implement a DesktopCliBackend (lib/backend/desktop_cli/desktop_cli_backend.dart) backed by a refactored Pm3Process moved to lib/backend/desktop_cli/pm3_process.dart, including process launching, state mapping and command/response handling.
  • Add a deterministic MockPm3Backend (lib/backend/mock/mock_pm3_backend.dart) for tests and development without hardware.
  • Update application state and UI to use the new controller API and pm3Output stream instead of direct Pm3Process access, and change connection handling to use Pm3ConnectionConfig.
  • Update documentation in README.md to reflect desktop-only focus and the new architecture, and update many UI pages to consume the new output stream abstraction.
  • Remove Android-related CI and scheduled dependency refresh steps from .github/workflows/build.yml, remove Android release/upload from release.yml, and delete the large sync-pm3.yml workflow that built upstream proxmark3 artifacts.
  • Add unit tests for the controller in test/backend/pm3_controller_test.dart to validate connection/execution behavior and error handling.

Testing

  • Ran unit tests with flutter test which executed the new pm3_controller_test.dart suite (2 tests) and they passed.
  • Ensured no regression in the new controller API by running the existing test suite and verifying the two added tests succeed.

Codex Task

@Babel36acl
Babel36acl marked this pull request as ready for review September 4, 2026 09:19
@Babel36acl
Babel36acl merged commit fe759f7 into main Sep 4, 2026
2 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T09:25:46.313461Z 4c4fab6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c4fab6eec

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +81 to +82
if (_config == null || state != Pm3ConnectionState.connected) {
throw StateError('PM3 is not connected');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep disconnected command submissions non-throwing

When no PM3 is connected, the terminal's always-enabled submit handler still calls AppState.sendCommand without awaiting or catching its future. This new guard therefore produces an unhandled asynchronous StateError whenever a user submits a terminal command while disconnected, whereas the previous process adapter emitted [未连接] and returned normally. Preserve that non-throwing behavior or guard the terminal submission path.

Useful? React with 👍 / 👎.

} on ProcessException {
// The settings page lets the user select an explicit client path.
}
return Platform.isWindows ? 'proxmark3.exe' : 'proxmark3';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve detection of a local pm3 launcher

When the client is available only as the common ./pm3 launcher in the working directory and proxmark3 is not installed system-wide, this new fallback initializes the connection page with proxmark3, so connecting fails until the user manually corrects the path. The previous default was ./pm3, and the README still advertises both pm3 and proxmark3; include the local launcher among the detected candidates before falling back.

Useful? React with 👍 / 👎.

Comment on lines +34 to +35
Future<Pm3Result> execute(Pm3Command command, {Duration? timeout}) =>
_backend.execute(command, timeout: timeout);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Serialize overlapping command executions

When a caller invokes execute or send again before the previous future resolves—which the terminal permits because submissions are neither disabled nor awaited—the calls are forwarded concurrently to Pm3Process.sendCommandAndWait. That method clears and polls one shared _responseBuffer, so the later invocation erases the earlier command's captured output and both structured results can contain truncated or interleaved data. Queue executions or otherwise enforce one in-flight desktop command.

Useful? React with 👍 / 👎.

Comment on lines +85 to +88
final output = await _process.sendCommandAndWait(
command.executable,
timeout: timeout ?? const Duration(seconds: 10),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for actual command completion

For hardware commands that emit an initial line and then pause for more than 200 ms while doing work, sendCommandAndWait interprets one unchanged polling interval as completion, so this new execute implementation returns a Pm3Result before the command has finished and omits its later output despite the supplied timeout. This is common for reads, attacks, and scripts; use the PM3 prompt or a reliable command terminator rather than a single short silence interval.

Useful? React with 👍 / 👎.

Comment on lines +10 to +12
ConnectionState({Pm3Controller? controller})
: controller = controller ?? Pm3Controller(DesktopCliBackend()) {
pm3Path = DesktopCliBackend.detectExecutable();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Propagate backend injection into AppState

Although this constructor makes ConnectionState injectable, AppState still unconditionally constructs it as ConnectionState(), and every widget and feature reaches PM3 through that hard-coded AppState. As a result, the newly added MockPm3Backend cannot be used for the advertised hardware-free feature or widget development without replacing application internals; expose this injection point through AppState as well.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant