Skip to content

chore: code quality cleanup#127

Merged
araujof merged 8 commits into
devfrom
chore/code_quality
Jul 22, 2026
Merged

chore: code quality cleanup#127
araujof merged 8 commits into
devfrom
chore/code_quality

Conversation

@araujof

@araujof araujof commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes dead code across crates and resolves aislop findings, with documentation touch-ups.

  • Remove dead code across Rust crates and Go bindings
  • Fix findings in rust docs and drop internal plan/spec cross-references from comments

Code changes

The PR is ~95% comment and doc cleanup. Actual code changes are confined to three files.

Behavior change

  • crates/cpex-ffi/src/lib.rs — cpex_wait_background: the null bg_handle path used to rmp_serde::to_vec_named(&empty).unwrap(). It now matches the result and returns RC_SERIALIZE_ERROR instead of panicking across the FFI boundary. Serializing an empty vec never actually fails, so the practical effect is nil, but the failure mode changed from panic to typed error code.

Panic-safety only (no behavior change)

  • crates/cpex-ffi/src/lib.rs — alloc_bytes / cpex_free_bytes: Layout::from_size_align(...).unwrap() → .expect(...). Message only.
  • crates/apl-core/src/parser.rs — six .unwrap() → .expect("... checked above") in the parse helpers, each guarded by a prior length check.

Refactor (pure code movement)

  • crates/apl-core/src/parser.rs — parse_stage's inline match arms (mask, redact, len, enum, regex, validate, plugin/run) extracted into seven private helper functions. The validate(...) compile-time rejection and empty-plugin-name guard are preserved verbatim.

Cleanup (behavior preserving)

  • builtins/plugins/elicitation-ciba/src/approver.rs — parse_duration_secs: replaced if s.is_empty() { return None } + .chars().last().unwrap() with let last = s.chars().last()?;. Empty input still yields None.

Cosmetic (no logic)

  • crates/apl-core/src/evaluator.rs — comment edits only.
  • go/cpex/identity.go — gofmt re-alignment of the TokenSource* const block (string values unchanged) plus comment edits.

No public API, signatures, struct fields, enum variants, dependencies, or test assertions changed.

araujof added 8 commits July 18, 2026 21:29
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Puts back the ~25 substantive doc/rationale blocks the comment cleanup
over-removed (FFI ABI contract, capability security docs, session-spoofing
note, wire-contract refs, bug rationale). Keeps the code improvements and
banner/blank-line removals. No code changes; workspace builds and tests pass.

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Strips R#/KD#/C# requirement-plan IDs, E#/Slice/step/sub-step impl-plan
labels, P0-#/Finding review IDs, internal spec § refs, and internal
plan/spec/design/runbook doc-filename pointers from comments and doc-comments.
Reworded prose to read cleanly. Kept T0/T1/T2 session-tier labels and
external-standard citations (RFC/OIDC/OAuth §). No behavior changes;
workspace builds and 939 tests pass.

Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
@araujof
araujof marked this pull request as ready for review July 22, 2026 00:58
@araujof
araujof requested review from jonpspri and terylt as code owners July 22, 2026 00:58
@araujof araujof added this to CPEX Jul 22, 2026
@araujof araujof added this to the 0.2.3 milestone Jul 22, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in CPEX Jul 22, 2026
@araujof araujof moved this from Backlog to In review in CPEX Jul 22, 2026
@araujof araujof added enhancement New feature or request framework Rust labels Jul 22, 2026

@terylt terylt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@araujof
araujof merged commit baa9e17 into dev Jul 22, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in CPEX Jul 22, 2026
@araujof
araujof deleted the chore/code_quality branch July 22, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request framework Rust

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants