@christang/keel 5.7.0 → 5.14.0

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.
@@ -6,6 +6,7 @@ const path = require("path");
6
6
 
7
7
  const {
8
8
  CONFIG_RELATIVE_PATH,
9
+ readDelegationPolicy,
9
10
  readStandingAuthorization,
10
11
  } = require("./config");
11
12
 
@@ -866,6 +867,24 @@ function compileTaskContract(repo, change, task) {
866
867
  if (!autonomy.some((item) => /^Pre-authorized fallback:/i.test(item))) {
867
868
  autonomy.push("Pre-authorized fallback: none");
868
869
  }
870
+ // Who runs this task, resolved exactly as the autonomy boundary above is: the
871
+ // task keeps whatever it authored, the repository declaration supplies only
872
+ // what the task left silent, and the entry names its source. A declaration
873
+ // that could overwrite an authored tier would make the capsule unreadable on
874
+ // its own — you could not tell what this task decided from what the file did.
875
+ const authoredTier = normalizeText(field(task, "Delegation")).toLowerCase();
876
+ let delegation = { tier: null, source: null };
877
+ if (authoredTier) {
878
+ delegation = { tier: authoredTier, source: "task" };
879
+ } else {
880
+ const { tier } = readDelegationPolicy(repo);
881
+ if (tier) {
882
+ delegation = {
883
+ tier,
884
+ source: CONFIG_RELATIVE_PATH.split(path.sep).join("/"),
885
+ };
886
+ }
887
+ }
869
888
  // A question is unresolved authority when it is the subject of its Covers
870
889
  // entry. Scanning the whole field also matched a resolved question named as
871
890
  // supporting detail beside the fact that closed it, and the only fix
@@ -940,7 +959,18 @@ function compileTaskContract(repo, change, task) {
940
959
  couplingMode === "required" ? candidateBoundary : [],
941
960
  designContract: coupledContract,
942
961
  },
962
+ // A helper and a delegate are different roles. A helper is never a second
963
+ // writer and this stays true whatever the repository declares; delegation
964
+ // is a separate entry beside it, never a helper with the guard removed.
943
965
  helperAuthority: "read-only-evidence-only",
966
+ // Present only when a tier actually resolved. An unconditional field would
967
+ // change the compiled capsule for every task everywhere, moving every
968
+ // recorded anchor and drifting every live change in every consumer repo on
969
+ // upgrade — for repositories that declared nothing and asked for nothing.
970
+ // Omission keeps this release's invariant: no behavior change without a
971
+ // declaration. A repository that does declare gets a different capsule,
972
+ // which is honest, because its execution genuinely differs.
973
+ ...(delegation.tier ? { delegation } : {}),
944
974
  prohibitions: [
945
975
  "must not change Acceptance",
946
976
  // repo-action is the one mode whose authorized effect is the repository