Skip to content

hydra-evaluator: Rewrite in Rust#1608

Open
Ericson2314 wants to merge 1 commit intomasterfrom
no-c-plus-plus
Open

hydra-evaluator: Rewrite in Rust#1608
Ericson2314 wants to merge 1 commit intomasterfrom
no-c-plus-plus

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Port hydra-evaluator from C++ to Rust, removing the last C++ executable from the project. The new implementation uses sqlx and tokio, matching the async patterns already established by hydra-queue-runner and hydra-builder.

Build/packaging changes:

  • Remove all C++ dependencies from subprojects/hydra/meson.build
  • Move Rust packaging from hydra-queue-runner/package.nix to subprojects/rust-package.nix with named outputs (queue_runner, builder, evaluator)
  • Add evaluatorExecutable option to the NixOS web-app module, matching how the queue runner and builder are discovered via their own modules
  • Clean up stale references in hydra-tests/meson.build and dev-shell.nix

@Ericson2314 Ericson2314 force-pushed the no-c-plus-plus branch 5 times, most recently from bfdc713 to 56503bd Compare March 29, 2026 16:34
Port hydra-evaluator from C++ to Rust, removing the last C++ executable
from the project. The new implementation uses `sqlx` and `tokio`, matching
the async patterns already established by hydra-queue-runner and
hydra-builder.

Build/packaging changes:
- Remove all C++ dependencies from `subprojects/hydra/meson.build`
- Add `subprojects/hydra-evaluator/package.nix` following the same
  per-binary pattern as `hydra-queue-runner` and `hydra-builder`: each
  Rust binary is its own derivation that builds against a fileset
  containing only its own crate, and `postPatch` strips the other Rust
  binary crates from the workspace `members` list so cargo doesn't try
  to load their (absent) manifests. Properly sharing the dep crates
  between these builds is left for later.
- Add `evaluatorExecutable` option to the NixOS web-app module, matching
  how the queue runner and builder are discovered via their own modules
- Clean up stale references in `hydra-tests/meson.build` and
  `dev-shell.nix`

`JobsetRow` uses `i32` for `lastCheckedTime` and `triggerTime` to match
the `INT4` Postgres schema (`sqlx` refuses to decode `INT4` into `i64`).
Post-eval DB updates are wrapped in a transaction, as in the C++
original. The DBI parser supports `sslmode`/`sslrootcert`/`sslcert`/
`sslkey` that `libpq` understood natively in the C++ version; unknown
parameters are warned about rather than fatal.

Satisfy the crate's own `#![deny(clippy::pedantic)]` gate:
- use `fs_err` per workspace `disallowed_methods` policy
- replace `as`-casts with `try_from` (schema is `INT4`, saturate at `i32::MAX`)
- collapse nested `if let` chains

Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant