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
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_BACKTRACE: 1

jobs:
check:
name: Build & Verify (xwork + xtask)
Expand All @@ -14,10 +24,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Rust toolchain (1.88.0)
- name: Set up Rust toolchain (1.94.1)
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.88.0"
toolchain: "1.94.1"
components: rustfmt, clippy

- name: Run xwork CI DAG
Expand Down
98 changes: 0 additions & 98 deletions Justfile

This file was deleted.

199 changes: 80 additions & 119 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,129 +1,90 @@
# Makefile for idp
# Standard POSIX wrapper that awk-parses recipes directly from Justfile.
# Makefile for idp (Identity Provider, Conclave Bot Manager & Directory Reconciler)
# Host Throttling: Physical host ceres runs multiple active agent sessions.
# Shared workstations keep JOBS=2 to prevent CPU starvation and OOM.

SHELL := bash
.SHELLFLAGS := -euo pipefail -c
.DEFAULT_GOAL := help
.ONESHELL:

JOBS ?= 2

export JOBS

JUST := $(shell command -v just 2>/dev/null)

# Discover available recipe names from Justfile (excluding help and default)
TARGETS := $(shell awk '(/^[a-zA-Z0-9_-]+ *:[^=]/ || /^[a-zA-Z0-9_-]+ *:$$/) && !/^[a-zA-Z0-9_-]+ *:=/ { split($$1, a, ":"); t = a[1]; if (t != "help" && t != "default") print t }' Justfile 2>/dev/null)

.PHONY: $(TARGETS) help default

define AWK_PARSER
BEGIN {
vars["jobs"] = jobs
}
# Capture variable definitions: var := "val"
/^[a-zA-Z0-9_-]+ *:=/ {
var = $$1
val = $$0
sub(/^[a-zA-Z0-9_-]+ *:= *"/, "", val)
sub(/".*$$/, "", val)
if (!(var in vars)) vars[var] = val
next
}
# Capture doc comment above recipe
/^# / {
sub(/^# */, "")
last_doc = $$0
next
}
# Capture recipe signature
(/^[a-zA-Z0-9_-]+ *:[^=]/ || /^[a-zA-Z0-9_-]+ *:$$/) && !/^[a-zA-Z0-9_-]+ *:=/ {
curr = $$1
sub(/:.*/, "", curr)
header = $$0
sub(/^[a-zA-Z0-9_-]+ *: */, "", header)
deps[curr] = header
all_targets[curr] = 1
doc[curr] = last_doc
order[++target_count] = curr
last_doc = ""
next
}
# Capture recipe body lines and interpolate variables
/^[ \t]+/ && curr != "" {
line = $$0
sub(/^[ \t]+/, "", line)
for (v in vars) {
gsub("\\{\\{ *" v " *\\}\\}", vars[v], line)
}
gsub(/[$$][$$]/, "$$", line)
body[curr] = (body[curr] ? body[curr] "\n" : "") line
next
}
!/^[ \t]/ {
curr = ""
last_doc = ""
}
function emit(t, n, d, i, k, lines, cmd) {
if (!(t in all_targets)) {
print "echo \"error: unknown recipe: " t "\" >&2; exit 1"
return
}
if (deps[t] != "") {
n = split(deps[t], d, " ")
for (i = 1; i <= n; i++) {
if (d[i] != "") emit(d[i])
}
}
if (body[t] != "") {
k = split(body[t], lines, "\n")
for (i = 1; i <= k; i++) {
cmd = lines[i]
sub(/^@/, "", cmd)
print cmd
}
}
}
function show_help() {
print "Usage: make <target>"
print ""
print "Available recipes (parsed from Justfile):"
for (i = 1; i <= target_count; i++) {
t = order[i]
if (t != "default" && t != "help") {
printf " \033[36m%-24s\033[0m %s\n", t, (doc[t] ? doc[t] : "")
}
}
}
END {
if (target == "help" || target == "default" || target == "") {
show_help()
} else {
print "set -euo pipefail"
emit(target)
}
}
endef
export AWK_PARSER

help:
@if [ -n "$(JUST)" ]; then \
$(JUST) --list; \
else \
awk -v target="help" -v jobs="$(JOBS)" "$$AWK_PARSER" Justfile; \
fi
.PHONY: help default xwork check graph-audit zero-io-domain projectfile-check \
stages-check spec-check toolchain-check branch-hygiene build install \
fmt fmt-check clippy test doc-test ci deny audit smoke

##@ General

help: ## Show this help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

default: help

$(TARGETS):
@if [ -n "$(JUST)" ]; then \
$(JUST) --set jobs "$(JOBS)" "$@"; \
else \
awk -v target="$@" -v jobs="$(JOBS)" "$$AWK_PARSER" Justfile | $(SHELL); \
fi

%:
@if [ -n "$(JUST)" ]; then \
$(JUST) --set jobs "$(JOBS)" "$*"; \
else \
awk -v target="$*" -v jobs="$(JOBS)" "$$AWK_PARSER" Justfile | $(SHELL); \
fi
##@ Verification & CI Gates (cargo xtask)

xwork: ## Execute the full compiled projectfile.yaml CI DAG (cargo xwork)
cargo xwork

check: ## Run DBR-admitted verification pipeline with CAS receipts
cargo xtask check --enforce-dbr

ci: ## Run full CI verification gates
cargo xwork
cargo xtask graph-audit --break-check
cargo xtask check --break-check

graph-audit: ## Verify workspace crate DAG and Wave-0 idp-domain purity
cargo xtask graph-audit --break-check

zero-io-domain: ## Verify Wave-0 idp-domain has zero I/O or runtime dependencies
cargo xtask zero-io-domain

projectfile-check: ## Validate projectfile.yaml schema and CI nodes
cargo xtask projectfile-check

stages-check: ## Verify stages.rs matches projectfile.yaml
cargo xtask stages-check

spec-check: ## Validate markdown specs in specs/*.md
cargo xtask spec-check

toolchain-check: ## Verify active rustc matches rust-toolchain.toml
cargo xtask toolchain-check

branch-hygiene: ## Audit merged local git branches
cargo xtask branch-hygiene --dry-run

##@ Build & Install

build: ## Compile the workspace with host throttling (-j 2)
cargo build --workspace -j $(JOBS)

install: ## Install idp CLI to ~/.cargo/bin/idp
cargo xtask install

smoke: ## Build CLI and run smoke tests
cargo build --package idp-cli -j $(JOBS)
cargo run --package idp-cli -j $(JOBS) -- bot list

##@ Code Quality & Supply Chain

fmt: ## Format all Rust code
cargo fmt --all

fmt-check: ## Check code formatting without modifying
cargo fmt --all -- --check

clippy: ## Lint workspace with clippy (-D warnings)
cargo clippy --workspace --all-targets -j $(JOBS) -- -D warnings

test: ## Run unit and integration tests with bounded threads
cargo test --workspace -j $(JOBS)

doc-test: ## Run documentation tests
cargo test --doc --workspace -j $(JOBS)

deny: ## Audit licenses, bans, and advisories via cargo-deny
cargo deny check

audit: ## Check dependencies for known security advisories
cargo audit
1 change: 1 addition & 0 deletions crates/idp-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ workspace = true
[dependencies]
idp = { path = "../idp" }
anyhow.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing.workspace = true
Expand Down
22 changes: 12 additions & 10 deletions crates/idp-cli/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,7 @@ pub fn build_bot_dcr_metadata(
.map_err(|e| e.to_string())?;

let scope_set: std::collections::BTreeSet<String> = scopes
.unwrap_or_else(|| {
vec![
"openid".to_string(),
"estate:agent:execute".to_string(),
]
})
.unwrap_or_else(|| vec!["openid".to_string(), "estate:agent:execute".to_string()])
.into_iter()
.filter(|s| !s.trim().is_empty())
.collect();
Expand Down Expand Up @@ -537,7 +532,9 @@ async fn dcr_metadata_handler(
Ok(meta) => (StatusCode::OK, Json(meta)).into_response(),
Err(msg) => (
StatusCode::BAD_REQUEST,
Json(serde_json::json!({ "error": "invalid_client_metadata", "error_description": msg })),
Json(
serde_json::json!({ "error": "invalid_client_metadata", "error_description": msg }),
),
)
.into_response(),
}
Expand Down Expand Up @@ -737,7 +734,10 @@ mod tests {
// 4. Positive control: write PEM key and verify /.well-known/jwks/sindri.json returns 200 OK
state
.key_store
.write_key("sindri", "-----BEGIN RSA PRIVATE KEY-----\nTEST_SINDRI_KEY\n-----END RSA PRIVATE KEY-----\n")
.write_key(
"sindri",
"-----BEGIN RSA PRIVATE KEY-----\nTEST_SINDRI_KEY\n-----END RSA PRIVATE KEY-----\n",
)
.expect("write sindri key");

let ok_jwks = http
Expand Down Expand Up @@ -825,11 +825,13 @@ mod tests {

// Verify by a second path: read the persisted receipt from disk and confirm secrets are redacted
let receipt_path = temp.path().join("sindri-dcr.json");
assert!(receipt_path.exists(), "sindri-dcr.json must be written to KeyStore");
assert!(
receipt_path.exists(),
"sindri-dcr.json must be written to KeyStore"
);
let persisted_raw = std::fs::read_to_string(&receipt_path).expect("read receipt");
assert!(!persisted_raw.contains("super-secret-do-not-persist"));
assert!(!persisted_raw.contains("rat-secret-token"));
assert!(persisted_raw.contains("hydra-elf-sindri-001"));
}
}

Loading
Loading