Skip to content

test(mcp): prove tracedecay_god_class behavior #2217

test(mcp): prove tracedecay_god_class behavior

test(mcp): prove tracedecay_god_class behavior #2217

# Coverage lanes for the hotpath instrumentation already present in two
# slices:
# * storage, tracedecay-rusqlite-runtime, tracedecay-global-db
# (`slice-tests`)
# * sessions/lcm/capture/temporal-query, tracedecay-sessions,
# tracedecay-session-memory, tracedecay-session-runtime,
# tracedecay-session-temporal-store, tracedecay-lcm, tracedecay-capture,
# tracedecay-temporal-query (`sessions-slice-tests`)
#
# Each job runs two lanes of the same test set:
# 1. feature off. Every `#[hotpath::measure]` macro must stay a no-op;
# 2. `--features <crate>/hotpath`. The `hotpath_coverage` tests wrap a
# real workload in a HotpathGuard and assert the JSON report carries
# the crates' existing measure labels, so the lane fails if the
# measures stop firing.
#
# hotpath stays opt-in: nothing here touches `default` or `production`
# feature sets, and the metrics HTTP server is disabled at the job boundary
# (see .github/workflows/hotpath-profile.yml, which owns the separate
# index-bench profiling lane and is unaffected by this workflow).
name: hotpath-coverage
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
# Only Rust inputs can change what these slice tests compile or measure;
# dashboard, plugin, docs and script-only pull requests do not queue it.
paths:
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".cargo/**"
- ".config/nextest.toml"
- ".github/workflows/hotpath-coverage.yml"
- "scripts/check-rust-cache-lineage.py"
- "scripts/drop-prefix-restored-rust-artifacts.sh"
- "scripts/rust_cache_lineage.py"
- "scripts/test-rust-cache-lineage.py"
workflow_dispatch:
concurrency:
group: hotpath-coverage-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# Hotpath binds a localhost metrics server by default; tests disable it
# themselves before building a guard, and this makes that explicit at the
# job boundary too.
HOTPATH_METRICS_SERVER_OFF: "1"
# rustc writes .rmeta read-only and updates them in place when incremental
# compilation is on. A restored rust-cache blob then fails the compile.
CARGO_INCREMENTAL: "0"
jobs:
slice-tests:
# Opt-in per pull request: label `perf`. Each lane builds the workspace
# more than once, which no draft or routine PR should charge to the 20
# free runner slots by default. Dispatch runs unconditionally.
if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'perf')
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Check rust-cache restore lineage
run: |
python3 scripts/test-rust-cache-lineage.py
python3 scripts/check-rust-cache-lineage.py
# Unique v1-rust shared-key so this job never prefix-restores another
# lane's (or a kache-era v0-rust) compiler tree. rustc writes .rmeta
# read-only; a lockfile-prefix restore of those files fails the compile.
- name: Cache Rust dependency artifacts
id: rust-cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: hotpath-coverage-slice
cache-workspace-crates: "false"
cache-on-failure: true
- name: Discard prefix-restored compiler artifacts
run: scripts/drop-prefix-restored-rust-artifacts.sh "${{ steps.rust-cache.outputs.cache-hit }}"
# `test-helpers` only unlocks the registered-store harness the
# coverage test drives; it gates no production code.
- name: Slice tests (hotpath off)
run: |
cargo test -p tracedecay-rusqlite-runtime -p tracedecay-global-db \
--locked --features tracedecay-global-db/test-helpers
- name: Slice tests (hotpath on)
run: |
cargo test -p tracedecay-rusqlite-runtime -p tracedecay-global-db \
--locked --features \
tracedecay-rusqlite-runtime/hotpath,tracedecay-global-db/hotpath,tracedecay-global-db/test-helpers
sessions-slice-tests:
# Opt-in per pull request: label `perf`. Each lane builds the workspace
# more than once, which no draft or routine PR should charge to the 20
# free runner slots by default. Dispatch runs unconditionally.
if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'perf')
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependency artifacts
id: rust-cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1-rust
shared-key: hotpath-coverage-sessions
cache-workspace-crates: "false"
cache-on-failure: true
- name: Discard prefix-restored compiler artifacts
run: scripts/drop-prefix-restored-rust-artifacts.sh "${{ steps.rust-cache.outputs.cache-hit }}"
- name: Sessions slice tests (hotpath off)
run: |
cargo test -p tracedecay-sessions -p tracedecay-session-memory \
-p tracedecay-session-runtime -p tracedecay-session-temporal-store \
-p tracedecay-lcm -p tracedecay-capture -p tracedecay-temporal-query \
--locked
- name: Sessions slice tests (hotpath on)
run: |
cargo test -p tracedecay-sessions -p tracedecay-session-memory \
-p tracedecay-session-runtime -p tracedecay-session-temporal-store \
-p tracedecay-lcm -p tracedecay-capture -p tracedecay-temporal-query \
--locked --features \
tracedecay-sessions/hotpath,tracedecay-session-memory/hotpath,tracedecay-session-runtime/hotpath,tracedecay-session-temporal-store/hotpath,tracedecay-lcm/hotpath,tracedecay-capture/hotpath,tracedecay-temporal-query/hotpath