Skip to content

Conversation

@JGsouzaa
Copy link

SQLite feature developed based on #11

*Development Summary:


[sqlite.rs file (NEW FILE)]:

Implemented the following functions:

  • check_db
  • _createdb
  • _check_schema
  • _fill_projects_table
  • _check_initial_row
  • store_run
  • store_mutants
  • check_mutation_folder
  • get_files_from_folder
  • get_file_diff
  • get_hash_from_diff
  • update_status_mutant
  • update_command_to_test_mutant
  • update_mutants_table

Implemented the following tests:

  • test_db_creation_and_seed
  • test_store_run_creates_row
  • test_store_mutants_inserts_rows
  • test_update_status_mutant
  • test_update_command_mutant

[main.rs file (MODIFICATIONS)]:

Implemented the following logic:

  • Added mod sqlite.rs
  • Optional SQLite flag for mutation + handler
  • Optional SQLite flag for analyze with --run_id + handler

[lib.rs file (MODIFICATIONS)]:

  • sqlite.rs module

[git_changes.rs file (MODIFICATIONS)]:

  • get_commit_hash function implementation

[error.rs file (MODIFICATIONS)]:

  • Added Sqlite and MissingDbPath errors

[analyze.rs file (MODIFICATIONS)]:

  • Adapted run_analysis signature to get db_path and run_id
  • Added update_status_mutant and update_command_to_test_mutant on current logic
  • Changed find_mutation_folders visibility to public so it can be called from the sqlite.rs module

[Cargo.toml file (MODIFICATIONS)]:

  • Added rusqlite and sha2 dependencies

*Additional comments:

  • strategy, config_json from the current execution config -> NOT IMPLEMENTED

  • The database schema follows the issue documentation entirely, with only one exception on table mutant that was inserted an additional column called file_name to query on analyze section

  • Apart from the code tests, the following functional tests were performed manually:

    • (mutate) -> --sqlite flag optional, normal behavior {OK}

    • (mutate --sqlite ) -> Creates/open "db/mutation.db" and uses it {OK}

    • (mutate --sqlite results.db) -> Creates/open "db/results.db" and uses it {OK}

    • (mutate --sqlite ...) -> Verify INSERT OR IGNORE INTO projects (name, repository_url) VALUES ('Bitcoin Core', 'https://github.com/bitcoin/bitcoin'); {OK}

    • (mutate --sqlite...) -> General behavior: Open DB (create if missing) Ensure projects seed (bitcoin core), create run, insert mutants {OK}

    • (analyze --sqlite) -> Asks for run_id {OK}

    • (analyze --sqlite <db_file> <run_id> ) -> Record standard commands {OK}

    • (analyze <without file (-f ...)> --sqlite <run_id> ...) -> Record only for run_id, behave like analyze normally {OK}


*Further implementations suggestion:

  • Modify logic when grabbing file extensions (current supports only for .cpp, .h and .py files)
  • Implement help options for flag --sqlite
  • Insert one more table column on table runs indicating the total number of mutants generated
  • Explore options for compress the data on column "diff" on table "mutants" if diffs become hard to store and read
  • Implement a folder called bcore-mutation on the project that it's running to hold "db" and "mutants" folders apart from original project

@JGsouzaa JGsouzaa force-pushed the feature/SQLite_persistence branch 3 times, most recently from eb2257d to a255f22 Compare December 27, 2025 10:39
@brunoerg
Copy link
Owner

Please, you should better organize your commits by squashing some of them.

js and others added 5 commits January 13, 2026 16:58
Added Path to flag

Added get_commit_hash function

refactored into functions

implemented error handling for rusqlite errors

mod for sqlite
added hash for diffs

sha2 dependency

filepath functionality

sqlite storing mutants into db

bug fix in folder_path for sqlite
implemented update_status_mutant, change to snake case in variable, adition of a file_name colunm on mutants table

implemented update command_to_test_mutant

fix fullpath bug without -f flag on analysis

--run_id necessary for --sqlite flag
Error handling for unwrap() parts

MissingDbPath handler for MutationError enum
updated readme with Storage and Update storage functions

bug fix on analyze without --sqlite and --runid flags
@JGsouzaa JGsouzaa force-pushed the feature/SQLite_persistence branch from a255f22 to c02ed02 Compare January 13, 2026 20:06
@JGsouzaa
Copy link
Author

Please, you should better organize your commits by squashing some of them.

Thanks for the suggestion. I’ve done the squash as recommended. If you have any further tips on how to better organize the commits, I’d be happy to hear them.

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