Implemented Consistency checks for safety for trlc requirements - #414
Open
ishakulkarni1012 wants to merge 2 commits into
Open
Conversation
ishakulkarni1012
requested review from
LittleHuba,
castler,
hoe-jo,
limdor and
ramceb
as code owners
August 11, 2026 12:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: ASIL Non-Degradation Safety Checks for Requirements
Purpose
Add automated ASIL (Automotive Safety Integrity Level) non-degradation checks to the S-CORE requirements model. These checks enforce that when a requirement is derived from an upstream requirement, its ASIL safety level must be at least as high as the upstream — it must not be degraded. This is a fundamental safety rule: a derived requirement cannot weaken the safety guarantees of its upstream.
ASIL ordering enforced:
QM < B < DChanges Made
1.
bazel/rules/rules_score/trlc/config/score_requirements_model.rslAdded
FeatReqSourceIdtuple:FeatReq.derived_frompreviously usedAssumedSystemReqId(item type =AssumedSystemReq, a concrete type).upstream.item.safetyin a check block caused a semantic error.RequirementSafety(which directly declares thesafetyfield), so TRLC can resolve the field. At runtime, every instance is still anAssumedSystemReq.Changed
FeatReq.derived_from:Added
checks FeatReqblock:Added
checks CompReqblock:CompReq.derived_fromalready used a union type[FeatReq, AssumedSystemReq]— TRLC resolvessafetyvia their common ancestorRequirementSafety, so no tuple change was needed.derived_from == nullguard added becauseCompReq.derived_fromis optional.2.
bazel/rules/rules_score/trlc/config/test/trlc_check_test.bzl(new file)Custom Bazel macro that runs TRLC without
--verify. The standardtrlc_requirements_testrule always adds--verify, which triggers TRLC 3.0.0's CVC5/VCG static analysis. That analysis crashes with aKeyErrorwhen processingforallover union or abstract tuple item fields. Runtime check evaluation (what actually validates requirement instances) still works correctly without--verify.3.
bazel/rules/rules_score/trlc/config/BUILDtrlc_check_testmacro.score_requirements_model_testfromtrlc_requirements_testtotrlc_check_test— the existing model test was broken by the newly added checks because--verifycrashed.4.
bazel/rules/rules_score/trlc/config/test/BUILD(new file)Bazel targets for ASIL check test fixtures:
asil_check_valid_testasil_check_invalid_feat_testasil_check_invalid_comp_testInvalid tests are tagged
manualso they don't run in CI by default.5. TRLC Test Fixture Files (new files in
bazel/rules/rules_score/trlc/config/test/)valid_asr.trlcAssilCheckValidAssumedSystemReqinstances at QM / B / Dvalid_feat_req.trlcAssilCheckValidFeatReqinstances with maintained or raised ASILvalid_comp_req.trlcAssilCheckValidCompCompReqinstances with maintained or raised ASILinvalid_feat_req.trlcAssilCheckInvalidFeatFeatReqinstances with degraded ASIL (QM←B, B←D, QM←D)invalid_comp_req.trlcAssilCheckInvalidCompCompReqinstances with degraded ASILWhy
trlc_check_testinstead oftrlc_requirements_testTRLC 3.0.0 has a bug: the VCG (Verification Condition Generator) that runs with
--verifycrashes when statically analyzingforallexpressions over tuple items typed as union or abstract types. Since the checks require these patterns (for field resolution),--verifycannot be used. The custom macro skips VCG while still running all runtime checks against actual requirement instances.Test Results
score_requirements_model_testasil_check_valid_testasil_check_invalid_feat_testasil_check_invalid_comp_test