Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Rust

# Until now this repo had zero CI: the 25 tests covering the Only-Lang
# parser, the signed governance chain, and the conductor's UDP-to-rule-
# engine wiring only ran when someone remembered to run them locally. This
# is what actually protects that work going forward.

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry and build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build (workspace)
run: cargo build --workspace --verbose

- name: Test (workspace)
run: cargo test --workspace --verbose

- name: Check formatting
run: cargo fmt --all -- --check
continue-on-error: true # cargo fmt has never been run on this codebase (116 pre-existing
# diff hunks, all whitespace); fixing that is a separate, dedicated change, not something
# to smuggle into a CI PR. Report, don't block, until that happens.

- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
# No continue-on-error: the 6 pre-existing warnings this would have caught (unused
# imports, a manual range-contains, a redundant single-component import) are fixed in
# this same PR, so this is a real gate, not a report-only check from day one.
2 changes: 0 additions & 2 deletions pchi-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ pub use invariants::{PIRInvariants, EquilibriumCheck};
pub use transform::Transform;

use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
use thiserror::Error;
use std::collections::HashMap;

/// PCHI v2.0 message with PIR invariants
Expand Down
2 changes: 1 addition & 1 deletion pchi-schema/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn validate_timestamp(timestamp: f64) -> Result<(), ValidationError> {
const MIN_TIMESTAMP: f64 = 946_684_800_000.0; // 2000-01-01
const MAX_TIMESTAMP: f64 = 4_102_444_800_000.0; // 2100-01-01

if timestamp < MIN_TIMESTAMP || timestamp > MAX_TIMESTAMP {
if !(MIN_TIMESTAMP..=MAX_TIMESTAMP).contains(&timestamp) {
return Err(ValidationError::InvalidTimestamp(
format!("timestamp {} out of valid range", timestamp)
));
Expand Down
1 change: 0 additions & 1 deletion primeswarm-pchi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use primeswarm_pchi::{PCHIConductor, WebServerState, create_router};
use pchi_schema::{PCHIMessage, MessageType, Payload, ControlParameterData};
use tracing_subscriber;
use std::sync::Arc;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion primeswarm-pchi/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::ConductorError;
use tokio::net::UdpSocket;
use tokio_tungstenite::tungstenite::protocol::Message;
use futures_util::{SinkExt, StreamExt};
use futures_util::SinkExt;
use std::sync::Arc;
use tokio::sync::Mutex;
use tracing::info;
Expand Down
2 changes: 1 addition & 1 deletion primeswarm-pchi/src/web_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use axum::{
};
use std::sync::Arc;
use tokio::sync::RwLock;
use futures_util::{SinkExt, StreamExt};
use futures_util::StreamExt;
use serde_json::json;

/// Web server state
Expand Down
Loading