diff options
| author | rottedfm <rottedfm@proton.me> | 2026-08-19 11:21:47 -0400 |
|---|---|---|
| committer | rottedfm <rottedfm@proton.me> | 2026-08-19 11:21:47 -0400 |
| commit | ea0bd36167b684c0accdb5ce2b2e21b8d84aeb25 (patch) | |
| tree | be1267972b5de2f1ae592577dfabce67f1fe6e87 /scripts | |
| parent | 8c0b4c53b130555f040884c1f52b90f16b23e241 (diff) | |
feat: implement Helix-style modal buffer under DO-178C DAL-C
The repository was an unmodified ratatui component template: no editor
code, JSON5 config, and placeholder widgets. This establishes the first
working baseline — `moji <file>` opens a file into a ropey rope and edits
it with Helix selection-first semantics.
Requirements, implementation and tests land together because they must:
the traceability check rejects requirements with no implementation and
tests naming requirements that do not exist, so neither half is a valid
commit on its own.
Package renamed to mojibake-editor (mojibake was taken on crates.io);
binary is moji, library target stays mojibake.
Class: New behaviour
Requirements: MJB-HLR-001..019, MJB-LLR-001..205
Derived: MJB-DR-001..007 (DR-001 resolved, six open for review)
Verified: cargo build; clippy --all-targets -D warnings clean;
cargo test 294 passing; ./scripts/check-trace.sh 98/98/98;
cargo package clean
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-trace.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/scripts/check-trace.sh b/scripts/check-trace.sh new file mode 100755 index 0000000..bc026d4 --- /dev/null +++ b/scripts/check-trace.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +# +# Bidirectional traceability check (docs/process.md §5). +# +# Verifies HLR -> LLR -> source -> test in both directions: +# - every low-level requirement is implemented and tested +# - every requirement a test names actually exists +# +# The third check is the one that is easy to omit and that fails silently when +# omitted: it catches stale references left behind by a renumbered or withdrawn +# requirement. +# +# Exits non-zero if any check fails, so it can gate a commit or CI job. + +set -euo pipefail + +cd "$(dirname "$0")/.." + +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +grep -ohE 'MJB-LLR-[0-9]+' docs/requirements/llr.md | sort -u > "$tmp/defined" +grep -rohE 'MJB-LLR-[0-9]+' src/ | sort -u > "$tmp/tagged" +grep -rohE 'mjb_llr_[0-9]+' src/ tests/ \ + | sed 's/mjb_llr_/MJB-LLR-/' | sort -u > "$tmp/tested" + +defined=$(wc -l < "$tmp/defined") +tagged=$(wc -l < "$tmp/tagged") +tested=$(wc -l < "$tmp/tested") + +printf 'defined=%s tagged=%s tested=%s\n\n' "$defined" "$tagged" "$tested" + +status=0 + +report() { # $1=label $2=file $3=explanation + if [ -s "$2" ]; then + printf '%s:\n' "$1" + sed 's/^/ /' "$2" + printf ' -> %s\n\n' "$3" + status=1 + fi +} + +comm -23 "$tmp/defined" "$tmp/tagged" > "$tmp/untagged" +comm -23 "$tmp/defined" "$tmp/tested" > "$tmp/untested" +comm -13 "$tmp/defined" "$tmp/tested" > "$tmp/unknown" + +report "Requirements with no implementation" "$tmp/untagged" \ + "tag the implementing item with // MJB-LLR-nnn" +report "Requirements with no test" "$tmp/untested" \ + "add a test named mjb_llr_nnn_<description>" +report "Tests naming a requirement that does not exist" "$tmp/unknown" \ + "typo, or a stale reference to a withdrawn requirement" + +if [ "$status" -eq 0 ]; then + echo "OK: traceability complete in both directions." +fi + +exit "$status" |
