kibi-core 0.21.0 → 0.21.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/schema/entities.pl +6 -0
- package/src/discovery.pl +7 -5
- package/src/kb.pl +9 -0
- package/src/rule_registry.pl +16 -0
package/package.json
CHANGED
package/schema/entities.pl
CHANGED
|
@@ -51,6 +51,10 @@ entity_property(req, approval_ref, string).
|
|
|
51
51
|
entity_property(req, rationale, string).
|
|
52
52
|
% Claim keys of the exempted requirement an exception waives (all when absent).
|
|
53
53
|
entity_property(req, exempts_claims, list).
|
|
54
|
+
% How firmly a requirement or ADR was decided: firm, default or exploratory.
|
|
55
|
+
% Absent reads as default.
|
|
56
|
+
entity_property(req, firmness, atom).
|
|
57
|
+
entity_property(adr, firmness, atom).
|
|
54
58
|
% Intended outcome of a scenario: success, rejection or error.
|
|
55
59
|
entity_property(scenario, expects, atom).
|
|
56
60
|
|
|
@@ -143,6 +147,8 @@ optional_property(req, approved_by).
|
|
|
143
147
|
optional_property(req, approval_ref).
|
|
144
148
|
optional_property(req, rationale).
|
|
145
149
|
optional_property(req, exempts_claims).
|
|
150
|
+
optional_property(req, firmness).
|
|
151
|
+
optional_property(adr, firmness).
|
|
146
152
|
optional_property(test, verification_scope).
|
|
147
153
|
optional_property(test, verification_perspective).
|
|
148
154
|
optional_property(test, proof_contract).
|
package/src/discovery.pl
CHANGED
|
@@ -708,14 +708,18 @@ ask_schema_dict(Namespace, Name, SchemaDict, ArgumentNames) :-
|
|
|
708
708
|
ArgumentNames = SchemaDict.argumentNames.
|
|
709
709
|
ask_schema_dict(_Namespace, _Name, null, none).
|
|
710
710
|
|
|
711
|
+
% A built-in row carries the catalog id that kb_model accepts as schemaId;
|
|
712
|
+
% `stored: false` says no entity with that id exists, so it is not a
|
|
713
|
+
% kb_query id.
|
|
711
714
|
ask_builtin_schema_row(Namespace, Name, Arity, KeyPositions, DecisionPosition, Row) :-
|
|
712
|
-
|
|
715
|
+
kb:builtin_predicate_signature(Name, SchemaId, Names),
|
|
713
716
|
findall(Key, (member(P, KeyPositions), nth1(P, Names, Key)), KeyArguments),
|
|
714
717
|
nth1(DecisionPosition, Names, DecisionArgument),
|
|
715
718
|
aggregate_all(count, kb:predicate_fact(_, Namespace, Name, _, _), FactCount),
|
|
716
719
|
Row = _{
|
|
717
|
-
id:
|
|
720
|
+
id: SchemaId,
|
|
718
721
|
builtin: true,
|
|
722
|
+
stored: false,
|
|
719
723
|
namespace: Namespace,
|
|
720
724
|
name: Name,
|
|
721
725
|
arity: Arity,
|
|
@@ -728,9 +732,6 @@ ask_builtin_schema_row(Namespace, Name, Arity, KeyPositions, DecisionPosition, R
|
|
|
728
732
|
factCount: FactCount
|
|
729
733
|
}.
|
|
730
734
|
|
|
731
|
-
% Keep in step with builtin_decision_predicate/5 in kb.pl.
|
|
732
|
-
builtin_argument_names(permission_rule, [actor, action, resource, decision]).
|
|
733
|
-
|
|
734
735
|
ask_schema_row(SchemaId, Namespace, Name, Arity, ArgumentNames, ArgumentTypes, Row) :-
|
|
735
736
|
kb_entity(SchemaId, fact, Props),
|
|
736
737
|
( memberchk(key_arguments=KeysRaw, Props)
|
|
@@ -755,6 +756,7 @@ ask_schema_row(SchemaId, Namespace, Name, Arity, ArgumentNames, ArgumentTypes, R
|
|
|
755
756
|
Row = _{
|
|
756
757
|
id: SchemaId,
|
|
757
758
|
builtin: false,
|
|
759
|
+
stored: true,
|
|
758
760
|
namespace: Namespace,
|
|
759
761
|
name: Name,
|
|
760
762
|
arity: Arity,
|
package/src/kb.pl
CHANGED
|
@@ -2845,6 +2845,15 @@ bind_key_arguments([Position|Positions], ArgsA, ArgsB) :-
|
|
|
2845
2845
|
% predicate-catalog-4.ts (permission_rule: actor, action, resource).
|
|
2846
2846
|
builtin_decision_predicate(default, permission_rule, 4, [1, 2, 3], 4).
|
|
2847
2847
|
|
|
2848
|
+
%% builtin_predicate_signature(?Name, ?SchemaId, ?ArgumentNames)
|
|
2849
|
+
% implements REQ-kibi-query-fact-filters
|
|
2850
|
+
% The catalog id and argument names of a built-in decision predicate. The
|
|
2851
|
+
% id is the one kb_model accepts as schemaId; no entity with that id is
|
|
2852
|
+
% stored, so a kb_query by id finds nothing. Keep in step with
|
|
2853
|
+
% builtin_decision_predicate/5 and the catalog entry in
|
|
2854
|
+
% packages/cli/src/operations/modeling/predicate-catalog-4.ts.
|
|
2855
|
+
builtin_predicate_signature(permission_rule, 'FACT-SCHEMA-PERMISSION-RULE', [actor, action, resource, decision]).
|
|
2856
|
+
|
|
2848
2857
|
%% effective_decision(+Decision, +Polarity, -Effect)
|
|
2849
2858
|
effective_decision(allow, assert, allow).
|
|
2850
2859
|
effective_decision(allow, deny, deny).
|
package/src/rule_registry.pl
CHANGED
|
@@ -59,6 +59,10 @@ known_rule('adr-proposed').
|
|
|
59
59
|
known_rule('predicate-schema-conformance').
|
|
60
60
|
known_rule('entity-context-missing').
|
|
61
61
|
known_rule('entity-context-acknowledged').
|
|
62
|
+
known_rule('decision-firm-unreferenced').
|
|
63
|
+
known_rule('decision-firm-superseded').
|
|
64
|
+
known_rule('supersedes-reason-missing').
|
|
65
|
+
known_rule('supersedes-reason-acknowledged').
|
|
62
66
|
known_rule('policy-ownership').
|
|
63
67
|
known_rule('policy-markers').
|
|
64
68
|
|
|
@@ -107,6 +111,10 @@ rule_enforcement_class('adr-proposed', advisory).
|
|
|
107
111
|
rule_enforcement_class('predicate-schema-conformance', advisory).
|
|
108
112
|
rule_enforcement_class('entity-context-missing', canonical).
|
|
109
113
|
rule_enforcement_class('entity-context-acknowledged', advisory).
|
|
114
|
+
rule_enforcement_class('decision-firm-unreferenced', canonical).
|
|
115
|
+
rule_enforcement_class('decision-firm-superseded', canonical).
|
|
116
|
+
rule_enforcement_class('supersedes-reason-missing', canonical).
|
|
117
|
+
rule_enforcement_class('supersedes-reason-acknowledged', advisory).
|
|
110
118
|
rule_enforcement_class('policy-ownership', canonical).
|
|
111
119
|
rule_enforcement_class('policy-markers', canonical).
|
|
112
120
|
|
|
@@ -155,6 +163,10 @@ rule_implementation('adr-proposed', prolog).
|
|
|
155
163
|
rule_implementation('predicate-schema-conformance', typescript).
|
|
156
164
|
rule_implementation('entity-context-missing', typescript).
|
|
157
165
|
rule_implementation('entity-context-acknowledged', typescript).
|
|
166
|
+
rule_implementation('decision-firm-unreferenced', typescript).
|
|
167
|
+
rule_implementation('decision-firm-superseded', typescript).
|
|
168
|
+
rule_implementation('supersedes-reason-missing', typescript).
|
|
169
|
+
rule_implementation('supersedes-reason-acknowledged', typescript).
|
|
158
170
|
rule_implementation('policy-ownership', typescript).
|
|
159
171
|
rule_implementation('policy-markers', typescript).
|
|
160
172
|
|
|
@@ -273,5 +285,9 @@ rule_description('adr-proposed', 'Informational: an ADR that is still proposed a
|
|
|
273
285
|
rule_description('predicate-schema-conformance', 'Predicate facts match a predicate_schema (project-local, or the built-in catalog in the default namespace) and use its declared argument constants').
|
|
274
286
|
rule_description('entity-context-missing', 'A current requirement, scenario, test, ADR or observation/meta fact must carry body context: at least 12 words of prose (requirements: under a Context, Rationale, Why, Background, Source, Notes or Evidence heading) that do not restate the title or semantic_text; entities tagged review:context-missing are acknowledged legacy and exempt').
|
|
275
287
|
rule_description('entity-context-acknowledged', 'Informational: how many current entities carry the review:context-missing tag, so the legacy context backlog stays visible; one summary finding per check').
|
|
288
|
+
rule_description('decision-firm-unreferenced', 'A requirement or ADR marked firmness: firm must name the human words it rests on: origin.ref (or approval_ref on a requirement); Kibi checks that the reference is present, not that it is genuine').
|
|
289
|
+
rule_description('decision-firm-superseded', 'A requirement or ADR that supersedes a firm decision, retired or not, must itself be firm (and so carry a ref to the human who changed the rule); a default or exploratory replacement cannot overrule a firm decision').
|
|
290
|
+
rule_description('supersedes-reason-missing', 'A current requirement or ADR that supersedes another must explain why under a \'Why this changed\' heading (at least 12 words of prose naming the evidence and answering the old decision\'s reasoning); supersede edges recorded before schema 9 are acknowledged in the manifest and exempt').
|
|
291
|
+
rule_description('supersedes-reason-acknowledged', 'Informational: how many current superseding requirements and ADRs have only supersede edges the schema 9 migration acknowledged without a \'Why this changed\' section; one summary finding per check').
|
|
276
292
|
rule_description('policy-ownership', 'When a plugin activated for kibi.check-policy.v1 declares ownership rules, every production symbol in a rule\'s file set must implement a current requirement grounded (requires_predicate) in one of the rule\'s predicates; projects without an activated check policy are unaffected').
|
|
277
293
|
rule_description('policy-markers', 'When a plugin activated for kibi.check-policy.v1 declares marker rules, every file implementing a requirement grounded in the rule\'s pattern predicate (with its declared sibling files) must contain each marker the KB declares for that pattern').
|