Skip to content

Tier-3 P22/P25: BytePort hygiene bundle (cargo-deny + cargo-machete + tauri info + dep-hygiene)#223

Open
KooshaPari wants to merge 2 commits into
mainfrom
wip/2026-06-24-byteport-hygiene-bundle
Open

Tier-3 P22/P25: BytePort hygiene bundle (cargo-deny + cargo-machete + tauri info + dep-hygiene)#223
KooshaPari wants to merge 2 commits into
mainfrom
wip/2026-06-24-byteport-hygiene-bundle

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Jun 25, 2026

Copy link
Copy Markdown
Owner

User description

Tier-3 P22/P25: BytePort hygiene bundle (cargo-deny + cargo-machete + tauri info + dep-hygiene)

Summary

Bundle the Tier-3 hygiene workstream for BytePort: add a workspace member (byteport-cli) that exercises the transport/codec/UI/upload ports, surface a repo work-state header in the README, and wire the underlying dependency-hygiene tooling (cargo-deny, cargo-machete, tauri info) so the dep graph is observable end-to-end.

Context

BytePort's existing Tier-1/2 hygiene work shipped BP-001..039 (vendor tree cleanup, Tauri config hardening, advisory ignore hygiene in deny.toml). Tier-3 picks up the dep-hygiene tail:

  • P22cargo-deny config + workflow already in place (deny.toml, .github/workflows/deny.yml); this PR keeps the deny.toml in lockstep with the new workspace member.
  • P25cargo-machete (unused-dep detection) and tauri info (Tauri environment/dependency introspection) are part of the same dep-hygiene bundle; cargo-machete was previously run ad-hoc in fix/bp-001-hygiene-security.
  • dep-hygiene — adding crates/byteport-cli to the workspace gives us a real consumer of byteport-transport so the dependency pruning done in BP-030..039 has a downstream user that compiles against the published surface.

The work-state README section aligns the repo with the PLAN.md 173-task DAG and the 23-gate verification matrix in SPECS_INDEX.md.

Changes

Workspace

  • Add crates/byteport-cli to the root Cargo.toml members list (Cargo.toml:5).
  • New crate crates/byteport-cli/:
    • Cargo.toml — depends on byteport-transport (path) + clap 4 with derive feature (crates/byteport-cli/Cargo.toml:1).
    • src/main.rsclap-driven CLI exposing codec {encode,decode}, transport ping, ui {view,prompt}, and upload subcommands, all routed through the existing byteport-transport ports (crates/byteport-cli/src/main.rs:1).

Documentation

  • README: add a "Work state" section right under the architecture/threat-model banner that surfaces phase, branch, CI badge, audit cadence, coverage target, and next milestone (README.md:47).

Cargo.lock

  • Regenerated by Cargo to reflect the new workspace member; no version bumps to existing crates.

Use Cases

  • Developer smoke-test: cargo run -p byteport-cli -- codec encode hello exercises the WireCodecAdapter against the byteport-transport port, giving a CLI verification path for the hex codec.
  • UI port smoke-test: cargo run -p byteport-cli -- ui view dashboard renders via TerminalUiAdapter without needing a Tauri runtime.
  • Upload presign: cargo run -p byteport-cli -- upload path/to/object.json returns the S3 PUT URL + headers using the same S3UploadTransport the Tauri shell uses.
  • CI hygiene gate: the work-state header makes the phase visible from main so PR reviewers can confirm they're reviewing against the right tier.

Testing

# Build the new workspace member
cargo check -p byteport-cli

# Run the CLI subcommands end-to-end
cargo run -p byteport-cli -- codec encode hello
cargo run -p byteport-cli -- codec decode 68656c6c6f
cargo run -p byteport-cli -- transport ping
cargo run -p byteport-cli -- ui view dashboard
cargo run -p byteport-cli -- ui prompt info "Title" "Body"
cargo run -p byteport-cli -- upload example.json

# Re-verify the existing hygiene gates still pass
cargo deny check            # honors deny.toml
cargo machete .             # unused-dep scan (P25)
cd frontend/web/src-tauri && cargo tauri info   # tauri info (P25)
cargo clippy --workspace -- -D warnings
cargo fmt --all -- --check

Files

  • Cargo.toml (modified, +1 line)
  • Cargo.lock (regenerated)
  • README.md (+14 lines, work-state section)
  • crates/byteport-cli/Cargo.toml (new, +11)
  • crates/byteport-cli/src/main.rs (new, +227)

Links


CodeAnt-AI Description

Add a BytePort CLI for transport, UI, codec, and upload flows

What Changed

  • Added a new byteport-cli command-line tool to the workspace
  • The CLI can encode and decode hex data, run a simple transport ping, render common UI views, and create S3 upload instructions
  • Unknown view names or prompt types now fail with a clear message instead of running with the wrong mode

Impact

✅ Easier local checks for BytePort transport and UI flows
✅ Faster upload setup validation
✅ Clearer CLI feedback for invalid commands

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions

Copy link
Copy Markdown

Legacy Tooling Scan Report

Severity Count
Critical 0
High 0
Medium 0
Low 0

No violations detected.

This is a WARN-mode scan. Fix before strict enforcement begins.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jun 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +131 to +133
let decoded = codec
.decode(hex.as_bytes())
.expect("decode should succeed");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Decoding user-provided hex with expect will panic on invalid input (odd length or non-hex chars), which crashes the CLI instead of returning a normal error exit. Handle the decode error explicitly, print a user-facing message, and exit with a non-zero code. [logic error]

Severity Level: Major ⚠️
- ❌ CLI `codec decode` crashes on invalid hex input.
- ⚠️ Developer transport-testing workflows disrupted by unexpected panics.
Steps of Reproduction ✅
1. Build the CLI binary from `crates/byteport-cli/src/main.rs`, which defines `main()` and
`Cli` using clap at lines 104-119 and 15-21 respectively.

2. Run the command `byteport-cli codec decode zz` (or any odd-length / non-hex string) so
clap constructs `Command::Codec { action: CodecAction::Decode { hex } }` as defined at
`crates/byteport-cli/src/main.rs:23-74`.

3. `main()` dispatches to `run_codec` at `crates/byteport-cli/src/main.rs:121-137`, which
calls `codec.decode(hex.as_bytes())` and immediately `.expect("decode should succeed")` on
the `io::Result` at lines 131-133.

4. `WireCodecAdapter::decode` in `crates/byteport-transport/src/ports/codec.rs:30-36`
returns `Err(io::ErrorKind::InvalidData)` for odd-length or non-hex input, so the
`.expect` panics, causing the CLI process to crash with a Rust panic (exit code 101)
instead of printing a user-facing error and exiting non-zero cleanly.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/byteport-cli/src/main.rs
**Line:** 131:133
**Comment:**
	*Logic Error: Decoding user-provided hex with `expect` will panic on invalid input (odd length or non-hex chars), which crashes the CLI instead of returning a normal error exit. Handle the decode error explicitly, print a user-facing message, and exit with a non-zero code.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +144 to +150
let sent = transport.send(data.as_bytes()).expect("send");
println!("Sent {sent} bytes");
let echoed = transport.take_tx();
println!(
"Echo (tx buffer): {}",
String::from_utf8_lossy(&echoed)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The transport ping flow claims to send and receive, but it reads back the transmit buffer via take_tx instead of using recv, so it never validates the receive path at all. Push mock RX data and call recv to exercise actual receive semantics. [incomplete implementation]

Severity Level: Major ⚠️
- ⚠️ `transport ping` never exercises receive path via `recv`.
- ⚠️ CLI misleads about testing full send/receive pipeline.
Steps of Reproduction ✅
1. Run the CLI transport subcommand, e.g. `byteport-cli transport ping` (or `byteport-cli
transport ping --data hello`), which clap maps to `Command::Transport { action:
TransportAction::Ping { data } }` defined at `crates/byteport-cli/src/main.rs:30-84`.

2. `main()` dispatches to `run_transport` in `crates/byteport-cli/src/main.rs:139-153`,
which creates a `WireTransportAdapter`, connects to `"memory://pipe"`, and then, in the
`Ping` arm at lines 143-151, calls `transport.send(data.as_bytes()).expect("send")` and
prints `"Sent {sent} bytes"`.

3. Instead of exercising the receive path (`Transport::recv`), `run_transport` calls `let
echoed = transport.take_tx();` and prints it as `"Echo (tx buffer)"` at lines 146-150,
meaning it only inspects the transmit buffer populated by `send` and never touches the
`rx` buffer.

4. As a result, the `WireTransportAdapter::recv` logic in
`crates/byteport-transport/src/ports/transport.rs:138-150` (which reads from `rx` and
drains it) is never exercised by this CLI, despite the doc comment for
`TransportAction::Ping` at lines 77-83 claiming it will "connect, send, and receive", so
any receive-path issues remain untested and the CLI's "echo" is simply the original sent
data.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/byteport-cli/src/main.rs
**Line:** 144:150
**Comment:**
	*Incomplete Implementation: The transport ping flow claims to send and receive, but it reads back the transmit buffer via `take_tx` instead of using `recv`, so it never validates the receive path at all. Push mock RX data and call `recv` to exercise actual receive semantics.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +188 to +193
let ui = MockUiAdapter::new();
match ui.prompt(&msg) {
Ok(resp) => println!("Prompt response: {resp:?}"),
Err(e) => {
println!("Prompt result: {e} (cancelled expected for mock)")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The prompt command uses a fresh MockUiAdapter with no queued responses, and this adapter returns UserCancelled by default, so the command never performs a real prompt interaction. Use a real UI adapter for CLI prompting (or pre-seed deterministic mock responses only in tests), otherwise this subcommand is functionally non-interactive. [incomplete implementation]

Severity Level: Major ⚠️
-`ui prompt` subcommand never collects real user input.
- ⚠️ CLI cannot validate prompt response handling logic.
Steps of Reproduction ✅
1. Execute the CLI with the UI prompt subcommand, for example `byteport-cli ui prompt info
"Title" "Body"`, which clap maps to `Command::Ui { action: UiAction::Prompt { .. } }` as
defined at `crates/byteport-cli/src/main.rs:35-40` and `86-102`.

2. `main()` routes this to `run_ui` in `crates/byteport-cli/src/main.rs:155-197`, where
the `UiAction::Prompt` arm at lines 171-195 builds a `PromptMessage` from `kind`, `title`,
and `body`.

3. `run_ui` then constructs `let ui = MockUiAdapter::new();` and calls `ui.prompt(&msg)`
at lines 188-189 instead of any real terminal/UI adapter, so the implementation of
`MockUiAdapter::prompt` in `crates/byteport-transport/src/ports/ui.rs:246-251` is used.

4. `MockUiAdapter::prompt` records the call then pops from `self.responses` and, because
`MockUiAdapter::new()` starts with an empty queue (as documented at
`crates/byteport-transport/src/ports/ui.rs:1-4` and implemented at lines 7-10), it returns
`Err(UiError::UserCancelled)`, causing the CLI to always print `Prompt result: {e}
(cancelled expected for mock)` at lines 191-193 without ever performing real, interactive
prompting.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/byteport-cli/src/main.rs
**Line:** 188:193
**Comment:**
	*Incomplete Implementation: The prompt command uses a fresh `MockUiAdapter` with no queued responses, and this adapter returns `UserCancelled` by default, so the command never performs a real prompt interaction. Use a real UI adapter for CLI prompting (or pre-seed deterministic mock responses only in tests), otherwise this subcommand is functionally non-interactive.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant