Skip to content

Conversation

@dustinblack
Copy link
Collaborator

Description

This pull request introduces a comprehensive, repository-managed pre-commit framework to enhance the developer workflow, improve code quality, and ensure consistency between local development environments and the CI pipeline.

By enabling these hooks, developers will benefit from automated checks that catch formatting issues, linting errors, and potential security vulnerabilities before code is even committed. This helps reduce CI failures and streamlines the development process.

Key Changes

  • Repo-Managed Hooks: The pre-commit script is now stored in the .githooks/ directory, ensuring that all contributors use the same set of checks. A new helper script, scripts/install-git-hooks.sh,
    simplifies the one-time setup.
  • Conditional Execution: The script intelligently detects staged files and only runs checks relevant to the changes. For example, Rust checks are skipped if only Python files are modified, making the
    process fast and efficient.
  • Enhanced Rust Checks:
    • Added cargo audit to scan for security vulnerabilities in dependencies.
    • Aligned cargo fmt and cargo test with the CI configuration (--all and --all-features) for better consistency.
  • New Python Checks:
    • Introduced support for Python code quality, specifically for the dashboard utility.
    • Automatically formats staged .py files with black and isort.
    • Lints Python code using flake8.
  • AI Agent Prompting: Added AGENTS.md to provide a persistent, shared context for AI assistants working on this project. Symlinks (GEMINI.md, CLAUDE.md) are included to ensure different agents can
    easily discover and ingest these development guidelines, helping their contributions align with project standards.
  • Updated Documentation: The README.md has been updated with clear instructions on how to enable and use the new pre-commit hooks.

How to Test

  1. Enable the hooks:
git config core.hooksPath .githooks
chmod +x .githooks/pre-commit

(Or run bash scripts/install-git-hooks.sh)

  1. Test Rust changes:

    • Modify a .rs file (e.g., add extra whitespace).
    • Stage the file (git add ).
    • Attempt to commit (git commit).
    • Observe the Rust pre-commit checks running and failing on the formatting check.
  2. Test Python changes:

    • Modify a .py file in utils/dashboard/ (e.g., mis-order an import).
    • Stage the file.
    • Attempt to commit.
    • Observe the Python checks running, automatically fixing the formatting, and re-staging the file before completing.
  3. Test no-op changes:

    • Modify a non-Rust/Python file (e.g., README.md).
    • Attempt to commit.
    • Confirm that the script skips the language-specific checks.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally
  • Added tests for new functionality
  • Updated documentation

Checklist

  • Code follows style guidelines
  • Self-review completed
  • Comments added for complex code
  • Documentation updated
  • No breaking changes (or marked as breaking)

…Adds scripts/msrv-check.sh\n- Invokes MSRV check from pre-commit hook\n\nAI-assisted-by: GPT-5
This commit significantly enhances the pre-commit hook to improve
developer workflow, catch errors earlier, and ensure consistency with
the CI pipeline.

The script now includes conditional execution for both Rust and Python
checks, ensuring that linters and formatters only run on relevant
staged files. This optimization speeds up the commit process when
changes are isolated to specific languages or documentation.

Key changes:
- Adds `cargo audit` to check for security vulnerabilities in Rust
  dependencies before every commit.
- Aligns `cargo fmt` and `cargo test` commands with the CI
  configuration by adding the `--all` and `--all-features` flags,
  respectively.
- Introduces Python pre-commit checks that trigger when `.py` files
  are staged. These checks automatically format code using `black` and
  `isort`, and lint with `flake8`.
- Activates the Python virtual environment at `utils/dashboard/.venv`
  when available.
- Updates the README with instructions on how to enable the new
  repo-managed pre-commit hooks.
- Adds a new `AGENTS.md` file to provide guidance and context for AI
  agents working on this project.
- Adds a new `install-git-hooks.sh` script to simplify the setup of
  the pre-commit hooks.

Ai-assisted-by: GPT-5, Gemini 2.5 Pro
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

📈 Changed lines coverage: N/A (0/0)

✅ All new and modified lines are covered by tests!

📊 Code Coverage Summary

File Line Coverage Uncovered Lines
src/benchmark.rs 59.86%
(331/553)
74, 77, 86, 88, 92, 101, 104, 106, 110-111, 113-115, 117, 123, 125, 127, 388, 392, 394-398, 406-410, 471-476, 482-487, 491, 493, 501, 510-511, 519, 528, 533, 561-563, 568, 578, 589, 616, 640, 647-648, 653-654, 674-676, 682, 721, 729, 737, 743-746, 750, 766, 769, 771, 773, 780, 783, 789, 834, 852-854, 856, 895-896, 899-902, 904, 913-916, 918, 967-969, 974-975, 977, 984-986, 995, 998-999, 1001, 1014-1016, 1019, 1021-1022, 1031, 1041, 1051, 1057-1061, 1063, 1103-1105, 1110-1111, 1120, 1123-1124, 1143-1144, 1147-1148, 1150, 1157, 1164, 1173, 1187, 1193-1197, 1199, 1247, 1256-1257, 1264-1265, 1270, 1281, 1295, 1304, 1306-1307, 1310-1312, 1317-1318, 1323-1324, 1326, 1331-1332, 1336-1338, 1343-1344, 1347-1348, 1374-1375, 1379-1381, 1386-1390, 1392, 1417-1419, 1424-1425, 1435, 1437-1441, 1443-1449, 1451, 1454, 1464, 1466-1467, 1479, 1485-1489, 1491, 1569, 1580, 1596-1597, 1607
src/cli.rs 93.67%
(74/79)
553, 651, 714-716
src/ipc/mod.rs 40.00%
(16/40)
250, 252-255, 565-566, 581-582, 600-601, 632, 635, 638, 643, 670-671, 685, 687, 707, 709, 832-834
src/ipc/posix_message_queue.rs 45.69%
(53/116)
139-140, 213-215, 217, 224, 229, 332-335, 337, 342, 345, 434, 437, 441, 443, 446, 454, 532, 656, 756-757, 765, 782-783, 794-795, 806-807, 824-825, 881, 885-886, 889-894, 896-898, 902, 904-905, 907-908, 910-912, 916-918, 920-922, 969-970, 992
src/ipc/shared_memory.rs 63.51%
(94/148)
61, 72, 130, 134, 211-212, 222-223, 254, 287, 323-324, 350-352, 354, 372-374, 376-377, 379, 390, 396, 400, 407, 413, 416, 418, 425, 429-430, 435-436, 570-571, 574-575, 578, 580, 585-586, 613-614, 617-618, 625, 631, 638, 656, 686, 688, 691, 695
src/ipc/tcp_socket.rs 46.99%
(39/83)
31-32, 61, 66, 89, 106-108, 111, 117-119, 122, 129-131, 134, 140-142, 145, 160, 164, 168-170, 177-178, 181, 351-352, 355-356, 359-360, 365-366, 400, 425-426, 456, 458, 460, 465
src/ipc/unix_domain_socket.rs 48.31%
(43/89)
29-30, 58, 63, 86, 96, 115-117, 120, 126-128, 131, 138-140, 143, 149-151, 154, 169, 173, 177-179, 186-187, 190, 335-336, 339-340, 343-344, 349-350, 388, 401-402, 432, 434, 436, 441, 457
src/logging.rs 0.00%
(0/13)
63, 69-70, 72, 74-75, 78-83, 87
src/main.rs 26.09%
(42/161)
68-69, 79-83, 87-89, 91-92, 94-95, 99-105, 115-118, 142-147, 154, 160, 163, 168-171, 176-177, 182-184, 189, 191-193, 195, 200-202, 208, 213, 216-217, 221, 223-225, 228-229, 231, 237, 241-242, 244-246, 248-249, 252, 261, 264-265, 268, 287-291, 295-298, 300-302, 304-307, 344-345, 352-353, 356, 362, 365, 369, 378, 383-384, 387, 391-393, 399, 411, 416-417, 421-424, 464, 473, 478, 483-484
src/metrics.rs 71.65%
(91/127)
455-460, 493-494, 552, 558, 579-582, 651, 687, 732-734, 736, 768, 788, 833, 838, 881, 904, 926, 939-940, 952, 980, 984, 1005, 1007-1008, 1013
src/results.rs 47.73%
(200/419)
224, 226-227, 231-232, 234-235, 597, 599, 608, 612, 639, 681, 688, 691, 717, 726-728, 730-731, 734-735, 738, 747, 754, 760, 763-764, 767, 769, 772, 776-781, 787-788, 791-792, 795-800, 817, 829-830, 832, 834, 837-838, 840, 844, 866-867, 870-871, 874-875, 895-897, 900-901, 905-907, 910, 936, 941, 946, 952, 968, 971, 973-974, 976, 978-982, 984, 986-987, 1002, 1004, 1020-1021, 1025-1026, 1030, 1062-1063, 1066, 1072-1073, 1077, 1082-1083, 1085, 1110-1114, 1117, 1140-1141, 1160-1161, 1163-1167, 1169, 1186-1187, 1189-1194, 1196, 1214, 1216-1221, 1239, 1242, 1258-1259, 1274-1276, 1278-1280, 1282-1283, 1285-1286, 1288-1289, 1291, 1293-1294, 1296-1299, 1301-1303, 1305-1307, 1310, 1314-1315, 1323-1328, 1330-1331, 1335-1337, 1340-1342, 1344-1345, 1348-1349, 1358-1361, 1365-1367, 1371, 1373, 1376-1377, 1381-1383, 1387, 1394-1398, 1400, 1587-1588, 1787-1788, 1790-1791, 1808-1809, 1811-1812, 1817
src/utils.rs 41.94%
(13/31)
51-52, 55-57, 59, 62-65, 69, 73, 75, 114-118
Total 53.58%
(996/1859)

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