#!/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"