Compare commits

...
Author SHA1 Message Date
Hermes CI Diagnostics fe7ecbffc9 Add runner-only duplicate-submit diagnostic 2026-12-06 13:39:43 +00:00
Codex (teamlead-profile) 4102b52f8e test(ci): update migration authority sequence snapshot
CI / Rust Checks (pull_request) Successful in 43m0s
CI / UI Checks (pull_request) Successful in 14s
CI / Rust Feature Validation (pull_request) Successful in 1h52m14s
CI / Community Image Smoke (pull_request) Successful in 16m6s
CI / Frontend E2E (pull_request) Successful in 13m5s
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
2026-12-05 23:04:56 +00:00
Codex (teamlead-profile) 2336b000fc fix(ci): update Rust and UI runtime dependencies
CI / UI Checks (pull_request) Successful in 7s
CI / Rust Checks (pull_request) Successful in 38m39s
CI / Community Image Smoke (pull_request) Successful in 32m28s
CI / Frontend E2E (pull_request) Failing after 34m11s
CI / Rust Feature Validation (pull_request) Failing after 1h32m45s
CI / Required Checks (pull_request) Failing after 1s
CI / Deploy (pull_request) Skipped
2026-12-05 20:46:45 +00:00
Codex (teamlead-profile) c31a0e8e5c fix(metrics): preserve runtime limit rejection labels
CI / UI Checks (pull_request) Successful in 12s
CI / Rust Checks (pull_request) Successful in 38m11s
CI / Rust Feature Validation (pull_request) Failing after 10s
CI / Frontend E2E (pull_request) Failing after 25m28s
CI / Community Image Smoke (pull_request) Failing after 27m22s
CI / Required Checks (pull_request) Failing after 1s
CI / Deploy (pull_request) Skipped
2026-12-05 19:25:05 +00:00
Codex (teamlead-profile) 2fa5b9de67 test(ci): derive migration CLI expectations from canonical sequence
CI / UI Checks (pull_request) Successful in 19s
CI / Rust Checks (pull_request) Successful in 1h4m26s
CI / Community Image Smoke (pull_request) Successful in 28m1s
CI / Frontend E2E (pull_request) Failing after 39m32s
CI / Rust Feature Validation (pull_request) Failing after 1h51m3s
CI / Required Checks (pull_request) Failing after 2s
CI / Deploy (pull_request) Skipped
2026-11-22 04:08:23 +00:00
bsodfather 4241782f92 test(e2e): wait for CSRF readiness in login helper
CI / UI Checks (pull_request) Successful in 17s
CI / Rust Checks (pull_request) Successful in 57m49s
CI / Community Image Smoke (pull_request) Successful in 27m35s
CI / Frontend E2E (pull_request) Failing after 39m31s
CI / Rust Feature Validation (pull_request) Failing after 1h37m31s
CI / Required Checks (pull_request) Failing after 3s
CI / Deploy (pull_request) Skipped
2026-11-22 02:06:27 +00:00
Codex (teamlead-profile) 824259dc7c fix(ci): restore required main PR checks
CI / UI Checks (pull_request) Successful in 18s
CI / Rust Checks (pull_request) Successful in 58m11s
CI / Community Image Smoke (pull_request) Successful in 26m51s
CI / Frontend E2E (pull_request) Failing after 38m53s
CI / Rust Feature Validation (pull_request) Failing after 1h25m27s
CI / Required Checks (pull_request) Failing after 4s
CI / Deploy (pull_request) Skipped
2026-11-21 23:47:06 +00:00
bsodfather e056e1487e test(ci): align Crank policy checks with Epic PR routing
CI / UI Checks (pull_request) Successful in 23s
CI / Rust Checks (pull_request) Successful in 1h8m20s
CI / Frontend E2E (pull_request) Failing after 23m32s
CI / Rust Feature Validation (pull_request) Failing after 34m34s
CI / Community Image Smoke (pull_request) Failing after 39m35s
CI / Required Checks (pull_request) Failing after 2s
CI / Deploy (pull_request) Skipped
2026-11-21 14:39:29 +00:00
bsodfather ca3fff0f44 ci: validate story and epic pull requests separately
CI / UI Checks (pull_request) Successful in 20s
CI / Rust Checks (pull_request) Failing after 15m51s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Failing after 5s
CI / Deploy (pull_request) Skipped
2026-11-21 13:12:27 +00:00
20 changed files with 320 additions and 79 deletions

No files matched your search

+14 -13
View File
@@ -2,7 +2,8 @@ name: CI
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches: [main]
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
validation_level:
@@ -17,9 +18,6 @@ on:
options: [none, production]
default: none
required: true
push:
branches:
- main
env:
CARGO_BUILD_JOBS: "2"
@@ -46,7 +44,7 @@ jobs:
GITEA_EVENT_NAME: ${{ gitea.event_name }}
GITEA_EVENT_BEFORE: ${{ gitea.event.before }}
GITEA_PR_BASE_SHA: ${{ gitea.event.pull_request.base.sha }}
FORCE_FULL: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }}
FORCE_FULL: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }}
run: python3 scripts/ci-release-tooling-scope.py
- name: Install Rust toolchain
@@ -187,8 +185,7 @@ jobs:
needs: rust
name: Rust Feature Validation
if: >-
inputs.validation_level == 'feature' ||
contains(gitea.event.pull_request.labels.*.name, 'feature-ready')
gitea.event_name == 'pull_request' || inputs.validation_level == 'feature'
runs-on: ubuntu-latest
steps:
@@ -251,8 +248,7 @@ jobs:
frontend-e2e:
needs: [rust, ui]
if: >-
inputs.validation_level == 'feature' ||
contains(gitea.event.pull_request.labels.*.name, 'feature-ready')
gitea.event_name == 'pull_request' || inputs.validation_level == 'feature'
name: Frontend E2E
runs-on: ubuntu-latest
services:
@@ -323,7 +319,13 @@ jobs:
run: npx playwright install --with-deps chromium
- name: Prebuild e2e services
run: cargo build -p admin-api -p mcp-server --jobs "$CARGO_BUILD_JOBS"
env:
SQLX_OFFLINE: "true"
# Match playwright-stack.sh so Cargo reuses these artifacts during startup.
run: |
cargo build -p admin-api --bin crank-migrate --jobs "$CARGO_BUILD_JOBS"
cargo build -p admin-api --bin admin-api --example e2e_storage_counts --jobs "$CARGO_BUILD_JOBS"
cargo build -p mcp-server --jobs "$CARGO_BUILD_JOBS"
- name: Run Playwright e2e
working-directory: apps/ui
@@ -361,8 +363,7 @@ jobs:
deployment:
needs: [rust, ui]
if: >-
inputs.validation_level == 'feature' ||
contains(gitea.event.pull_request.labels.*.name, 'feature-ready')
gitea.event_name == 'pull_request' || inputs.validation_level == 'feature'
name: Community Image Smoke
runs-on: ubuntu-latest
@@ -496,7 +497,7 @@ jobs:
steps:
- name: Require story gates and mode-appropriate feature gates
env:
FEATURE_VALIDATION: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }}
FEATURE_VALIDATION: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }}
RUST_RESULT: ${{ needs.rust.result }}
UI_RESULT: ${{ needs.ui.result }}
RUST_FEATURE_RESULT: ${{ needs.rust-feature.result }}
+90
View File
@@ -0,0 +1,90 @@
name: Targeted Frontend Diagnostic
on:
workflow_dispatch:
env:
CARGO_BUILD_JOBS: "2"
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
TESTCONTAINERS_RYUK_DISABLED: "true"
jobs:
duplicate-submit:
name: Duplicate Submit Diagnostic
runs-on: ubuntu-latest
timeout-minutes: 30
services:
crank-e2e-postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: crank
POSTGRES_USER: crank
POSTGRES_PASSWORD: crank
options: >-
--health-cmd "pg_isready -U crank -d crank"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
CRANK_E2E_USE_EXTERNAL_POSTGRES: "1"
CRANK_E2E_POSTGRES_HOST: crank-e2e-postgres
CRANK_E2E_POSTGRES_PORT: "5432"
CRANK_E2E_POSTGRES_DB: crank
CRANK_E2E_POSTGRES_USER: crank
CRANK_E2E_POSTGRES_PASSWORD: crank
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install Rust toolchain
run: |
set -eu
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n1)"
if [ -z "$toolchain" ]; then
echo "Unable to read Rust toolchain channel from rust-toolchain.toml" >&2
exit 1
fi
if ! rustup run "$toolchain" rustc --version >/dev/null 2>&1 || \
! rustup run "$toolchain" cargo --version >/dev/null 2>&1 || \
! rustup run "$toolchain" rustfmt --version >/dev/null 2>&1 || \
! rustup run "$toolchain" cargo-clippy --version >/dev/null 2>&1; then
rustup toolchain install "$toolchain" --profile minimal --component clippy --component rustfmt
fi
host="$(rustup run "$toolchain" rustc -vV | sed -n 's/^host: //p')"
toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/${toolchain}-${host}"
toolchain_bin="$toolchain_dir/bin"
if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then
echo "Rust $toolchain was not installed at $toolchain_dir." >&2
exit 1
fi
printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH"
"$toolchain_bin/rustc" --version
"$toolchain_bin/cargo" --version
"$toolchain_bin/rustfmt" --version
"$toolchain_bin/cargo-clippy" --version
- name: Verify runner tools
run: |
rustc --version
cargo --version
node --version
npm --version
docker --version
- name: Install UI dependencies
working-directory: apps/ui
run: npm ci
- name: Install Chromium
working-directory: apps/ui
run: npx playwright install --with-deps chromium
- name: Prebuild E2E services
run: cargo build -p admin-api -p mcp-server --jobs "$CARGO_BUILD_JOBS"
- name: Run only the duplicate-submit test
working-directory: apps/ui
env:
CI: "1"
run: >-
npx playwright test tests/e2e/secrets.spec.js
--grep "secret modal clears sensitive values and locks duplicate submit while saving"
--workers=1
--retries=0
+52
View File
@@ -0,0 +1,52 @@
name: Story CI
on:
pull_request:
branches: ['epic/**']
types: [opened, synchronize, reopened]
jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Install Rust toolchain
run: |
set -eu
toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n1)"
if [ -z "$toolchain" ]; then
echo "Unable to read Rust toolchain channel from rust-toolchain.toml" >&2
exit 1
fi
if ! rustup run "$toolchain" rustc --version >/dev/null 2>&1 || \
! rustup run "$toolchain" cargo --version >/dev/null 2>&1 || \
! rustup run "$toolchain" rustfmt --version >/dev/null 2>&1 || \
! rustup run "$toolchain" cargo-clippy --version >/dev/null 2>&1; then
rustup toolchain install "$toolchain" --profile minimal --component clippy --component rustfmt
fi
host="$(rustup run "$toolchain" rustc -vV | sed -n 's/^host: //p')"
toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/${toolchain}-${host}"
toolchain_bin="$toolchain_dir/bin"
if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then
echo "Rust $toolchain was not installed at $toolchain_dir." >&2
exit 1
fi
printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH"
"$toolchain_bin/rustc" --version
"$toolchain_bin/cargo" --version
"$toolchain_bin/rustfmt" --version
"$toolchain_bin/cargo-clippy" --version
- name: Check formatting
run: cargo fmt --all --check
- name: Check Rust code health
run: scripts/check-rust-code-health.sh
- name: Check Rust boundaries
run: scripts/check-rust-boundaries.sh
Generated
+8 -8
View File
@@ -598,9 +598,9 @@ checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
[[package]]
name = "cookie"
version = "0.18.1"
version = "0.18.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
checksum = "d55f2d6c30eeec7d5c6f98bd4395d4abb1895629eab97ee6522d340623615f8a"
dependencies = [
"percent-encoding",
"time",
@@ -1277,9 +1277,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
dependencies = [
"percent-encoding",
]
@@ -2553,9 +2553,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.17"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
checksum = "f120c8d5021b34abd2f2ffd7ee96687cbcd6c54a3e68d86b6169f4a5cd480ffe"
[[package]]
name = "pkg-config"
@@ -4406,9 +4406,9 @@ dependencies = [
[[package]]
name = "url"
version = "2.5.8"
version = "2.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
dependencies = [
"form_urlencoded",
"idna",
+8 -2
View File
@@ -12,7 +12,9 @@ use crank_observability::{
MetricService, MetricsConfig, ObservabilityConfig, ObservabilityLifecycle, OtlpTraceConfig,
RedactionLimits, SentryConfig, ServiceIdentity, bound_metric_service,
};
use crank_registry::{MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate, PostgresRegistry};
use crank_registry::{
MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate, MigrationAuthority, PostgresRegistry,
};
use crank_runtime::SecretCrypto;
use time::{OffsetDateTime, format_description::well_known::Rfc3339};
use tower::ServiceExt;
@@ -120,12 +122,16 @@ async fn real_admin_startup_runs_immediate_import_maintenance() {
String::from_utf8_lossy(&applied.stderr)
);
let pool = sqlx::PgPool::connect(&database_url).await.unwrap();
let canonical_version = MigrationAuthority::sequence()
.last()
.expect("canonical migration sequence is nonempty")
.version;
assert_eq!(
sqlx::query_scalar::<_, Option<i64>>("select max(version) from __crank_migrations")
.fetch_one(&pool)
.await
.unwrap(),
Some(23),
Some(canonical_version),
"migration binary must install the current canonical ledger",
);
sqlx::query(
+11 -3
View File
@@ -3,7 +3,8 @@ use std::process::{Command, Output};
use crank_community_auth::{hash_password, verify_password};
use crank_core::{Secret, SecretId, SecretKind, SecretStatus, UserSessionId, WorkspaceId};
use crank_registry::{
CreateSecretRequest, MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate, PostgresRegistry,
CreateSecretRequest, MASTER_KEY_CIPHER_CONTRACT, MasterKeyIdentityCandidate,
MigrationAuthority, PostgresRegistry,
};
use crank_runtime::SecretCrypto;
use serde_json::json;
@@ -40,7 +41,10 @@ fn plan_is_deterministic_and_committed_contract_is_current() {
);
assert_eq!(first.stdout, second.stdout);
let plan: serde_json::Value = serde_json::from_slice(&first.stdout).unwrap();
assert_eq!(plan["sequence"].as_array().unwrap().len(), 23);
assert_eq!(
plan["sequence"].as_array().unwrap().len(),
MigrationAuthority::sequence().len()
);
let target = command(&["plan", "--target-version"], None);
assert!(
target.status.success(),
@@ -104,7 +108,11 @@ async fn database_only_config_can_apply_and_preflight_a_fresh_schema() {
);
let result: serde_json::Value = serde_json::from_slice(&preflight.stdout).unwrap();
assert_eq!(result["status"], "current");
assert_eq!(result["version"], 23);
let canonical_version = MigrationAuthority::sequence()
.last()
.expect("canonical migration sequence is nonempty")
.version;
assert_eq!(result["version"].as_i64(), Some(canonical_version));
}
#[tokio::test]
+6 -3
View File
@@ -15,12 +15,15 @@ COPY crank-community.png ./crank-community.png
RUN npm run build
FROM nginx:1.30.6-alpine3.24-slim
FROM nginx:1.30.7-alpine3.24-slim
RUN apk add --no-cache --upgrade \
'pcre2>=10.49-r0' \
'libcrypto3>=3.5.8-r0' \
'libssl3>=3.5.8-r0'
'busybox>=1.37.0-r32' \
'busybox-binsh>=1.37.0-r32' \
'ssl_client>=1.37.0-r32' \
'libcrypto3>=3.5.10-r0' \
'libssl3>=3.5.10-r0'
COPY apps/ui/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
+5
View File
@@ -19,6 +19,11 @@ async function login(page) {
await page.evaluate(async () => {
await window.CrankAuth.fetchSession(false);
});
await page.waitForFunction(() => Boolean(
window.CrankAuth &&
typeof window.CrankAuth.getCsrfToken === 'function' &&
window.CrankAuth.getCsrfToken()
));
}
async function browserJson(page, method, urlPath, body, okStatuses = [200]) {
+27
View File
@@ -130,6 +130,33 @@ test('secret modal clears sensitive values and locks duplicate submit while savi
await page.locator('[data-testid="secret-value-input"]').fill('ui-secret-canary-submit');
const submit = page.locator('[data-testid="secret-submit-button"]');
await submit.click();
const immediate = await page.evaluate(() => {
const button = document.querySelector('[data-testid="secret-submit-button"]');
const modal = document.querySelector('[data-testid="secret-create-modal"] .modal');
return {
buttonPresent: Boolean(button),
disabled: Boolean(button && button.disabled),
labelChanged: Boolean(button && button.textContent.trim() !== 'Create secret'),
modalOpen: Boolean(modal && modal.classList.contains('open')),
documentReady: document.readyState === 'complete',
};
});
await page.waitForTimeout(250);
const afterDelay = await page.evaluate(() => {
const button = document.querySelector('[data-testid="secret-submit-button"]');
const modal = document.querySelector('[data-testid="secret-create-modal"] .modal');
return {
buttonPresent: Boolean(button),
disabled: Boolean(button && button.disabled),
labelChanged: Boolean(button && button.textContent.trim() !== 'Create secret'),
modalOpen: Boolean(modal && modal.classList.contains('open')),
};
});
process.stdout.write('[secrets-submit-diagnostic] ' + JSON.stringify({
immediate,
afterDelay,
interceptedCreatePosts: createPosts,
}) + '\n');
await expect(submit).toBeDisabled();
await submit.click({ force: true });
expect(createPosts).toBe(1);
+3 -3
View File
@@ -217,13 +217,13 @@ string_enum! {
Concurrency => "concurrency",
RateLimit => "rate_limit",
McpStream => "mcp_stream",
Admission => "admission",
}
}
string_enum! {
pub enum RejectionReason {
Limit => "limit",
Capacity => "capacity",
QueueFull => "queue_full",
Deadline => "deadline",
@@ -234,7 +234,7 @@ string_enum! {
string_enum! {
pub enum ScopeKind {
Process => "process",
Global => "global",
Agent => "agent",
Tool => "tool",
+4 -10
View File
@@ -350,24 +350,18 @@ pub fn record_limit_rejection(stage: LimitStage) {
if bound_family("crank_runtime_limit_rejections_total").is_none() {
return;
}
metrics::counter!(
"crank_runtime_limit_rejections_total",
"stage" => stage.as_str(),
"reason" => RejectionReason::Limit.as_str(),
"scope_kind" => ScopeKind::Process.as_str()
)
.increment(1);
metrics::counter!("crank_runtime_limit_rejections_total", "stage" => stage.as_str())
.increment(1);
}
/// Typed admission refusal with finite, low-cardinality labels only: no workspace, Agent, Tool,
/// request id, fingerprint or arbitrary error text ever becomes a label.
pub fn record_admission_rejection(reason: RejectionReason, scope_kind: ScopeKind) {
if bound_family("crank_runtime_limit_rejections_total").is_none() {
if bound_family("crank_runtime_admission_rejections_total").is_none() {
return;
}
metrics::counter!(
"crank_runtime_limit_rejections_total",
"stage" => LimitStage::Admission.as_str(),
"crank_runtime_admission_rejections_total",
"reason" => reason.as_str(),
"scope_kind" => scope_kind.as_str()
)
+14 -4
View File
@@ -407,16 +407,26 @@ pub(crate) const METRIC_SCHEMA: &[MetricDefinition] = &[
"crank_runtime_limit_rejections_total",
MetricKind::Counter,
MetricUnit::Count,
&["stage", "reason", "scope_kind"],
&["stage"],
&[domain("stage", LIMIT_STAGES)],
&[],
BOTH,
3,
"Runtime executions rejected by a bounded limit.",
),
metric(
"crank_runtime_admission_rejections_total",
MetricKind::Counter,
MetricUnit::Count,
&["reason", "scope_kind"],
&[
domain("stage", LIMIT_STAGES),
domain("reason", REJECTION_REASONS),
domain("scope_kind", SCOPE_KINDS),
],
&[],
BOTH,
96,
"Runtime executions rejected by a bounded limit.",
15,
"Runtime executions rejected by scoped admission.",
),
metric(
"crank_runtime_admission_queue_wait_seconds",
+28 -1
View File
@@ -12,7 +12,7 @@ use crank_metrics::{
record_mcp_request, record_tool_invocation, record_upstream_request, set_catalog,
set_db_pool_connections, set_mcp_active_sessions, set_mcp_session_metrics_fresh,
};
use metrics_util::debugging::DebuggingRecorder;
use metrics_util::debugging::{DebugValue, DebuggingRecorder};
/// Service binding is process-global (`OnceLock`), so every case that needs a
/// different service runs in a fresh child re-executed from this same test
@@ -282,6 +282,33 @@ fn every_recording_api_matches_the_declared_schema() {
});
let snapshot = snapshotter.snapshot().into_vec();
for (name, labels) in [
(
"crank_runtime_limit_rejections_total",
BTreeSet::from([("stage", "concurrency")]),
),
(
"crank_runtime_admission_rejections_total",
BTreeSet::from([("reason", "capacity"), ("scope_kind", "global")]),
),
] {
let mut samples = snapshot
.iter()
.filter(|(key, _, _, _)| key.key().name() == name);
let (key, _, _, value) = samples.next().expect(name);
assert!(
samples.next().is_none(),
"unexpected extra series for {name}"
);
assert_eq!(
key.key()
.labels()
.map(|label| (label.key(), label.value()))
.collect::<BTreeSet<_>>(),
labels
);
assert!(matches!(value, DebugValue::Counter(1)), "{name}: {value:?}");
}
let actual_names = snapshot
.iter()
.map(|(key, _, _, _)| key.key().name().to_owned())
+21 -9
View File
@@ -11,7 +11,7 @@ use crank_metrics::{
#[test]
fn schema_v1_is_complete_deterministic_and_inside_the_frozen_budget() {
assert_eq!(METRIC_SCHEMA_VERSION, 2);
assert_eq!(metric_schema().len(), 23);
assert_eq!(metric_schema().len(), 26);
for service in [MetricService::AdminApi, MetricService::McpServer] {
let budget = schema_budget(service).expect("canonical schema must be valid");
@@ -79,15 +79,15 @@ fn canonical_schema_validation_reports_its_category() {
assert_eq!(
schema_budget(MetricService::AdminApi),
Ok(crank_metrics::SchemaBudget {
logical_series: 6_381,
rendered_series: 19_611
logical_series: 6_303,
rendered_series: 19_533
})
);
assert_eq!(
schema_budget(MetricService::McpServer),
Ok(crank_metrics::SchemaBudget {
logical_series: 1_179,
rendered_series: 3_654
logical_series: 1_101,
rendered_series: 3_576
})
);
}
@@ -343,13 +343,25 @@ fn v1_and_v2_registries_are_metric_by_metric_compatible() {
let v1 = metric_objects(V1);
let v2 = metric_objects(V2);
assert_eq!(v1.len(), 23);
let admission_families = [
"crank_runtime_admission_rejections_total",
"crank_runtime_admission_queue_wait_seconds",
"crank_runtime_admission_oldest_waiting_seconds",
];
let (admission, v2_legacy): (Vec<_>, Vec<_>) = v2
.iter()
.partition(|(name, _)| admission_families.contains(&name.as_str()));
assert_eq!(
v1.iter().map(|(name, _)| name.clone()).collect::<Vec<_>>(),
v2.iter().map(|(name, _)| name.clone()).collect::<Vec<_>>(),
"v2 обязан сохранить тот же набор и порядок family"
admission
.iter()
.map(|(name, _)| name.as_str())
.collect::<Vec<_>>(),
admission_families
);
assert_eq!(v1.len(), v2_legacy.len());
for ((name, v1_object), (_, v2_object)) in v1.iter().zip(v2.iter()) {
for ((name, v1_object), (v2_name, v2_object)) in v1.iter().zip(v2_legacy) {
assert_eq!(name, v2_name, "v2 обязан сохранить порядок v1 family");
for field in ["kind", "unit", "help", "processes", "buckets_seconds"] {
assert_eq!(
json_field(v1_object, field),
+9 -9
View File
@@ -543,22 +543,22 @@ fn root_budgets_are_per_process_only() {
"root обязан объявлять ровно один ключ budgets"
);
assert!(rendered.ends_with(
",\"budgets\":[{\"process\":\"admin_api\",\"families\":17,\"logical_series\":6381,\
\"rendered_series\":19611,\"exemplar_slots\":12348},{\"process\":\"mcp_server\",\
\"families\":25,\"logical_series\":1179,\"rendered_series\":3654,\"exemplar_slots\":2310}]}\n"
",\"budgets\":[{\"process\":\"admin_api\",\"families\":18,\"logical_series\":6303,\
\"rendered_series\":19533,\"exemplar_slots\":12348},{\"process\":\"mcp_server\",\
\"families\":26,\"logical_series\":1101,\"rendered_series\":3576,\"exemplar_slots\":2310}]}\n"
));
assert_eq!(
schema_budget(MetricService::AdminApi),
Ok(crank_metrics::SchemaBudget {
logical_series: 6_381,
rendered_series: 19_611
logical_series: 6_303,
rendered_series: 19_533
})
);
assert_eq!(
schema_budget(MetricService::McpServer),
Ok(crank_metrics::SchemaBudget {
logical_series: 1_179,
rendered_series: 3_654
logical_series: 1_101,
rendered_series: 3_576
})
);
}
@@ -751,7 +751,7 @@ fn service_projection_cache_is_allocated_once() {
}
assert_eq!(
metric_schema().len(),
23,
"union metadata сохраняет 23 family"
26,
"union metadata сохраняет 23 family v1 и три family admission"
);
}
@@ -9,7 +9,8 @@ fn sequence_is_deterministic_and_append_only() {
assert_eq!(
first.iter().map(|item| item.version).collect::<Vec<_>>(),
vec![
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30
]
);
assert_eq!(first[0].checksum, "crank-community-baseline-v1");
+12 -6
View File
@@ -167,7 +167,7 @@ scrape_configs:
credentials_file: /run/secrets/crank_metrics_token
```
Семейства первой версии:
Семейства текущего registry:
- `crank_http_requests_total`, `crank_http_request_duration_seconds`,
`crank_http_inflight`;
@@ -178,6 +178,7 @@ scrape_configs:
- `crank_upstream_requests_total`,
`crank_upstream_request_duration_seconds`;
- `crank_runtime_inflight`, `crank_runtime_limit_rejections_total`,
`crank_runtime_admission_rejections_total`,
`crank_runtime_admission_queue_wait_seconds`,
`crank_runtime_admission_oldest_waiting_seconds`,
`crank_runtime_cache_total`, `crank_idempotency_total`,
@@ -218,12 +219,17 @@ freshness в `1`. Прикладные ошибки JSON-RPC и
завершает соответствующее измерение закрытым исходом `aborted`, поэтому
фактически начатый вызов не исчезает из показателей.
`crank_runtime_limit_rejections_total` сохраняет только product label `stage`
(`concurrency`, `rate_limit`, `mcp_stream`). Отказы scoped admission учитываются
отдельно в `crank_runtime_admission_rejections_total` с закрытыми labels
`reason` и `scope_kind` и не инкрементируют прежний счётчик.
Buckets длительности фиксированы кодом:
`0.005`, `0.01`, `0.025`, `0.05`, `0.1`, `0.25`, `0.5`, `1`, `2.5`, `5`,
`10`, `30`, `60` секунд. Это пока техническая шкала, а не SLO. Registry v2
(`schemas/metrics-registry-v2.json`, генерируется Rust descriptor table,
`schema_version=2`) содержит те же 23 family и фиксирует допустимые
HTTP-идентичности как единственное typed перечисление route+owners: union 91,
`schema_version=2`) сохраняет 23 семейства v1 и добавляет три семейства admission.
Он фиксирует HTTP-идентичности как единое typed перечисление route+owners: union 91,
admin-проекция 86, mcp-проекция 8, общие ровно `/health`, `/ready`,
`unmatched`. Тринадцать Resource-шаблонов
(`/api/admin/workspaces/{workspace_id}/resources` и его `{resource_id}`,
@@ -237,10 +243,10 @@ Prompt-шаблонов (`.../prompts`, `.../prompts/import`, `.../prompts/{prom
Бюджет кардинальности считается **на процесс**, а не на union:
- admin-api — 15 family, 6 285 logical, 19 515 rendered, 12 348 exemplar slots;
- mcp-server — 23 family, 1 083 logical, 3 558 rendered, 2 310 exemplar slots.
- admin-api — 18 family, 6 303 logical, 19 533 rendered, 12 348 exemplar slots;
- mcp-server — 26 family, 1 101 logical, 3 576 rendered, 2 310 exemplar slots.
Hard ceilings — 6 285 logical / 19 515 rendered / 12 348 exemplar
Hard ceilings — 6 381 logical / 19 611 rendered / 12 348 exemplar
slots на процесс и 8 388 608 bytes (8 MiB) на готовый exposition. Ранее
logical ceiling поднимали с 5 563 до 5 585 явным решением владельца только для
регистрации уже существующего revoke-маршрута Resource, затем для трёх адресов
+1 -1
View File
@@ -1 +1 @@
{"schema_version":2,"limits":{"max_families":128,"max_product_labels_per_family":4,"max_logical_series":6381,"max_rendered_series":19611,"max_exemplar_slots":12348,"max_exposition_bytes":8388608},"global_labels":[{"name":"service","class":"process_constant","domain":["admin-api","mcp-server"]},{"name":"version","class":"process_constant","domain":["validated_release_identity"]},{"name":"environment","class":"process_constant","domain":["validated_startup_value"]}],"http_routes":[{"route":"/api/admin/capabilities","processes":["admin_api"]},{"route":"/api/admin/workspaces","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/tool-search/preview","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/archive","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/bindings","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys/{key_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys/{key_id}/revoke","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/publish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/unpublish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/versions/{version}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}/approve","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}/deny","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/auth-profiles","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/auth-profiles/{auth_profile_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/export","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/plans/{plan_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/preview","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{job_id}/create","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{job_id}/plans","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{plan_id}/apply","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs/export.csv","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs/{log_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/events","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/import-context","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/reset-selection","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/select-draft","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/analyze-quality","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/import","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/archive","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/drafts/generate","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/export","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/publish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/samples/input-json","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/samples/output-json","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/test-runs","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/Line truncated
{"schema_version":2,"limits":{"max_families":128,"max_product_labels_per_family":4,"max_logical_series":6381,"max_rendered_series":19611,"max_exemplar_slots":12348,"max_exposition_bytes":8388608},"global_labels":[{"name":"service","class":"process_constant","domain":["admin-api","mcp-server"]},{"name":"version","class":"process_constant","domain":["validated_release_identity"]},{"name":"environment","class":"process_constant","domain":["validated_startup_value"]}],"http_routes":[{"route":"/api/admin/capabilities","processes":["admin_api"]},{"route":"/api/admin/workspaces","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/tool-search/preview","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/archive","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/bindings","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys/{key_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/platform-api-keys/{key_id}/revoke","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/publish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/unpublish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/agents/{agent_id}/versions/{version}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}/approve","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/approvals/{approval_id}/deny","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/auth-profiles","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/auth-profiles/{auth_profile_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/export","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/plans/{plan_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/preview","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{job_id}/create","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{job_id}/plans","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/imports/openapi/{plan_id}/apply","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs/export.csv","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/logs/{log_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/events","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/import-context","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/reset-selection","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/onboarding/select-draft","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/analyze-quality","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/import","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/archive","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/drafts/generate","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/export","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/publish","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/samples/input-json","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/samples/output-json","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/operations/{operation_id}/test-runs","processes":["admin_api"]},{"route":"/api/admin/workspaces/{workspace_id}/Line truncated
+4 -5
View File
@@ -156,11 +156,10 @@ class DeployPolicyTests(unittest.TestCase):
self.assertIn("default: none", block)
self.assertIn("required: true", block)
def test_push_main_source_ci_stays_enabled(self):
self.assertRegex(
workflow_text(),
r"(?m)^ push:\n branches:\n - main$",
)
def test_full_ci_targets_main_pull_requests(self):
workflow = workflow_text()
self.assertRegex(workflow, r"(?m)^ pull_request:\n branches: \[main\]$")
self.assertNotRegex(workflow, r"(?m)^ push:")
def test_deploy_requires_successful_required_checks(self):
deploy = job_block("deploy")
+1 -1
View File
@@ -112,7 +112,7 @@ class WorkflowScopeTests(unittest.TestCase):
def test_only_four_heavy_rust_steps_are_skippable(self):
workflow = WORKFLOW.read_text(encoding="utf-8")
self.assertIn("run: python3 scripts/ci-release-tooling-scope.py", workflow)
self.assertIn("FORCE_FULL: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }}", workflow)
self.assertIn("FORCE_FULL: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }}", workflow)
conditional = "if: steps.release_tooling.outputs.ci_only != 'true'"
for name in (
"Check typed runtime configuration contract",