Skip to content

feat(math-foundry): certified E1 pattern catalogue and guarded baseline fallback #3953

feat(math-foundry): certified E1 pattern catalogue and guarded baseline fallback

feat(math-foundry): certified E1 pattern catalogue and guarded baseline fallback #3953

Workflow file for this run

name: Style Check
on:
push:
branches:
- main
pull_request:
paths:
- crates/**
- Cargo.toml
- Cargo.lock
- .github/workflows/style.yml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=x86-64-v3"
# Least-privilege: these jobs only read the repo (checkout + build + lint).
permissions:
contents: read
jobs:
# Clippy runs FIRST and is mandatory — logical soundness before syntax.
# Discipline:
# - NEVER use `clippy --fix` for unused-import warnings; they signal
# missing wiring, not dead code. Fix the wiring or add `#[allow]`
# with a comment explaining why.
# - Each clippy violation is owned by the author of the code that
# introduced it; resolve manually.
# - Run clippy in batches (per-feature combo), not after every file edit.
clippy:
runs-on: ubuntu-24.04
timeout-minutes: 25
defaults:
run:
working-directory: lance-graph
steps:
- uses: actions/checkout@v4
with:
path: lance-graph
- name: Checkout AdaWorldAPI/ndarray (sibling dependency)
uses: actions/checkout@v4
with:
repository: AdaWorldAPI/ndarray
# ndarray master now exports wht_f32, kmeans, squared_l2,
# dequantize_i8_to_f32, quantize_f32_to_i2, dequantize_i2_to_f32
# publicly (ndarray PR #115, merged 2026-04-30). Pin retired.
path: ndarray
- name: Checkout AdaWorldAPI/OGAR (sibling dependency, NO-PIN path deps)
uses: actions/checkout@v4
with:
repository: AdaWorldAPI/OGAR
path: OGAR
# Toolchain comes from `rust-toolchain.toml` (channel + components), NOT
# from a version restated here. `rustup show` installs and activates
# whatever that file pins — so a bump is ONE edit in ONE file, which is
# exactly what that file's own comment asks for ("a bump edits `channel`
# and leaves the prose behind"). Previously this installed `stable` and
# set it as default; inside the repo the toolchain file won anyway, so
# these jobs already ran on the pin while the workflow said otherwise.
- name: Setup rust toolchain (pinned by rust-toolchain.toml)
run: |
rustup show
# Redundant with `rust-toolchain.toml`'s `components = ["rustfmt",
# "clippy"]`, which `rustup show` already installs — kept because it
# is idempotent and because removing it would be a second change in a
# step that just broke.
rustup component add clippy
- uses: Swatinem/rust-cache@v2
with:
shared-key: "lance-graph-deps"
workspaces: lance-graph/crates/lance-graph
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler
# Clippy is gated tier-by-tier as the codebase incrementally adopts it.
# PRs that touch a new crate own that crate's clippy debt before merging.
#
# Tier A (mandatory, gating): zero-dep contract crate
- name: Clippy contract (zero-dep, mandatory)
run: cargo clippy --manifest-path crates/lance-graph-contract/Cargo.toml --lib --tests -- -D warnings
# lance-graph-mask-risc joined the workspace clean (PR2); gated while
# clean so it cannot silently regress — the deepnsm rule below.
- name: Clippy lance-graph-mask-risc (mandatory)
run: cargo clippy --manifest-path crates/lance-graph-mask-risc/Cargo.toml --all-targets -- -D warnings
# lance-graph-quack joined clean; gated while clean, same rule.
# `--all-targets` is load-bearing here rather than habitual: the A1
# measurement lives in `examples/adaptive_order_probe.rs`, and `--lib`
# would leave the probe unlinted.
- name: Clippy lance-graph-quack (mandatory)
run: cargo clippy --manifest-path crates/lance-graph-quack/Cargo.toml --all-targets --all-features -- -D warnings
# Tier B (advisory until incrementally cleaned, non-gating):
# lance-graph core has ~91 pre-existing clippy violations to be paid down
# in subsequent PRs (TD-CLIPPY-LG-1). Don't auto-fix — each violation
# is a wiring/refactor decision owned by the introducing author.
- name: Clippy lance-graph (advisory)
continue-on-error: true
run: cargo clippy --manifest-path crates/lance-graph/Cargo.toml --lib --tests -- -D warnings
# Tier A (mandatory, gating): deepnsm is now clippy-clean — TD-DEEPNSM-CLIPPY-195
# resolved 2026-06-09 by a hand-reviewed sweep. It's a standalone 0-dep codec
# crate, workspace-excluded, so the lance-graph clippy steps don't cover it;
# gate it explicitly (same posture as the contract crate) so it can't regress.
- name: Clippy deepnsm (mandatory)
run: cargo clippy --manifest-path crates/deepnsm/Cargo.toml --all-targets -- -D warnings
# Tier A (mandatory, gating): deepnsm-v2 (PR #798) shipped clippy-clean and
# is workspace-excluded like deepnsm, so the lance-graph clippy steps don't
# cover it; gate it explicitly (same posture) so it can't regress.
- name: Clippy deepnsm-v2 (mandatory)
run: cargo clippy --manifest-path crates/deepnsm-v2/Cargo.toml --all-targets -- -D warnings
# Tier B (advisory until incrementally cleaned, non-gating): bgz-tensor is
# a workspace-EXCLUDED codec crate that was never clippy-gated, so it
# carries pre-existing doc-lint debt (~9 `doc_lazy_continuation` in
# adaptive_codec.rs — TD-BGZ-TENSOR-CLIPPY, owned by the introducing
# author per the no-auto-fix rule above). Run it advisory so the NEW
# `morton_cascade` module (which IS clippy-clean) is exercised and its
# debt is visible, without gating #773 on unrelated pre-existing lints.
# Promote to mandatory once the adaptive_codec.rs debt is paid down.
- name: Clippy bgz-tensor (advisory)
continue-on-error: true
run: cargo clippy --manifest-path crates/bgz-tensor/Cargo.toml --all-targets -- -D warnings
# Tier A (mandatory, gating): lance-graph-callcenter UNDER `--features query`.
#
# The feature matters more than the crate. `default = []` here, so a bare
# clippy run on this crate compiles almost none of it and exits 0 while
# `vsa_udfs` and `transcode::ontology_table` — both behind
# `query` / `query-lite` — are never seen. That false green is measured,
# not hypothetical: it happened twice in one session (2026-08-05), and the
# second time it hid two genuinely failing tests as well
# (E-A-FEATURE-CONDITIONAL-CLASSID-SILENTLY-EMPTIED-A-FIXTURE-1).
#
# A green run that never compiled the module is not coverage. Gated
# mandatory rather than advisory because the crate is clean TODAY
# (0 errors under this feature) — same posture as deepnsm: gate it while
# it is clean so it cannot silently regress.
- name: Clippy callcenter --features query (mandatory)
run: cargo clippy --manifest-path crates/lance-graph-callcenter/Cargo.toml --features query --lib --tests -- -D warnings
format:
runs-on: ubuntu-24.04
timeout-minutes: 15
needs: clippy
defaults:
run:
working-directory: lance-graph
steps:
- uses: actions/checkout@v4
with:
path: lance-graph
- name: Checkout AdaWorldAPI/ndarray (sibling dependency for cargo metadata)
uses: actions/checkout@v4
with:
repository: AdaWorldAPI/ndarray
# ndarray master now exports wht_f32, kmeans, squared_l2,
# dequantize_i8_to_f32, quantize_f32_to_i2, dequantize_i2_to_f32
# publicly (ndarray PR #115, merged 2026-04-30). Pin retired.
path: ndarray
- name: Checkout AdaWorldAPI/OGAR (sibling dependency, NO-PIN path deps)
uses: actions/checkout@v4
with:
repository: AdaWorldAPI/OGAR
path: OGAR
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Check formatting (lance-graph)
run: cargo fmt --manifest-path crates/lance-graph/Cargo.toml -- --check
# causal-edge: workspace-excluded, so `cargo fmt --all` never reaches it.
# It is rustfmt-clean today (verified before adding this step); the check
# keeps it that way. Its clippy debt is NOT gated here — see the
# rust-test.yml step for why.
- name: Rustfmt causal-edge (workspace-excluded, previously ungated)
run: cargo fmt --manifest-path crates/causal-edge/Cargo.toml -- --check
# The same ten crates the test steps above arm. All ten verified
# rustfmt-clean locally on the pinned toolchain before this was added —
# `sigma-tier-router` was NOT, and is formatted in this commit (14 hunks
# in one file, rustfmt output only, its 20 tests unchanged). Nine were
# already clean and simply had no gate holding them there.
#
# Formatting only. Clippy is deliberately NOT gated for these: it has not
# been measured crate-by-crate, and `causal-edge` alone already carries 7
# pre-existing findings — arming a lint gate on unmeasured crates would
# fail PRs for defects they did not introduce.
- name: Rustfmt lance-graph-catalog (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-catalog/Cargo.toml -- --check
- name: Rustfmt lance-graph-planner (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-planner/Cargo.toml -- --check
- name: Rustfmt lance-graph-mask-risc
run: cargo fmt --manifest-path crates/lance-graph-mask-risc/Cargo.toml -- --check
# The four workspace members that had NO rustfmt line at all. Found by
# measuring the job against the member list rather than reading it: this
# job is per-crate by design (`causal-edge` is workspace-excluded, so
# `--all` would never reach it), and a per-crate job silently omits any
# member nobody added a line for. `lance-graph-contract` is the one that
# matters here — this branch edits `recipes.rs` and nothing was gating it.
# All four verified rustfmt-clean on the pinned toolchain before arming,
# the same rule the block below this one records.
- name: Rustfmt lance-graph-contract (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-contract/Cargo.toml -- --check
- name: Rustfmt lance-graph-callcenter (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-callcenter/Cargo.toml -- --check
- name: Rustfmt lance-graph-supervisor (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-supervisor/Cargo.toml -- --check
- name: Rustfmt bgz-tensor (previously ungated)
run: cargo fmt --manifest-path crates/bgz-tensor/Cargo.toml -- --check
- name: Rustfmt lance-graph-quack
run: cargo fmt --manifest-path crates/lance-graph-quack/Cargo.toml -- --check
- name: Rustfmt lance-graph-ontology (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-ontology/Cargo.toml -- --check
- name: Rustfmt lance-graph-rbac (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-rbac/Cargo.toml -- --check
- name: Rustfmt lance-graph-archetype (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-archetype/Cargo.toml -- --check
- name: Rustfmt lance-graph-consumer-conformance (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-consumer-conformance/Cargo.toml -- --check
- name: Rustfmt sigma-tier-router (previously ungated)
run: cargo fmt --manifest-path crates/sigma-tier-router/Cargo.toml -- --check
- name: Rustfmt neural-debug (previously ungated)
run: cargo fmt --manifest-path crates/neural-debug/Cargo.toml -- --check
- name: Rustfmt cognitive-shader-driver (previously ungated)
run: cargo fmt --manifest-path crates/cognitive-shader-driver/Cargo.toml -- --check
- name: Rustfmt lance-graph-benches (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-benches/Cargo.toml -- --check
- name: Rustfmt lance-graph-hydrate (previously ungated)
run: cargo fmt --manifest-path crates/lance-graph-hydrate/Cargo.toml -- --check
# See the rust-test.yml note: these two were missed by the first sweep
# because the member check's own regex could not see them.
# `surreal_container` was rustfmt-dirty (6 hunks in one test file,
# formatted in this commit, its 5 + 5 tests unchanged).
- name: Rustfmt surreal_container (missed by the first sweep)
run: cargo fmt --manifest-path crates/surreal_container/Cargo.toml -- --check
- name: Rustfmt dto-class-check (missed by the first sweep)
run: cargo fmt --manifest-path tools/dto-class-check/Cargo.toml -- --check
# deepnsm is a standalone, workspace-excluded codec crate, so
# `cargo fmt --all` never reaches it. It was brought to a rustfmt-clean
# baseline in this PR; check it explicitly so it can't silently drift.
- name: Check formatting (deepnsm)
run: cargo fmt --manifest-path crates/deepnsm/Cargo.toml -- --check
# deepnsm-v2 (PR #798) is likewise standalone + workspace-excluded, so
# `cargo fmt --all` never reaches it. It shipped rustfmt-clean; check it
# explicitly so it can't silently drift.
- name: Check formatting (deepnsm-v2)
run: cargo fmt --manifest-path crates/deepnsm-v2/Cargo.toml -- --check
# jc + sigker are workspace-excluded, so `cargo fmt --all` never reached
# them and nothing ever held them formatted. They had drifted to 214
# rustfmt diffs between them (plus thinking-engine); all three are
# brought to a clean baseline in this commit. The drift was NOT a
# toolchain artefact: rustfmt is 1.9.0 under both the pre-bump 1.95.0
# and the then-pinned 1.97.1 toolchain, and both report the identical 214,
# so there was no formatting-rule change to blame -- the code was simply
# never formatted. These steps are what keep it from recurring.
- name: Check formatting (jc)
run: cargo fmt --manifest-path crates/jc/Cargo.toml -- --check
- name: Check formatting (sigker)
run: cargo fmt --manifest-path crates/sigker/Cargo.toml -- --check
- name: Check formatting (thinking-engine)
run: cargo fmt --manifest-path crates/thinking-engine/Cargo.toml -- --check
# typos / spell-check removed 2026-04-26: too many false positives on
# technical jargon (NARS terms, codec acronyms, German loanwords used in
# the cognitive stack). Spelling discipline is a code-review concern,
# not a CI gate.