Skip to main content

Crate shallguard

Crate shallguard 

Source
Expand description

Requirement traceability, executable coverage, and review tooling for Rust.

Cross-checks numbered system requirements in selected USER_STORIES_AND_REQUIREMENTS.md documents against the code and test anchors in the source tree (#[shallguard::enforces] / #[shallguard::verifies] attributes and shallguard::enforces_here! branch anchors).

Hard errors (always fail):

  • a document fails to parse or yields fewer configured requirements;
  • duplicate requirement IDs across the documents;
  • a src/ or tests/ path cited anywhere in a document that does not exist (except repository-configured historical removals);
  • a requirement ID referenced in code that no document defines.

Ratcheted checks (warning only for exact committed baseline entries, otherwise a hard error; already-hard areas cannot be baselined):

  • a requirement whose Enforced: files carry no anchor of its ID;
  • a requirement with automated-test evidence ([test]) that no test anchor claims to verify;
  • automated evidence that does not resolve to its cited test.

The binary prints a per-area coverage report; the repo-wide check also runs as this crate’s integration test, which is the CI gate.

Modules§

baseline
Persistent exceptions for historical traceability gaps.
bundle
Deterministic review-capsule generation.
check
The cross-checks and the report.
config
Repository-owned ShallGuard configuration.
coverage
Per-verification-test LLVM coverage projected onto requirement enforcement scopes.
docs
Parsing of the USER_STORIES_AND_REQUIREMENTS.md documents.
evidence_mark
Evidence marks on the Verified: line of a requirement.
impact
Deterministic base/head requirement impact analysis.
requirement_format
Structural linting and deterministic formatting for requirement documents.
review
Isolated local-CLI execution of requirement review capsules.
review_workflow
One-command orchestration for impact, coverage, bundle, and local review.
scan
Scanning of Rust sources for requirement anchors.
test_index
Exact Cargo test identity resolution for verification anchors.

Macros§

enforces_here
Statement-position enforcement anchor: marks the surrounding branch, match arm, or statement sequence as an enforcement site of the listed requirements. Expands to nothing; the IDs are validated for form and uniqueness at compile time exactly like enforces.

Structs§

DocSpec
A requirements document and the source tree that unprefixed src/ and tests/ references inside it resolve to.

Enums§

ProgressEvent
A human-readable update from a long-running command.

Functions§

workspace_root
Discovers the Cargo workspace that contains the invocation directory.

Type Aliases§

ProgressCallback
Callback used by long-running commands for human-readable stderr progress.

Attribute Macros§

enforces
Marks an item as an enforcement site of the listed requirements.
verifies
Marks a test as verification evidence for the listed requirements.