kibi-core 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/checks.pl +120 -3
package/package.json
CHANGED
package/src/checks.pl
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
check_domain_contradictions/1, % Returns list of contradiction violations
|
|
17
17
|
check_strict_fact_shape/1, % Returns list of malformed strict fact violations
|
|
18
18
|
check_strict_req_fact_pairing/1,% Returns list of malformed strict req/fact pairing violations
|
|
19
|
+
check_strict_readiness/1, % Returns list of strict readiness audit violations
|
|
19
20
|
run_checks_json/0, % Entry point for JSON output
|
|
20
21
|
violation_id_text/2 % Extract text from entity ID term (exported for testing)
|
|
21
22
|
]).
|
|
@@ -50,6 +51,7 @@ check_all(ViolationsDict) :-
|
|
|
50
51
|
check_domain_contradictions(Contradictions),
|
|
51
52
|
check_strict_fact_shape(StrictFactShape),
|
|
52
53
|
check_strict_req_fact_pairing(StrictReqFactPairing),
|
|
54
|
+
check_strict_readiness(StrictReadiness),
|
|
53
55
|
ViolationsDict = _{
|
|
54
56
|
must_priority_coverage: MustPriority,
|
|
55
57
|
symbol_coverage: SymbolCoverage,
|
|
@@ -60,7 +62,8 @@ check_all(ViolationsDict) :-
|
|
|
60
62
|
deprecated_adr_no_successor: DeprecatedADRs,
|
|
61
63
|
domain_contradictions: Contradictions,
|
|
62
64
|
strict_fact_shape: StrictFactShape,
|
|
63
|
-
strict_req_fact_pairing: StrictReqFactPairing
|
|
65
|
+
strict_req_fact_pairing: StrictReqFactPairing,
|
|
66
|
+
strict_readiness: StrictReadiness
|
|
64
67
|
}.
|
|
65
68
|
|
|
66
69
|
%% check_must_priority_coverage(-Violations)
|
|
@@ -445,7 +448,7 @@ check_domain_contradictions(Violations) :-
|
|
|
445
448
|
),
|
|
446
449
|
( contradicting_reqs(ReqA, ReqB, Reason),
|
|
447
450
|
format(string(EntityId), "~w/~w", [ReqA, ReqB]),
|
|
448
|
-
Description
|
|
451
|
+
format(string(Description), "~w [strict-readiness: contradiction-ready]", [Reason])
|
|
449
452
|
),
|
|
450
453
|
Violations
|
|
451
454
|
).
|
|
@@ -582,6 +585,118 @@ strict_req_fact_pairing_kind_label(legacy, "a legacy fact without fact_kind").
|
|
|
582
585
|
strict_req_fact_pairing_kind_label(Kind, Label) :-
|
|
583
586
|
format(string(Label), "a fact_kind=~w fact", [Kind]).
|
|
584
587
|
|
|
588
|
+
%% check_strict_readiness(-Violations)
|
|
589
|
+
% Reports current strict-readiness levels for requirements that are still not
|
|
590
|
+
% contradiction-ready. Legacy and prose-only requirements remain audit-only and
|
|
591
|
+
% are intentionally not treated as contradictions.
|
|
592
|
+
check_strict_readiness(Violations) :-
|
|
593
|
+
findall(
|
|
594
|
+
Violation,
|
|
595
|
+
strict_readiness_violation(Violation),
|
|
596
|
+
Violations0
|
|
597
|
+
),
|
|
598
|
+
sort(Violations0, Violations).
|
|
599
|
+
|
|
600
|
+
strict_readiness_violation(violation(
|
|
601
|
+
'strict-readiness',
|
|
602
|
+
ReqId,
|
|
603
|
+
Description,
|
|
604
|
+
Suggestion,
|
|
605
|
+
Source
|
|
606
|
+
)) :-
|
|
607
|
+
strict_readiness_issue(ReqId, Description, Suggestion),
|
|
608
|
+
violation_source(ReqId, req, Source).
|
|
609
|
+
|
|
610
|
+
strict_readiness_issue(
|
|
611
|
+
ReqId,
|
|
612
|
+
"Strict readiness: not-ready (prose-only). Requirement has no fact links, so contradiction checks skip it.",
|
|
613
|
+
"Add a subject fact via constrains and a property_value fact via requires_property to model contradiction-safe semantics"
|
|
614
|
+
) :-
|
|
615
|
+
kb_entity(ReqId, req, _),
|
|
616
|
+
strict_readiness_level(ReqId, prose_only).
|
|
617
|
+
|
|
618
|
+
strict_readiness_issue(
|
|
619
|
+
ReqId,
|
|
620
|
+
"Strict readiness: not-ready (traceable). Requirement is linked to facts only through legacy or non-strict links, so contradiction checks skip it.",
|
|
621
|
+
"Replace prose or legacy fact links with a subject fact via constrains and a property_value fact via requires_property"
|
|
622
|
+
) :-
|
|
623
|
+
kb_entity(ReqId, req, _),
|
|
624
|
+
strict_readiness_level(ReqId, traceable).
|
|
625
|
+
|
|
626
|
+
strict_readiness_issue(
|
|
627
|
+
ReqId,
|
|
628
|
+
Description,
|
|
629
|
+
"Add a matching property_value fact via requires_property for the same subject_key"
|
|
630
|
+
) :-
|
|
631
|
+
kb_entity(ReqId, req, _),
|
|
632
|
+
strict_readiness_level(ReqId, has_subject),
|
|
633
|
+
strict_readiness_primary_subject(ReqId, SubjectFactId, SubjectKey),
|
|
634
|
+
format(
|
|
635
|
+
string(Description),
|
|
636
|
+
"Strict readiness: not-ready (has-subject). Requirement constrains ~w (~w) but has no matching strict requires_property fact, so contradiction checks skip it.",
|
|
637
|
+
[SubjectFactId, SubjectKey]
|
|
638
|
+
).
|
|
639
|
+
|
|
640
|
+
strict_readiness_issue(
|
|
641
|
+
ReqId,
|
|
642
|
+
"Strict readiness: not-ready (strict-ready). Requirement has strict subject and property facts but no contradiction-ready matched pair, so contradiction checks still skip it.",
|
|
643
|
+
"Align constrains and requires_property on the same subject_key, and keep the requirement current if it should participate in contradiction checks"
|
|
644
|
+
) :-
|
|
645
|
+
kb_entity(ReqId, req, _),
|
|
646
|
+
strict_readiness_level(ReqId, strict_ready).
|
|
647
|
+
|
|
648
|
+
strict_readiness_level(ReqId, contradiction_ready) :-
|
|
649
|
+
kb:current_req(ReqId),
|
|
650
|
+
kb:effective_req_property_fact(
|
|
651
|
+
ReqId,
|
|
652
|
+
_SubjectKey,
|
|
653
|
+
_FactId,
|
|
654
|
+
_PropertyKey,
|
|
655
|
+
_Operator,
|
|
656
|
+
_ValueType,
|
|
657
|
+
_Value,
|
|
658
|
+
_Unit,
|
|
659
|
+
_Scope,
|
|
660
|
+
_Polarity,
|
|
661
|
+
_ValidFrom,
|
|
662
|
+
_ValidTo
|
|
663
|
+
),
|
|
664
|
+
!.
|
|
665
|
+
strict_readiness_level(ReqId, strict_ready) :-
|
|
666
|
+
strict_readiness_has_strict_subject(ReqId),
|
|
667
|
+
strict_readiness_has_strict_property(ReqId),
|
|
668
|
+
!.
|
|
669
|
+
strict_readiness_level(ReqId, has_subject) :-
|
|
670
|
+
strict_readiness_has_strict_subject(ReqId),
|
|
671
|
+
!.
|
|
672
|
+
strict_readiness_level(ReqId, traceable) :-
|
|
673
|
+
strict_readiness_has_fact_link(ReqId),
|
|
674
|
+
!.
|
|
675
|
+
strict_readiness_level(_ReqId, prose_only).
|
|
676
|
+
|
|
677
|
+
strict_readiness_has_fact_link(ReqId) :-
|
|
678
|
+
kb_relationship(constrains, ReqId, FactId),
|
|
679
|
+
kb_entity(FactId, fact, _),
|
|
680
|
+
!.
|
|
681
|
+
strict_readiness_has_fact_link(ReqId) :-
|
|
682
|
+
kb_relationship(requires_property, ReqId, FactId),
|
|
683
|
+
kb_entity(FactId, fact, _),
|
|
684
|
+
!.
|
|
685
|
+
|
|
686
|
+
strict_readiness_has_strict_subject(ReqId) :-
|
|
687
|
+
strict_readiness_primary_subject(ReqId, _FactId, _SubjectKey),
|
|
688
|
+
!.
|
|
689
|
+
|
|
690
|
+
strict_readiness_primary_subject(ReqId, FactId, SubjectKey) :-
|
|
691
|
+
kb_relationship(constrains, ReqId, FactId),
|
|
692
|
+
strict_req_fact_pairing_fact_kind(FactId, subject),
|
|
693
|
+
kb:fact_subject_key(FactId, SubjectKey).
|
|
694
|
+
|
|
695
|
+
strict_readiness_has_strict_property(ReqId) :-
|
|
696
|
+
kb_relationship(requires_property, ReqId, FactId),
|
|
697
|
+
strict_req_fact_pairing_fact_kind(FactId, property_value),
|
|
698
|
+
!.
|
|
699
|
+
|
|
585
700
|
%% run_checks_json
|
|
586
701
|
% Entry point for JSON output. Prints all violations as JSON to stdout.
|
|
587
702
|
run_checks_json :-
|
|
@@ -630,6 +745,7 @@ check_all_with_options(ViolationsDict, RequireAdr) :-
|
|
|
630
745
|
check_domain_contradictions(Contradictions),
|
|
631
746
|
check_strict_fact_shape(StrictFactShape),
|
|
632
747
|
check_strict_req_fact_pairing(StrictReqFactPairing),
|
|
748
|
+
check_strict_readiness(StrictReadiness),
|
|
633
749
|
ViolationsDict = _{
|
|
634
750
|
must_priority_coverage: MustPriority,
|
|
635
751
|
symbol_coverage: SymbolCoverage,
|
|
@@ -640,7 +756,8 @@ check_all_with_options(ViolationsDict, RequireAdr) :-
|
|
|
640
756
|
deprecated_adr_no_successor: DeprecatedADRs,
|
|
641
757
|
domain_contradictions: Contradictions,
|
|
642
758
|
strict_fact_shape: StrictFactShape,
|
|
643
|
-
strict_req_fact_pairing: StrictReqFactPairing
|
|
759
|
+
strict_req_fact_pairing: StrictReqFactPairing,
|
|
760
|
+
strict_readiness: StrictReadiness
|
|
644
761
|
}.
|
|
645
762
|
|
|
646
763
|
%% violations_dict_to_json(+ViolationsDict, -JsonDict)
|