Skip to content

[rules score] refactor requirements model to use abstract base types#343

Open
AAmbuj wants to merge 1 commit into
eclipse-score:mainfrom
AAmbuj:amsh_refactor_score_requirements_measure_hierarchy
Open

[rules score] refactor requirements model to use abstract base types#343
AAmbuj wants to merge 1 commit into
eclipse-score:mainfrom
AAmbuj:amsh_refactor_score_requirements_measure_hierarchy

Conversation

@AAmbuj

@AAmbuj AAmbuj commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Replace inline union types with abstract base types in the TRLC requirements model for cleaner polymorphism and extensibility:

  • Add abstract CompReqSource; AssumedSystemReq/FeatReq extend it and CompReqSourceId.item references the base instead of [FeatReq, AssumedSystemReq].
  • Add abstract Measure; ControlMeasure/PreventiveMeasure/Mitigation extend it, replacing the tuple Measure union.
  • Root PreventiveMeasure and Mitigation in RequirementSafety (fixing Mitigation's incorrect AssumedSystemReq parent and PreventiveMeasure having no safety classification).
  • Drop mitigates from ControlMeasure (tracing is implicit via FTA name-matching); keep mitigates on AoU; give Mitigation an optional rationale.
  • Add mandatory safety/description/version to the SomePreventiveMeasure test fixture, which the new hierarchy now requires.

Why this change
The bump to TRLC 3.0.0 (commit 08d9163, tag v1.3.0) broke the SCORE requirements model build. TRLC 3.0.0 rejects the bracketed union-list syntax we used for tuple item fields:

item    [FeatReq, AssumedSystemReq]
        ^ error: expected identifier, encountered opening bracket '[' instead

A tuple item must be a single type identifier; the [A, B] "any of these" list is not valid TRLC. This caused a cascading failure (unknown symbol CompReqSourceId) and broke downstream targets, e.g.:

ERROR: lobster-trlc: TRLC processing failed: aborting due to TRLC error
Target //bazel/rules/rules_score/examples/seooc:safety_software_seooc_example_doc failed to build

@AAmbuj AAmbuj self-assigned this Jul 13, 2026
Replace inline union types with abstract base types in the TRLC
requirements model for cleaner polymorphism and extensibility:

- Add abstract CompReqSource; AssumedSystemReq/FeatReq extend it and
  CompReqSourceId.item references the base instead of
  [FeatReq, AssumedSystemReq].
- Add abstract Measure; ControlMeasure/PreventiveMeasure/Mitigation
  extend it, replacing the tuple Measure union.
- Root PreventiveMeasure and Mitigation in RequirementSafety (fixing
  Mitigation's incorrect AssumedSystemReq parent and PreventiveMeasure
  having no safety classification).
- Drop mitigates from ControlMeasure (tracing is implicit via FTA
  name-matching); keep mitigates on AoU; give Mitigation an optional
  rationale.
- Add mandatory safety/description/version to the SomePreventiveMeasure
  test fixture, which the new hierarchy now requires.
@AAmbuj AAmbuj force-pushed the amsh_refactor_score_requirements_measure_hierarchy branch from 6e58847 to 4323604 Compare July 14, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant