Files
JRay-public-server/scripts/traceability-gate.sh
T
dtourolleandClaude Opus 5 a1e789a6fe
CI / fmt, clippy, test (push) Failing after 1m21s
CI / static musl binary (push) Has been skipped
CI / advisories and licences (push) Successful in 24s
Traceability: vendor the shared gate, annotate the source
Adds jray-project as a submodule at scripts/vendor/jray-project, so this repo
runs the same extractor as every other component rather than its own copy, and
gains the system spec that defines the PR/SR requirements its register traces
up to.

scripts/traceability-gate.sh is a thin wrapper holding only what is specific to
this repo: UR/DR prefixes, .rs sources, and REPO_ROOT — which the shared gate
cannot infer once vendored, since its default resolves to the submodule itself.
Each override fails silently in a way that looks like "no work done" rather
than "misconfigured", so the wrapper documents why each is needed.

Annotates 35 units with TRACES tags, on the code that decides rather than every
helper it calls. Coverage is 23/32 (71.9%) with no orphan tags. The nine
untraced are genuinely unimplemented: UR-007 is plugin-side, UR-008 is
federation, and UR-015..018 are the pending SR-003 schema bump.

The gate caught a real error in the first pass: several tags separated IDs of
different types with commas. A comma joins IDs within one type; a pipe
separates types. Fixed, and the diagnostics are now clean.

MIN_COVERAGE stays 0 deliberately. The gate still fails on orphan tags, a >100%
ratio, a register parsing to nothing, or an empty source scan — raise the
threshold as a ratchet once the remaining work lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 18:27:16 +02:00

59 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
#
# Requirement traceability gate for JRay-public-server.
#
# A thin wrapper over the shared implementation in the `jray-project` submodule.
# Everything repo-specific lives here; the tooling itself is identical across all
# three components, so a fix to the gate benefits every repo rather than one.
#
# scripts/traceability-gate.sh
#
# The submodule must be checked out. If `scripts/vendor/jray-project` is empty:
#
# git submodule update --init --recursive
#
# Environment (passed through to the shared gate):
# MIN_COVERAGE minimum overall coverage percent
# ALLOW_ORPHANS set to 1 to report orphan tags without failing
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
REPO_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
VENDOR="$SCRIPT_DIR/vendor/jray-project"
if [ ! -f "$VENDOR/scripts/traceability/traceability-gate.sh" ]; then
echo "FAILED: the jray-project submodule is not checked out." >&2
echo " Run: git submodule update --init --recursive" >&2
exit 2
fi
# Why each override is needed, since omitting any of them fails silently in a
# way that looks like "no work done" rather than "misconfigured":
#
# REPO_ROOT the shared gate defaults to two levels above itself, which is
# inside the submodule once vendored.
# TYPES this repo's register uses UR/DR. The default is the extraction
# pipeline's AR/DP/IR/GR/VR, under which the register parses to
# ZERO requirements.
# SUFFIXES this repo is Rust. The default is C++/Python, under which the
# source tree scans to ZERO files.
# SYSTEM_SPEC the PR/SR requirements live in the project home, which is the
# submodule itself — so it ships with the tool that reads it.
#
# MIN_COVERAGE stays 0 until the TRACES annotation pass lands. That does not
# make the gate toothless: orphan tags, a >100% ratio, a register parsing to
# nothing and an empty source scan are all hard failures from day one. Raise it
# as tags land, and treat every raise as a ratchet.
REPO_ROOT="$REPO_ROOT" \
REQUIREMENTS="$REPO_ROOT/docs/requirements.md" \
SYSTEM_SPEC="$VENDOR/SPEC.md" \
TYPES="UR,DR" \
SUFFIXES=".rs" \
SCAN_ROOTS="src,tests" \
MIN_COVERAGE="${MIN_COVERAGE:-0}" \
ALLOW_ORPHANS="${ALLOW_ORPHANS:-0}" \
TRACES_JSON="${TRACES_JSON:-$REPO_ROOT/traces-report.json}" \
TRACES_MD="${TRACES_MD:-$REPO_ROOT/docs/traceability.md}" \
exec sh "$VENDOR/scripts/traceability/traceability-gate.sh"