Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

The fnv1a64 hash function was duplicated in orchestrator.rs (line 131) and synthesized_capability_storage.rs (line 267), violating DRY principles.

Changes

  • Created ccos/src/utils/hash.rs with shared fnv1a64 implementation and unit tests
  • Updated ccos/src/utils/mod.rs to export the hash module
  • Refactored both orchestrator.rs and synthesized_capability_storage.rs to import and use crate::utils::hash::fnv1a64
// Before: duplicated in two files
fn fnv1a64(s: &str) -> u64 {
    const OFFSET_BASIS: u64 = 0xcbf29ce484222325;
    const FNV_PRIME: u64 = 0x100000001b3;
    let mut hash = OFFSET_BASIS;
    for b in s.as_bytes() {
        hash ^= *b as u64;
        hash = hash.wrapping_mul(FNV_PRIME);
    }
    hash
}

// After: single source in ccos/src/utils/hash.rs
use crate::utils::hash::fnv1a64;

This follows the project's factorization guidelines (Rule #9) requiring shared utilities be placed in ccos::utils modules.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Note

Centralizes hashing to avoid duplication and improve reuse.

  • New ccos/src/utils/hash.rs with shared fnv1a64 and unit tests
  • ccos/src/utils/mod.rs now exports hash
  • orchestrator.rs and synthesized_capability_storage.rs updated to use crate::utils::hash::fnv1a64 and remove local implementations

Written by Cursor Bugbot for commit 69ed828. This will update automatically on new commits. Configure here.

Co-authored-by: mandubian <77193+mandubian@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.apis.guru
    • Triggering command: /home/REDACTED/work/ccos/ccos/target/debug/deps/ccos-51a9b1ca97c8846f /home/REDACTED/work/ccos/ccos/target/debug/deps/ccos-51a9b1ca97c8846f 9h1paz2qo6yr1i8yac05mu9q.1ikqojz.rcgu.o msc61kkjtszxy1pnvj7pmhey.1ikqojz.rcgu.o u6p2r3fhb3uwql6sqgzrx1s8.1ikqojz.rcgu.o yj2a527iquccaf216nbe22e4.1ikqojz.rcgu.o phnlhlk2aaqw57voi45qprt8.1ikqojz.rcgu.o w8jdv4xc8158mwhi99ezaqjn.1ikqojz.rcgu.o aaf6kvpl35srogn15aypll8r.1ikqojz.rcgu.o biy2l9dlctr2ijy2pk69t1jf.1ikqojz.rcgu.o om1asuv7dqgovy39yoarb78c.1ikqojz.rcgu.o pcg5jp2h3jye9oykp7falknh.1ikqojz.rcgu.o pmqmow65ar2qcadlvx8t226o.1ikqojz.rcgu.o xjei�� 3ybwulbp1g73rkcz1hk6gxdd.1ikqojz.rcgu.o c4jfud1inl9bknx9clrp7h5u.1ikqojz.rcgu.o 11e.24ngj9yo0mj9/home/REDACTED/work/ccos/ccos/target/debug/deps/ccos_explore-829b803aa80baf11.9j02-m 11e.2gkgq2cjlse7bash 11e.2vyfs4tv68uy--norc 11e.2zc18lxp45hw--noprofile 11e.3006fzwym3qb/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_/home/REDACTED/work/ccos/ccos/target/debug/deps/ccos_explore-c2d5871765df42e2.1091gbblf07lga6w3bas0as7y.0y4kg8a.rcgu.o (dns block)
  • registry.modelcontextprotocol.io
    • Triggering command: /home/REDACTED/work/ccos/ccos/target/debug/deps/ccos-51a9b1ca97c8846f /home/REDACTED/work/ccos/ccos/target/debug/deps/ccos-51a9b1ca97c8846f 9h1paz2qo6yr1i8yac05mu9q.1ikqojz.rcgu.o msc61kkjtszxy1pnvj7pmhey.1ikqojz.rcgu.o u6p2r3fhb3uwql6sqgzrx1s8.1ikqojz.rcgu.o yj2a527iquccaf216nbe22e4.1ikqojz.rcgu.o phnlhlk2aaqw57voi45qprt8.1ikqojz.rcgu.o w8jdv4xc8158mwhi99ezaqjn.1ikqojz.rcgu.o aaf6kvpl35srogn15aypll8r.1ikqojz.rcgu.o biy2l9dlctr2ijy2pk69t1jf.1ikqojz.rcgu.o om1asuv7dqgovy39yoarb78c.1ikqojz.rcgu.o pcg5jp2h3jye9oykp7falknh.1ikqojz.rcgu.o pmqmow65ar2qcadlvx8t226o.1ikqojz.rcgu.o xjei�� 3ybwulbp1g73rkcz1hk6gxdd.1ikqojz.rcgu.o c4jfud1inl9bknx9clrp7h5u.1ikqojz.rcgu.o 11e.24ngj9yo0mj9/home/REDACTED/work/ccos/ccos/target/debug/deps/ccos_explore-829b803aa80baf11.9j02-m 11e.2gkgq2cjlse7bash 11e.2vyfs4tv68uy--norc 11e.2zc18lxp45hw--noprofile 11e.3006fzwym3qb/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/lib/rustlib/x86_/home/REDACTED/work/ccos/ccos/target/debug/deps/ccos_explore-c2d5871765df42e2.1091gbblf07lga6w3bas0as7y.0y4kg8a.rcgu.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on sandbox isolation strategy Extract duplicated fnv1a64 hash function to shared utils module Dec 31, 2025
Copilot AI requested a review from mandubian December 31, 2025 13:32
@mandubian
Copy link
Owner

@copilot commit and push to remote PR

Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot commit and push to remote PR

The changes have already been committed and pushed in commit 69ed828. The working tree is clean and the branch is up to date with origin/copilot/sub-pr-181.

@mandubian mandubian marked this pull request as ready for review December 31, 2025 14:45
Copilot AI review requested due to automatic review settings December 31, 2025 14:45
@mandubian mandubian merged commit 0d406e3 into feature/sandbox-isolation Dec 31, 2025
6 checks passed
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

This PR eliminates code duplication by extracting the fnv1a64 hash function into a shared utilities module, in accordance with the project's factorization guidelines (Rule #9).

  • Creates a new ccos::utils::hash module with the shared FNV-1a hash implementation
  • Updates both orchestrator.rs and synthesized_capability_storage.rs to use the shared function
  • Includes comprehensive unit tests and documentation

Reviewed changes

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

File Description
ccos/src/utils/mod.rs Exports the new hash module
ccos/src/utils/hash.rs Implements shared fnv1a64 function with documentation and tests
ccos/src/synthesis/core/synthesized_capability_storage.rs Removes duplicate hash function and imports from utils
ccos/src/planner/modular_planner/orchestrator.rs Removes duplicate hash function and imports from utils

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