Skip to content

refactor: improve API design, CI enforcement, and test coverage#41

Merged
zircote merged 3 commits intomainfrom
refactor/full-codebase-2026-03-19
Mar 19, 2026
Merged

refactor: improve API design, CI enforcement, and test coverage#41
zircote merged 3 commits intomainfrom
refactor/full-codebase-2026-03-19

Conversation

@zircote
Copy link
Owner

@zircote zircote commented Mar 19, 2026

Summary

  • #[non_exhaustive] on Error and Config for semver safety
  • Config encapsulation: private fields + pub const fn getters
  • SLSA binary name fix: rust-templaterust_template in pipeline.yml
  • Coverage gate enforced: 80% → 90% threshold with exit 1
  • Dockerfile HEALTHCHECK fixed: removed ignored --version arg
  • process() function: gives OperationFailed real usage, eliminates dead code
  • +22 tests: parameterized, trait, property (associativity), binary unit tests
  • Coverage: 79.78% → 97.76% lines, 86.67% → 100% functions

Quality Scores

  • Clean Code: 8/10
  • Architecture: 8/10
  • Security Posture: 7/10

Test plan

  • just check passes (fmt + clippy + test + doc + deny)
  • 42 tests passing, 0 failures
  • 97.76% line coverage, 100% function coverage
  • No security regressions (code-reviewer verified per-iteration)
  • Verify CI passes on PR

Related: #40

- Add #[non_exhaustive] to Error enum and Config struct for semver safety
- Make Config fields private with const getter methods (builder encapsulation)
- Fix SLSA binary name: rust-template → rust_template in pipeline.yml
- Raise coverage gate: 80% → 90% threshold with hard exit 1 failure
- Fix Dockerfile HEALTHCHECK: remove ignored --version argument
- Add process(input: &str) -> Result<i64> eliminating OperationFailed dead code
- Add add_is_associative property test (completing algebraic coverage)
- Add parameterized tests, trait tests, and binary unit tests (+22 tests)
- Document i32→i64 widening strategy and process_numbers helper purpose
- Coverage: 79.78% → 97.76% lines, 86.67% → 100% functions

Clean Code: 8/10 | Architecture: 8/10 | Security Posture: 7/10
Copilot AI review requested due to automatic review settings March 19, 2026 05:12
@github-actions
Copy link
Contributor

Benchmark Results

No benchmarks configured. Add benchmarks to benches/ directory.

Full results available in CI artifacts.

@github-actions
Copy link
Contributor

Mutation Testing Report

Mutation testing output not found

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the public Rust API for better semver safety and encapsulation, tightens CI enforcement (coverage + SLSA artifact naming), and expands the test suite to significantly raise coverage.

Changes:

  • Marked Error and Config as #[non_exhaustive], encapsulated Config fields, and added const getters.
  • Added a new process(&str) -> Result<i64> API and updated call sites/docs to use Config getters.
  • Hardened CI: fixed SLSA binary path, enforced a 90% coverage gate, and adjusted Docker HEALTHCHECK behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/lib.rs Adds process(), marks public types #[non_exhaustive], and encapsulates Config with getters.
crates/main.rs Updates binary to use Config getters and adds basic unit tests for run()/main().
tests/integration_test.rs Updates tests for encapsulated Config + adds property/parameterized/trait tests.
README.md Updates example output formatting and switches to Config getters.
Dockerfile Adjusts HEALTHCHECK invocation for the packaged binary.
.github/workflows/pipeline.yml Fixes SLSA hashing input to use target/release/rust_template.
.github/workflows/ci-coverage.yml Raises coverage threshold to 90% and fails CI when unmet.

You can also share your feedback on Copilot code review. Take the survey.

zircote and others added 2 commits March 19, 2026 02:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@zircote zircote merged commit 88c3135 into main Mar 19, 2026
8 checks passed
@zircote zircote deleted the refactor/full-codebase-2026-03-19 branch March 19, 2026 06:09
@github-actions
Copy link
Contributor

Mutation Testing Report

Mutation testing output not found

@github-actions
Copy link
Contributor

Benchmark Results

No benchmarks configured. Add benchmarks to benches/ directory.

Full results available in CI artifacts.

1 similar comment
@github-actions
Copy link
Contributor

Benchmark Results

No benchmarks configured. Add benchmarks to benches/ directory.

Full results available in CI artifacts.

@github-actions
Copy link
Contributor

Mutation Testing Report

Mutation testing output not found

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants