Skip to content

fix: resolve CI failures by pinning dependencies and formatting code#182

Open
Jeshua Ben Joseph (Theaxiom) wants to merge 4 commits into
mainfrom
fix/code-health-unwrap-11695760045760817900
Open

fix: resolve CI failures by pinning dependencies and formatting code#182
Jeshua Ben Joseph (Theaxiom) wants to merge 4 commits into
mainfrom
fix/code-health-unwrap-11695760045760817900

Conversation

@Theaxiom

Copy link
Copy Markdown
Member
  • Pinned cryptographic dependency versions (e.g., hkdf = "=0.12.4") in the workspace Cargo.toml and explicitly inherited rand_core = "=0.6.4" to prevent trait bound mismatches and missing dependency errors causing the build to fail.
  • Refactored shared/src/crypto.rs to adapt to rand crate downgrade by utilizing rand::thread_rng().fill_bytes() correctly instead of rand::rng().
  • Fixed formatting issues in Python test files to comply with black lint checks.
  • Updated pytest expectation in coordinator/tests/unit/application/test_security_ports.py to handle the new TypeError message string used in the environment for instantiating abstract classes.

- Pinned cryptographic dependency versions (e.g., `hkdf = "=0.12.4"`) in the workspace `Cargo.toml` and explicitly inherited `rand_core = "=0.6.4"` to prevent trait bound mismatches and missing dependency errors causing the build to fail.
- Refactored `shared/src/crypto.rs` to adapt to `rand` crate downgrade by utilizing `rand::thread_rng().fill_bytes()` correctly instead of `rand::rng()`.
- Fixed formatting issues in Python test files to comply with `black` lint checks.
- Updated `pytest` expectation in `coordinator/tests/unit/application/test_security_ports.py` to handle the new `TypeError` message string used in the environment for instantiating abstract classes.

Co-authored-by: Theaxiom <57013+Theaxiom@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 30, 2026 00:45

Copilot AI 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.

Pull request overview

This PR aims to get CI green again by pinning Rust/Python dependency versions, adapting crypto RNG usage to match the rand downgrade, and applying formatting/test expectation fixes across the coordinator and worker.

Changes:

  • Pin Rust crypto-related crate versions in the workspace and adjust shared crypto RNG usage for compatibility.
  • Refactor coordinator job completion APIs to pass a value object (JobCompletionParams) instead of many parameters, updating tests accordingly.
  • Fix Python formatting/lint issues and update a couple of brittle test assertions to match environment error messages.

Reviewed changes

Copilot reviewed 21 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
worker/src/main.rs Runs Axum server in a spawned task and monitors it via tokio::select!.
shared/src/crypto.rs Updates RNG usage for X25519 secret generation and nonce creation after rand changes.
coordinator/tests/unit/test_main_module.py Black-compatible formatting for subprocess cwd arg.
coordinator/tests/unit/infrastructure/persistence/test_database.py Black/quote formatting and minor whitespace cleanup.
coordinator/tests/unit/infrastructure/audit/test_logger.py Adds unit tests for AuditService logging + DB write behavior.
coordinator/tests/unit/infrastructure/audit/init.py Adds package marker for audit unit tests.
coordinator/tests/unit/application/test_security_ports.py Relaxes abstract-class instantiation error message assertion.
coordinator/tests/unit/application/test_orchestration_services.py Updates orchestration tests to use JobCompletionParams.
coordinator/tests/unit/application/test_inference_services.py Black formatting adjustments in tests.
coordinator/tests/unit/application/test_accounting_services.py Updates accounting tests to use JobCompletionParams.
coordinator/tests/test_rate_limit.py Whitespace formatting cleanup.
coordinator/tests/test_multiplier.py Removes unused import and applies Black formatting.
coordinator/tests/test_cors_security.py Removes unused import and applies Black formatting.
coordinator/tests/test_cors.py Adds spacing for Black formatting.
coordinator/requirements.txt Bumps cryptography patch version.
coordinator/main.py Minor formatting (blank line).
coordinator/interface/api/inference.py Simplifies peer serialization by calling Node.to_dict().
coordinator/domain/inference/models.py Adds Node.to_dict() and reuses it from to_json().
coordinator/domain/accounting/models.py Introduces JobCompletionParams value object.
coordinator/benchmark_reputation.py Black formatting for arithmetic spacing in f-string.
coordinator/application/orchestration_services.py Changes complete_job signature to accept JobCompletionParams.
coordinator/application/accounting_services.py Changes process_job_completion signature to accept JobCompletionParams.
Cargo.toml Pins Rust crypto/rand dependency versions to resolve build mismatches.
Cargo.lock Updates lockfile to reflect pinned dependency graph changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread worker/src/main.rs Outdated
Comment thread worker/src/main.rs
Comment on lines 94 to 96
res = heartbeat_handle => {
error!("Heartbeat task ended: {:?}", res);
}

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

If the heartbeat task ever exits (it’s an infinite loop, so this would only happen on panic/cancellation), the branch just logs and then main continues to return Ok(()), stopping the worker. Treat unexpected heartbeat task termination as a fatal error (e.g., return an error and/or abort the proxy task) so the process doesn’t exit “successfully” on internal failure.

Copilot uses AI. Check for mistakes.
Comment thread shared/src/crypto.rs Outdated
Comment on lines +43 to +46
pub fn generate_keypair() -> (StaticSecret, String) {
let secret = StaticSecret::random_from_rng(rand::rng());
let mut bytes = [0u8; 32];
rand::thread_rng().fill_bytes(&mut bytes);
let secret = StaticSecret::from(bytes);

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

generate_keypair is generating secret material via thread_rng() and then constructing StaticSecret from raw bytes. For cryptographic key material it’s safer to use an OS-backed CSPRNG (you already import OsRng) and prefer the library’s RNG-based constructor (e.g., StaticSecret::random_from_rng) to ensure any required clamping/conditioning is applied consistently.

Copilot uses AI. Check for mistakes.
Comment thread shared/src/crypto.rs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Theaxiom

Copy link
Copy Markdown
Member Author

Copilot apply changes based on the comments in this thread and also resolve merge conflicts.

- Merge origin/main to resolve conflicts across Cargo.toml, Cargo.lock,
  shared/src/crypto.rs, worker/src/main.rs, and Python test files
- Fix shared/src/crypto.rs: use rand_core::OsRng + StaticSecret::random_from_rng(OsRng)
  for cryptographic keypair generation (OS-backed CSPRNG, proper library constructor)
- Fix worker/src/main.rs: treat heartbeat task termination as fatal error
  (return Err instead of silently logging and continuing)
- All select! arms now propagate errors; remove unreachable Ok(()) at end of main

Co-authored-by: Theaxiom <57013+Theaxiom@users.noreply.github.com>

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Copilot apply changes based on the comments in this thread and also resolve merge conflicts.

Applied all review changes and resolved merge conflicts in commit 67cc2f5:

  • shared/src/crypto.rs: Switched generate_keypair back to use rand_core::OsRng + StaticSecret::random_from_rng(OsRng) — OS-backed CSPRNG with the library's proper constructor.
  • worker/src/main.rs: Heartbeat task termination is now fatal — returns Err(anyhow::anyhow!("heartbeat task ended unexpectedly")) instead of logging and silently continuing. Both select arms now propagate errors (the trailing unreachable Ok(()) was also removed).
  • Merged origin/main to resolve conflicts in Cargo.toml, Cargo.lock, shared/src/crypto.rs, worker/src/main.rs, and two Python test files.

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.

3 participants