kibi-core 0.17.0 → 0.17.1
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 +33 -9
package/package.json
CHANGED
package/src/checks.pl
CHANGED
|
@@ -2766,7 +2766,7 @@ strict_req_fact_pairing_violation(violation(
|
|
|
2766
2766
|
strict_req_fact_pairing_issue(
|
|
2767
2767
|
ReqId,
|
|
2768
2768
|
Description,
|
|
2769
|
-
"Add a property_value fact via requires_property for the same subject_key"
|
|
2769
|
+
"Add a property_value fact via requires_property for the same subject_key, or link requires_predicate to a fact_kind: predicate fact whose first argument is that subject_key"
|
|
2770
2770
|
) :-
|
|
2771
2771
|
kb:current_req(ReqId),
|
|
2772
2772
|
kb_relationship(constrains, ReqId, SubjectFactId),
|
|
@@ -2786,9 +2786,10 @@ strict_req_fact_pairing_issue(
|
|
|
2786
2786
|
_ValidFrom,
|
|
2787
2787
|
_ValidTo
|
|
2788
2788
|
),
|
|
2789
|
+
\+ strict_req_predicate_grounds_subject(ReqId, SubjectKey),
|
|
2789
2790
|
format(
|
|
2790
2791
|
string(Description),
|
|
2791
|
-
"Requirement constrains ~w (~w) but has no matching strict requires_property fact",
|
|
2792
|
+
"Requirement constrains ~w (~w) but has no matching strict requires_property fact and no requires_predicate fact about that subject",
|
|
2792
2793
|
[SubjectFactId, SubjectKey]
|
|
2793
2794
|
).
|
|
2794
2795
|
|
|
@@ -2870,13 +2871,27 @@ strict_req_fact_pairing_fact_kind(FactId, Kind) :-
|
|
|
2870
2871
|
; Kind = legacy
|
|
2871
2872
|
).
|
|
2872
2873
|
|
|
2874
|
+
%% strict_req_predicate_grounds_subject(+ReqId, +SubjectKey)
|
|
2875
|
+
% A requirement that constrains a subject fact may ground its claim through
|
|
2876
|
+
% requires_predicate instead of requires_property (kb_model's replacementPlan
|
|
2877
|
+
% swaps one for the other). The predicate pairs with the subject when its
|
|
2878
|
+
% first argument is the subject_key, the argument position built-in and
|
|
2879
|
+
% project-local schemas use for the governed subject.
|
|
2880
|
+
% implements REQ-check-strict-pairing-predicate-grounding
|
|
2881
|
+
strict_req_predicate_grounds_subject(ReqId, SubjectKey) :-
|
|
2882
|
+
kb:effective_req_predicate(ReqId, _FactId, _Namespace, _Name, [First|_], _Polarity),
|
|
2883
|
+
First == SubjectKey,
|
|
2884
|
+
!.
|
|
2885
|
+
|
|
2873
2886
|
strict_req_fact_pairing_kind_label(legacy, "a legacy fact without fact_kind").
|
|
2874
2887
|
strict_req_fact_pairing_kind_label(Kind, Label) :-
|
|
2875
2888
|
format(string(Label), "a fact_kind=~w fact", [Kind]).
|
|
2876
2889
|
|
|
2877
2890
|
%% check_strict_readiness(-Violations)
|
|
2878
2891
|
% Reports current strict-readiness levels for requirements that are still not
|
|
2879
|
-
% contradiction-ready.
|
|
2892
|
+
% contradiction-ready. Each requirement has exactly one level: the first
|
|
2893
|
+
% strict_readiness_level/2 clause that holds, so the level is computed before
|
|
2894
|
+
% it is compared. Legacy and prose-only requirements remain audit-only and
|
|
2880
2895
|
% are intentionally not treated as contradictions.
|
|
2881
2896
|
check_strict_readiness(Violations) :-
|
|
2882
2897
|
findall(
|
|
@@ -2902,7 +2917,8 @@ strict_readiness_issue(
|
|
|
2902
2917
|
"Add a subject fact via constrains and a property_value fact via requires_property to model contradiction-safe semantics"
|
|
2903
2918
|
) :-
|
|
2904
2919
|
kb_entity(ReqId, req, _),
|
|
2905
|
-
strict_readiness_level(ReqId,
|
|
2920
|
+
strict_readiness_level(ReqId, Level),
|
|
2921
|
+
Level == prose_only.
|
|
2906
2922
|
|
|
2907
2923
|
strict_readiness_issue(
|
|
2908
2924
|
ReqId,
|
|
@@ -2910,19 +2926,21 @@ strict_readiness_issue(
|
|
|
2910
2926
|
"Replace prose or legacy fact links with a subject fact via constrains and a property_value fact via requires_property"
|
|
2911
2927
|
) :-
|
|
2912
2928
|
kb_entity(ReqId, req, _),
|
|
2913
|
-
strict_readiness_level(ReqId,
|
|
2929
|
+
strict_readiness_level(ReqId, Level),
|
|
2930
|
+
Level == traceable.
|
|
2914
2931
|
|
|
2915
2932
|
strict_readiness_issue(
|
|
2916
2933
|
ReqId,
|
|
2917
2934
|
Description,
|
|
2918
|
-
"Add a matching property_value fact via requires_property for the same subject_key"
|
|
2935
|
+
"Add a matching property_value fact via requires_property for the same subject_key, or link requires_predicate to a predicate fact whose first argument is that subject_key"
|
|
2919
2936
|
) :-
|
|
2920
2937
|
kb_entity(ReqId, req, _),
|
|
2921
|
-
strict_readiness_level(ReqId,
|
|
2938
|
+
strict_readiness_level(ReqId, Level),
|
|
2939
|
+
Level == has_subject,
|
|
2922
2940
|
strict_readiness_primary_subject(ReqId, SubjectFactId, SubjectKey),
|
|
2923
2941
|
format(
|
|
2924
2942
|
string(Description),
|
|
2925
|
-
"Strict readiness: not-ready (has-subject). Requirement constrains ~w (~w) but has no matching strict requires_property fact, so contradiction checks skip it.",
|
|
2943
|
+
"Strict readiness: not-ready (has-subject). Requirement constrains ~w (~w) but has no matching strict requires_property fact and no requires_predicate fact about that subject, so contradiction checks skip it.",
|
|
2926
2944
|
[SubjectFactId, SubjectKey]
|
|
2927
2945
|
).
|
|
2928
2946
|
|
|
@@ -2932,7 +2950,8 @@ strict_readiness_issue(
|
|
|
2932
2950
|
"Ensure constrains and requires_property use the same subject_key, and keep the requirement current if it should participate in contradiction checks"
|
|
2933
2951
|
) :-
|
|
2934
2952
|
kb_entity(ReqId, req, _),
|
|
2935
|
-
strict_readiness_level(ReqId,
|
|
2953
|
+
strict_readiness_level(ReqId, Level),
|
|
2954
|
+
Level == strict_ready.
|
|
2936
2955
|
|
|
2937
2956
|
strict_readiness_level(ReqId, contradiction_ready) :-
|
|
2938
2957
|
kb:current_req(ReqId),
|
|
@@ -2951,6 +2970,11 @@ strict_readiness_level(ReqId, contradiction_ready) :-
|
|
|
2951
2970
|
_ValidTo
|
|
2952
2971
|
),
|
|
2953
2972
|
!.
|
|
2973
|
+
strict_readiness_level(ReqId, contradiction_ready) :-
|
|
2974
|
+
kb:current_req(ReqId),
|
|
2975
|
+
strict_readiness_primary_subject(ReqId, _SubjectFactId, SubjectKey),
|
|
2976
|
+
strict_req_predicate_grounds_subject(ReqId, SubjectKey),
|
|
2977
|
+
!.
|
|
2954
2978
|
strict_readiness_level(ReqId, strict_ready) :-
|
|
2955
2979
|
strict_readiness_has_strict_subject(ReqId),
|
|
2956
2980
|
strict_readiness_has_strict_property(ReqId),
|