forgedock 1.55.1 → 1.57.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.
- package/bin/config-schema.mjs +1 -1
- package/bin/engine/outcome-codes.mjs +1 -0
- package/bin/engine/phases.mjs +4 -3
- package/bin/engine-cli.mjs +58 -10
- package/bin/forgedock.mjs +52 -3
- package/bin/gc.mjs +43 -6
- package/bin/help-text.mjs +3 -1
- package/bin/lean/batch-health.mjs +5 -1
- package/bin/lean/batch-health.test.mjs +7 -1
- package/bin/lean/batch.mjs +7 -2
- package/bin/lean/batch.test.mjs +45 -0
- package/bin/lean/conformance.e2e.test.mjs +3 -2
- package/bin/lean/conformance.mjs +88 -17
- package/bin/lean/conformance.test.mjs +98 -3
- package/bin/lean/decisions.mjs +86 -1
- package/bin/lean/decisions.test.mjs +21 -1
- package/bin/lean/depcache.mjs +124 -13
- package/bin/lean/depcache.test.mjs +121 -3
- package/bin/lean/design-gate.mjs +144 -0
- package/bin/lean/design-gate.test.mjs +169 -0
- package/bin/lean/effects-cap.test.mjs +17 -0
- package/bin/lean/effects.mjs +58 -13
- package/bin/lean/heavy.mjs +25 -8
- package/bin/lean/hostload.test.mjs +28 -0
- package/bin/lean/intake.mjs +97 -0
- package/bin/lean/intake.test.mjs +105 -0
- package/bin/lean/interfaces.mjs +181 -0
- package/bin/lean/interfaces.test.mjs +192 -0
- package/bin/lean/issuewatch-install.mjs +52 -12
- package/bin/lean/issuewatch-install.test.mjs +50 -0
- package/bin/lean/issuewatch-parity.mjs +12 -2
- package/bin/lean/issuewatch-parity.test.mjs +26 -0
- package/bin/lean/issuewatch-reconcile.mjs +29 -1
- package/bin/lean/issuewatch-reconcile.test.mjs +21 -0
- package/bin/lean/issuewatch.mjs +34 -3
- package/bin/lean/issuewatch.test.mjs +49 -1
- package/bin/lean/lanecheck.test.mjs +15 -4
- package/bin/lean/lean.mjs +80 -25
- package/bin/lean/lean.test.mjs +149 -3
- package/bin/lean/orchestrate-blocked.test.mjs +18 -2
- package/bin/lean/orchestrate-owned.test.mjs +14 -5
- package/bin/lean/orchestrate.mjs +26 -4
- package/bin/lean/orphan-pr.mjs +125 -0
- package/bin/lean/orphan-pr.test.mjs +145 -0
- package/bin/lean/pagegate.mjs +35 -12
- package/bin/lean/pagegate.test.mjs +39 -1
- package/bin/lean/preflight.mjs +35 -1
- package/bin/lean/preflight.test.mjs +27 -1
- package/bin/lean/prompts.mjs +2 -1
- package/bin/lean/reap.test.mjs +39 -0
- package/bin/lean/recovery.test.mjs +25 -0
- package/bin/lean/release-config.mjs +158 -0
- package/bin/lean/release-config.test.mjs +109 -0
- package/bin/lean/release-control.mjs +148 -0
- package/bin/lean/release-control.test.mjs +143 -0
- package/bin/lean/release-fence.mjs +50 -0
- package/bin/lean/release-fence.test.mjs +105 -0
- package/bin/lean/release-flakes.mjs +139 -0
- package/bin/lean/release-flakes.test.mjs +116 -0
- package/bin/lean/release-ledger.mjs +160 -0
- package/bin/lean/release-ledger.test.mjs +226 -0
- package/bin/lean/release-minutes.mjs +92 -0
- package/bin/lean/release-minutes.test.mjs +99 -0
- package/bin/lean/release-nightly.mjs +75 -0
- package/bin/lean/release-nightly.test.mjs +48 -0
- package/bin/lean/release-postmerge.mjs +45 -21
- package/bin/lean/release-review.e2e.test.mjs +1 -0
- package/bin/lean/release-review.mjs +54 -7
- package/bin/lean/release-review.test.mjs +76 -7
- package/bin/lean/release-unitmap.mjs +35 -0
- package/bin/lean/release-unitmap.test.mjs +41 -0
- package/bin/lean/release.mjs +177 -19
- package/bin/lean/release.test.mjs +80 -16
- package/bin/lean/render.mjs +3 -1
- package/bin/lean/run-issue-placement.test.mjs +82 -0
- package/bin/lean/sandbox-remote.mjs +16 -0
- package/bin/lean/schedd.mjs +1 -1
- package/bin/lean/seam.mjs +115 -0
- package/bin/lean/seam.test.mjs +118 -0
- package/bin/lean/selftest-journey.mjs +40 -2
- package/bin/lean/selftest-journey.test.mjs +43 -3
- package/bin/lean/statuscomment.mjs +168 -0
- package/bin/lean/statuscomment.test.mjs +133 -0
- package/bin/lean/ui-quality.mjs +57 -0
- package/bin/lean/ui-quality.test.mjs +55 -0
- package/bin/lean/visual-gate.test.mjs +63 -0
- package/bin/pool/agent.mjs +16 -2
- package/bin/pool/router.mjs +5 -1
- package/bin/review-staging.mjs +8 -5
- package/bin/stats/card.mjs +117 -0
- package/bin/stats/card.test.mjs +109 -0
- package/bin/stats/conformance-outcomes.test.mjs +2 -1
- package/bin/stats/depth.mjs +1 -1
- package/bin/stats/gh-retry.test.mjs +152 -0
- package/bin/stats/github-source.mjs +147 -14
- package/bin/stats/index.mjs +35 -2
- package/bin/stats/stats.test.mjs +31 -3
- package/bin/vendor/js-yaml/LICENSE +21 -0
- package/bin/vendor/js-yaml/PIN.md +7 -0
- package/bin/vendor/js-yaml/js-yaml.mjs +3851 -0
- package/commands/design-render-critique-loop.md +2 -0
- package/commands/design.md +2 -0
- package/commands/incident-response.md +4 -0
- package/commands/issue.md +1 -1
- package/commands/milestone.md +1 -1
- package/commands/pipeline-status.md +13 -0
- package/commands/review-pr-agents/frontend.md +1 -0
- package/commands/review-pr-staging.md +5 -0
- package/docs/CONFIG.md +75 -1
- package/docs/ISSUE-WATCH.md +7 -0
- package/docs/OUTCOME-CODES.md +1 -0
- package/docs/STATS.md +10 -0
- package/docs/design/visual-gate.md +25 -0
- package/docs/eval/adversarial-bench.md +2 -2
- package/docs/eval/corpus/adversarial-v1.json +3 -3
- package/docs/site/start-a-new-project.md +7 -0
- package/docs/spec/forge-protocol-v1.md +31 -0
- package/package.json +1 -1
- package/pool/README.md +2 -0
- package/scripts/acceptance-red-green.sh +15 -1
- package/scripts/acceptance-red-green.test.sh +12 -0
- package/scripts/bench-adversarial.mjs +4 -0
- package/scripts/bench-lightlane.mjs +4 -1
- package/scripts/bootstrap-create.mjs +8 -2
- package/scripts/ci-local.test.sh +3 -3
- package/scripts/fixtures/ci-local/gha-dorny/.github/workflows/ci.yml +4 -0
- package/scripts/plan-validate-live.mjs +9 -6
- package/scripts/review-prepare.sh +7 -1
- package/scripts/review-roster.sh +5 -2
- package/scripts/review-roster.test.sh +9 -0
- package/scripts/visual-gate.mjs +64 -0
- package/templates/bootstrap/technical-spike.md +17 -0
- package/templates/contracts/seam-check.mjs +236 -0
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
/**
|
|
4
4
|
* Post-merge step of `forgedock release` (#5213, part 3 of #5208): confirm or dispatch the publish run for the merge commit,
|
|
5
|
-
* wait for the published artifact (`release.artifact_check`), then open and merge the version-sync PR (`release.version_sync`).
|
|
5
|
+
* wait for the published artifact (`release.artifact_check`), then open and auto-merge the version-sync PR (`release.version_sync`).
|
|
6
6
|
* Every wait is bounded (`ctx.config.postMerge` overrides the bounds) and ends in `{blocked}`, never a throw, so a resume
|
|
7
7
|
* retries the step; each sub-step is idempotent (an existing run, PR or merged PR is reused). Rationale:
|
|
8
8
|
* devdocs/decisions/5208-release-postmerge.md.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { cleanupSnapshot } from "./release-snapshot.mjs";
|
|
12
|
+
import { fenced } from "./release-fence.mjs";
|
|
13
|
+
import { buildDispatchArgs } from "./release-control.mjs";
|
|
12
14
|
|
|
13
15
|
const BOUNDS = {
|
|
14
16
|
publishPolls: 6, publishPollMs: 10_000, // wait for a run to appear (bot merges never trigger one)
|
|
15
17
|
runPolls: 90, runPollMs: 20_000, // wait for the run to finish
|
|
16
18
|
artifactTries: 8, artifactBaseMs: 5_000, artifactMaxMs: 120_000, // npm propagation: exponential backoff
|
|
17
19
|
branchPolls: 6, branchPollMs: 10_000, // wait for the sync branch to be pushed
|
|
18
|
-
|
|
20
|
+
autoPolls: 30, autoPollMs: 20_000, // wait for the sync PR's auto-merge
|
|
19
21
|
};
|
|
20
22
|
const json = (s) => JSON.parse(String(s || "null"));
|
|
21
23
|
const blocked = (reason) => ({ blocked: true, reason });
|
|
@@ -43,7 +45,8 @@ async function publishRun(ctx, sha, b) {
|
|
|
43
45
|
let run = await poll(io, b.publishPolls, b.publishPollMs, look);
|
|
44
46
|
let dispatched = false;
|
|
45
47
|
if (!run) {
|
|
46
|
-
await
|
|
48
|
+
const f = await fenced(ctx.fence, { action: "dispatch", key: `dispatch:${sha}` }, (epoch) => io.gh(buildDispatchArgs({ workflow, repo, ref: ctx.def, inputs: epoch != null ? { forge_epoch: epoch } : {} })));
|
|
49
|
+
if (f.refused) return { err: `dispatch ${f.refused}` };
|
|
47
50
|
dispatched = true;
|
|
48
51
|
run = await poll(io, b.publishPolls, b.publishPollMs, look);
|
|
49
52
|
if (!run) return { err: `no ${workflow} run for ${sha.slice(0, 8)} after a dispatch on ${ctx.def}; check the Actions tab, then resume` };
|
|
@@ -64,35 +67,55 @@ async function artifact(ctx, b) {
|
|
|
64
67
|
return { err: `release.artifact_check still failing after ${b.artifactTries} tries: ${config.artifactCheck}` };
|
|
65
68
|
}
|
|
66
69
|
|
|
70
|
+
const b64 = (s) => Buffer.from(String(s).replace(/\s/g, ""), "base64").toString("utf8");
|
|
71
|
+
const semverLt = (a, b) => { const x = String(a).split(/[.-]/).map(Number), y = String(b).split(/[.-]/).map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0); return false; };
|
|
72
|
+
const VERSION_FILES = ["package.json", ".claude-plugin/plugin.json"];
|
|
73
|
+
|
|
74
|
+
/** The sync branch is missing (publish.yml failed before pushing): cut it from the staging head with a version-only commit, through the gh API. */
|
|
75
|
+
async function createSyncBranch({ io, repo, staging }, branch, version) {
|
|
76
|
+
const base = String(await io.gh(["api", `repos/${repo}/git/ref/heads/${staging}`, "--jq", ".object.sha"])).trim();
|
|
77
|
+
await io.gh(["api", "-X", "POST", `repos/${repo}/git/refs`, "-f", `ref=refs/heads/${branch}`, "-f", `sha=${base}`]);
|
|
78
|
+
for (const f of VERSION_FILES) {
|
|
79
|
+
let cur;
|
|
80
|
+
try { cur = json(await io.gh(["api", `repos/${repo}/contents/${f}?ref=${staging}`])); } catch { if (f === "package.json") throw new Error(`${f} unreadable on ${staging}`); continue; }
|
|
81
|
+
const doc = JSON.parse(b64(cur.content));
|
|
82
|
+
doc.version = version;
|
|
83
|
+
await io.gh(["api", "-X", "PUT", `repos/${repo}/contents/${f}`, "-f", `message=chore: sync version ${version} to ${staging}`, "-f", `content=${Buffer.from(JSON.stringify(doc, null, 2) + "\n").toString("base64")}`, "-f", `sha=${cur.sha}`, "-f", `branch=${branch}`]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The release PR's version goes back to staging (#5513): publish.yml cannot open the PR (enterprise policy), so the host does, then enables auto-merge. */
|
|
67
88
|
async function versionSync(ctx, sha, b) {
|
|
68
89
|
const { io, repo, staging } = ctx;
|
|
69
|
-
const
|
|
70
|
-
const
|
|
90
|
+
const read = async (ref) => JSON.parse(b64(await io.gh(["api", `repos/${repo}/contents/package.json?ref=${ref}`, "--jq", ".content"]))).version;
|
|
91
|
+
const version = await read(sha);
|
|
92
|
+
const cur = await read(staging);
|
|
93
|
+
if (!semverLt(cur, version)) return { skipped: true, version, staging: cur };
|
|
94
|
+
const branch = `chore/sync-version-${version}`;
|
|
71
95
|
const find = async () => json(await io.gh(["pr", "list", "--repo", repo, "--base", staging, "--head", branch, "--state", "all", "--json", "number,state", "--limit", "1"]))?.[0] ?? null;
|
|
72
96
|
let pr = await find();
|
|
73
97
|
if (pr?.state === "MERGED") return { pr: pr.number, merged: true, reused: true };
|
|
74
98
|
if (!pr) {
|
|
75
99
|
const has = await poll(io, b.branchPolls, b.branchPollMs, async () => { try { await io.gh(["api", `repos/${repo}/branches/${branch}`, "--jq", ".name"]); return true; } catch { return false; } });
|
|
76
|
-
if (!has)
|
|
77
|
-
|
|
100
|
+
if (!has) {
|
|
101
|
+
try { await createSyncBranch(ctx, branch, version); } catch (e) { return { err: `version-sync branch ${branch} is missing and could not be created (${String(e.message).split("\n")[0]}); open it by hand` }; }
|
|
102
|
+
}
|
|
103
|
+
const url = String(await io.gh(["pr", "create", "--repo", repo, "--base", staging, "--head", branch, "--title", `chore: sync version ${version} to ${staging}`, "--body", `Version-only sync of the ${version} release back to ${staging} (forgedock release).\n\ndocs-not-needed: version-only sync, no behaviour change`])).trim();
|
|
78
104
|
const n = Number(/\/pull\/(\d+)/.exec(url)?.[1]);
|
|
79
105
|
if (!Number.isSafeInteger(n)) return { err: `gh pr create returned no PR url: ${url}` };
|
|
80
106
|
pr = { number: n };
|
|
81
107
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
const warn = (why) => ({ pr: pr.number, merged: false, warning: `version-sync PR #${pr.number} ${why}; merge it by hand so ${staging} reaches ${version}` });
|
|
109
|
+
try {
|
|
110
|
+
const f = await fenced(ctx.fence, { action: "merge", key: `sync-merge:${pr.number}` }, () => io.gh(["pr", "merge", String(pr.number), "--repo", repo, "--merge", "--auto"]));
|
|
111
|
+
if (f.refused) return { err: `version-sync merge ${f.refused}` };
|
|
112
|
+
} catch (e) { return warn(`could not enable auto-merge (${String(e.message).split("\n")[0]})`); }
|
|
113
|
+
const end = await poll(io, b.autoPolls, b.autoPollMs, async () => {
|
|
114
|
+
const st = json(await io.gh(["pr", "view", String(pr.number), "--repo", repo, "--json", "state"]))?.state;
|
|
115
|
+
return st === "MERGED" || st === "CLOSED" ? st : null;
|
|
89
116
|
});
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
// GITHUB_TOKEN PRs get no CI, so "no checks" is a stop, not a green light.
|
|
93
|
-
if (!green) return { err: `version-sync PR #${pr.number} has no passing checks yet (a PR opened by GITHUB_TOKEN gets no CI: close and reopen it); resume once green` };
|
|
94
|
-
await io.gh(["pr", "merge", String(pr.number), "--repo", repo, "--merge", "--match-head-commit", green.head]);
|
|
95
|
-
return { pr: pr.number, merged: true };
|
|
117
|
+
if (end === "MERGED") return { pr: pr.number, merged: true };
|
|
118
|
+
return warn(end === "CLOSED" ? "was closed without merging" : "did not merge in time (auto-merge is enabled)");
|
|
96
119
|
}
|
|
97
120
|
|
|
98
121
|
/** @returns {Promise<{published, run, artifact, sync}|{blocked: true, reason: string}|{stopped: true, why: string}>} */
|
|
@@ -115,11 +138,12 @@ export async function postMergeStep(ctx) {
|
|
|
115
138
|
if (config.versionSync) {
|
|
116
139
|
sync = await versionSync(ctx, sha, b);
|
|
117
140
|
if (sync.err) return blocked(sync.err);
|
|
141
|
+
if (sync.warning) io.print(`release: WARNING ${sync.warning}`);
|
|
118
142
|
}
|
|
119
143
|
if (state.release?.branch) {
|
|
120
144
|
const gone = cleanupSnapshot({ git: io.git, branch: state.release.branch });
|
|
121
145
|
if (!gone.deleted) io.print(`release: could not delete ${state.release.branch} (${gone.why}); delete it by hand`);
|
|
122
146
|
}
|
|
123
|
-
io.print(`release: published (run ${pub.run}${pub.dispatched ? ", dispatched" : ""})${art ? ", artifact confirmed" : ""}${sync ? `, version-sync PR #${sync.pr} merged` : ""}`);
|
|
147
|
+
io.print(`release: published (run ${pub.run}${pub.dispatched ? ", dispatched" : ""})${art ? ", artifact confirmed" : ""}${sync?.pr ? `, version-sync PR #${sync.pr} ${sync.merged ? "merged" : "pending"}` : sync?.skipped ? ", staging already synced" : ""}`);
|
|
124
148
|
return { published: true, merge: sha, run: pub.run, dispatched: pub.dispatched, artifact: art?.ok ?? null, sync };
|
|
125
149
|
}
|
|
@@ -35,6 +35,7 @@ function world() {
|
|
|
35
35
|
readFile: () => "brief",
|
|
36
36
|
markLaunched: (_f, domains) => { w.launched = domains; },
|
|
37
37
|
saveTestGate: () => "/sd/gate.txt",
|
|
38
|
+
testGatePlan: async () => ({ clusters: 1, skill: "test-gate" }),
|
|
38
39
|
runAgent: async ({ role }) => { w.agents.push(role); return { text: "FORGE:TEST_GATE:RESULT=PASS" }; },
|
|
39
40
|
finalize: async () => ({ code: 0, lines: [], data: { head: sha(w.head), notes: ["- nit"], toFile: w.fixed ? [] : [{ title: "leak", severity: "HIGH" }] } }),
|
|
40
41
|
fileIssue: async ({ item }) => { w.issues.push(item.title); return 100 + w.issues.length; },
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { execFileSync, spawn } from "node:child_process";
|
|
12
12
|
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync, appendFileSync, rmSync } from "node:fs";
|
|
13
|
-
import { tmpdir } from "node:os";
|
|
13
|
+
import { tmpdir, homedir } from "node:os";
|
|
14
14
|
import { delimiter, join } from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { runHostPreflight } from "./release-preflight.mjs";
|
|
@@ -68,6 +68,41 @@ const sessionFailure = (e) => {
|
|
|
68
68
|
const failureNote = (failures) => (failures.size ? `; session failures: ${[...failures].map(([d, f]) => `${d} (${f})`).join("; ")}` : "");
|
|
69
69
|
const headMoved = (lines) => /head moved since/.test((lines ?? []).join("\n"));
|
|
70
70
|
|
|
71
|
+
/** #5516: commands/test-gate.md missing-config guard output, verbatim markers (consumed by review-staging-post.sh test-gate). */
|
|
72
|
+
export const TEST_GATE_SKIP_NO_TESTS = "ADVISORY: verification.integration_tests is not configured in forge.yaml.\nNo tests to run. Emitting SKIP verdict.\n<!-- FORGE:TEST_GATE:SKIP|reason=no-tests-configured -->\n<!-- FORGE:TEST_GATE:RESULT=SKIP -->\n";
|
|
73
|
+
/** #5516: the gate session's prompt names the exact Skill to invoke (prefixed on a plugin install). */
|
|
74
|
+
export const testGatePrompt = (skill, bundle, def) =>
|
|
75
|
+
`Invoke the Skill "${skill}" with args: --prs "${(bundle ?? []).join(" ")}" --base ${def}\n\nPrint the complete gate output, ending with its FORGE:TEST_GATE:RESULT= marker. If the Skill cannot be invoked, say so and print no marker.`;
|
|
76
|
+
/** #5516: count of `verification.integration_tests` entries in forge.yaml text; null when it cannot be read (the gate session then runs). */
|
|
77
|
+
export function integrationTestCount(raw) {
|
|
78
|
+
const lines = String(raw ?? "").split("\n");
|
|
79
|
+
const v = lines.findIndex((l) => /^verification:\s*(#.*)?$/.test(l));
|
|
80
|
+
if (v < 0) return 0;
|
|
81
|
+
let n = null;
|
|
82
|
+
for (let i = v + 1; i < lines.length && !/^\S/.test(lines[i]); i++) {
|
|
83
|
+
const m = /^(\s+)integration_tests:\s*(.*)$/.exec(lines[i]);
|
|
84
|
+
if (!m) continue;
|
|
85
|
+
const inline = m[2].replace(/#.*$/, "").trim();
|
|
86
|
+
if (inline === "[]" || inline === "null" || inline === "~") return 0;
|
|
87
|
+
if (inline) return null; // a flow sequence or anchor: not parsed here
|
|
88
|
+
n = 0;
|
|
89
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
90
|
+
const l = lines[j];
|
|
91
|
+
if (!l.trim() || /^\s*#/.test(l)) continue;
|
|
92
|
+
const ind = /^(\s*)/.exec(l)[1].length;
|
|
93
|
+
if (ind <= m[1].length && !/^\s*-/.test(l)) break;
|
|
94
|
+
if (ind < m[1].length) break;
|
|
95
|
+
if (/^\s*-\s/.test(l) && ind <= m[1].length + 2) n++;
|
|
96
|
+
}
|
|
97
|
+
return n;
|
|
98
|
+
}
|
|
99
|
+
return n ?? 0;
|
|
100
|
+
}
|
|
101
|
+
/** #5516: `forgedock:<name>` when ForgeDock is installed as a Claude Code plugin under `configDir`, else the bare name. */
|
|
102
|
+
export function resolveSkillName(name, { configDir, read = (p) => readFileSync(p, "utf8") } = {}) {
|
|
103
|
+
try { return /"forgedock(@[^"]*)?"\s*:/.test(read(join(configDir, "plugins", "installed_plugins.json"))) ? `forgedock:${name}` : name; } catch { return name; }
|
|
104
|
+
}
|
|
105
|
+
|
|
71
106
|
/** One review round at the current head: dispatch, test gate, head check, finalize. @returns {{moved: string}|{fail}|{ok}} */
|
|
72
107
|
async function reviewRound({ seam, pr, def, delta }) {
|
|
73
108
|
const pre = await seam.pre({ pr, delta });
|
|
@@ -85,7 +120,11 @@ async function reviewRound({ seam, pr, def, delta }) {
|
|
|
85
120
|
const failures = new Map();
|
|
86
121
|
const attempt = (domain, note) => send(domain, note).catch((e) => { failures.set(domain, sessionFailure(e)); return null; });
|
|
87
122
|
await Promise.all(agents.map((a) => attempt(a.domain)));
|
|
88
|
-
|
|
123
|
+
// #5516: the missing-config guard of commands/test-gate.md is deterministic, so no session decides it; otherwise the gate
|
|
124
|
+
// session gets a full tool set (Skill, Task, Bash) and the resolved skill name, never a bare `/test-gate`.
|
|
125
|
+
const plan = await seam.testGatePlan();
|
|
126
|
+
const gate = plan.clusters === 0 ? { text: TEST_GATE_SKIP_NO_TESTS }
|
|
127
|
+
: await seam.runAgent({ role: "release-test-gate", issue: pr, fullSession: true, prompt: testGatePrompt(plan.skill, m.bundle, def) });
|
|
89
128
|
const gateFile = seam.saveTestGate(pr, gate?.text ?? "");
|
|
90
129
|
|
|
91
130
|
// The head moved while the panel ran: finalize would refuse, and must never run at the moved head. Delta from what was reviewed.
|
|
@@ -126,7 +165,7 @@ async function runReview({ seam, pr, def, delta = null }) {
|
|
|
126
165
|
if ((st.notes ?? []).length) await seam.addNotes(pr, st.notes);
|
|
127
166
|
const sum = await seam.summary({ pr, filed });
|
|
128
167
|
if (!sum.data) return blocked(`the gate summary was not posted (exit ${sum.code}): ${(sum.lines ?? []).slice(-1).join("").slice(0, 200)}`);
|
|
129
|
-
return { pr, head: st.head, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), filed, blocking, delta: st.delta?.from ?? null };
|
|
168
|
+
return { pr, head: st.head, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), ciPendingOnly: Boolean(sum.data.ciPendingOnly), filed, blocking, delta: st.delta?.from ?? null };
|
|
130
169
|
}
|
|
131
170
|
|
|
132
171
|
/** Review step. @returns {{pr, head, verdict, marker, filed, blocking}|{blocked: true, reason: string}} */
|
|
@@ -147,13 +186,15 @@ export async function fixStep(ctx) {
|
|
|
147
186
|
if (!r.blocking?.length && r.ciFailing > 0 && r.ciCancelOnly) {
|
|
148
187
|
const sum = await seam.summary({ pr: r.pr, filed: r.filed ?? [] });
|
|
149
188
|
if (!sum.data) return blocked(`the gate summary was not posted (exit ${sum.code}) after rerunning the cancelled checks of #${r.pr}`);
|
|
150
|
-
r = { ...r, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly) };
|
|
189
|
+
r = { ...r, verdict: sum.data.verdict, marker: sum.data.marker, ciFailing: sum.data.ciFailing, ciCancelOnly: Boolean(sum.data.ciCancelOnly), ciPendingOnly: Boolean(sum.data.ciPendingOnly) };
|
|
151
190
|
ctx.state.steps.review = { ...ctx.state.steps.review, result: r };
|
|
152
191
|
ctx.save();
|
|
153
192
|
if (r.marker === "FORGE:GATE_PASS") break;
|
|
154
193
|
if (r.ciCancelOnly) return blocked(`required checks of #${r.pr} still cancelled after a rerun, with no failure to fix`);
|
|
155
194
|
round--; continue;
|
|
156
195
|
}
|
|
196
|
+
// Required checks that are only still pending (#5519) have not failed: no CI issue or lane, the release re-runs once CI finishes.
|
|
197
|
+
if (!r.blocking?.length && r.ciFailing > 0 && r.ciPendingOnly) return blocked(`required checks of #${r.pr} still pending, with no failure to fix; re-run the release once CI finishes`);
|
|
157
198
|
// Blocking findings are already filed issues; red CI has none, so it gets one issue naming the failing checks.
|
|
158
199
|
const issues = [...(r.blocking ?? [])];
|
|
159
200
|
if (r.ciFailing > 0) {
|
|
@@ -211,10 +252,16 @@ export function realSeam({ repo, def, env = process.env, cwd = process.cwd(), ma
|
|
|
211
252
|
readFile: (p) => readFileSync(p, "utf8"),
|
|
212
253
|
markLaunched: (file, domains, head) => { appendFileSync(file, domains.map((d) => `${d}\n`).join("")); writeFileSync(`${file}.head`, `${head}\n`); },
|
|
213
254
|
saveTestGate: (pr, text) => { mkdirSync(sd, { recursive: true }); const f = join(sd, `${pr}_test_gate_output.txt`); writeFileSync(f, text); return f; },
|
|
214
|
-
runAgent: async ({ role, issue, prompt }) => {
|
|
255
|
+
runAgent: async ({ role, issue, prompt, fullSession = false }) => {
|
|
215
256
|
runner ??= makeRunner ? makeRunner() : (await import("./effects.mjs")).makeLeanRunner();
|
|
216
|
-
// not readOnly: each reviewer posts its own PR comment
|
|
217
|
-
return runner({ role, issue, cwd, env: pinnedEnv(), prompt, system: "You are an isolated reviewer of one release PR. Do only what the prompt asks.", maxMs: REVIEW_MS, idleMs: 10 * 60_000 });
|
|
257
|
+
// not readOnly: each reviewer posts its own PR comment; the test gate (#5516) needs Skill/Task, so a full session
|
|
258
|
+
return runner({ role, issue, cwd, env: pinnedEnv(), prompt, fullSession, system: "You are an isolated reviewer of one release PR. Do only what the prompt asks.", maxMs: REVIEW_MS, idleMs: 10 * 60_000 });
|
|
259
|
+
},
|
|
260
|
+
testGatePlan: async () => {
|
|
261
|
+
let raw = null;
|
|
262
|
+
try { raw = readFileSync(env.FORGE_CONFIG || join(cwd, "forge.yaml"), "utf8"); } catch { raw = null; }
|
|
263
|
+
const clusters = raw == null ? null : integrationTestCount(raw);
|
|
264
|
+
return { clusters, skill: resolveSkillName("test-gate", { configDir: env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude") }) };
|
|
218
265
|
},
|
|
219
266
|
// closed by a merged fix: state CLOSED with the workflow:merged label (a read failure is "not merged", so the lane runs)
|
|
220
267
|
issueMerged: async (issue) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
import { describe, it } from "node:test";
|
|
4
4
|
import assert from "node:assert/strict";
|
|
5
|
-
import { reviewStep, fixStep, missingReviewers, SPEC_PANEL, MAX_DELTA_PASSES, MAX_FIX_ROUNDS, realSeam, withIntegrityMarker } from "./release-review.mjs";
|
|
5
|
+
import { reviewStep, fixStep, missingReviewers, SPEC_PANEL, MAX_DELTA_PASSES, MAX_FIX_ROUNDS, realSeam, withIntegrityMarker, TEST_GATE_SKIP_NO_TESTS, testGatePrompt, integrationTestCount, resolveSkillName } from "./release-review.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { reviewStagingJson } from "../review-staging.mjs";
|
|
8
8
|
|
|
@@ -11,19 +11,20 @@ const manifest = (head, delta = null) => ({ pr: 7, headSha: head, bundle: [1, 2]
|
|
|
11
11
|
const fin = (extra = {}) => ({ code: 0, data: { head: H1, toFile: [], notes: [], ...extra }, lines: [] });
|
|
12
12
|
|
|
13
13
|
/** Seam fake: `heads` is what headOf answers in turn; `fins` what finalize answers in turn. */
|
|
14
|
-
function fakeSeam({ heads = [H1], fins = [fin()], summary, lanes = [] } = {}) {
|
|
15
|
-
const log = [], agents = [];
|
|
14
|
+
function fakeSeam({ heads = [H1], fins = [fin()], summary, lanes = [], gatePlan = { clusters: 1, skill: "forgedock:test-gate" } } = {}) {
|
|
15
|
+
const log = [], agents = [], gateSaved = [], agentCalls = [];
|
|
16
16
|
let h = 0, f = 0, l = 0, n = 100;
|
|
17
17
|
return {
|
|
18
|
-
log, agents,
|
|
18
|
+
log, agents, gateSaved, agentCalls,
|
|
19
19
|
pre: async (a) => { log.push(["pre", a.delta]); return { code: 0, data: manifest(a.delta ? heads[heads.length - 1] : H1, a.delta ? { from: a.delta, files: ["x"] } : null), lines: [] }; },
|
|
20
20
|
finalize: async () => { log.push(["finalize"]); return fins[Math.min(f++, fins.length - 1)]; },
|
|
21
21
|
summary: async (a) => { log.push(["summary", a.filed]); return summary ?? { code: 0, data: { verdict: "APPROVE FOR DEPLOY", marker: "FORGE:GATE_PASS", ciFailing: 0 }, lines: [] }; },
|
|
22
22
|
headOf: async () => heads[Math.min(h++, heads.length - 1)],
|
|
23
23
|
readFile: (p) => `brief ${p}`,
|
|
24
24
|
markLaunched: (file, domains) => log.push(["launched", domains]),
|
|
25
|
-
saveTestGate: () => "/sd/7_test_gate_output.txt",
|
|
26
|
-
|
|
25
|
+
saveTestGate: (pr, text) => { gateSaved.push(text); return "/sd/7_test_gate_output.txt"; },
|
|
26
|
+
testGatePlan: async () => gatePlan,
|
|
27
|
+
runAgent: async (a) => { agentCalls.push(a); agents.push(a.role + (a.prompt.includes("findings block required") ? ":reask" : "")); return { text: "ok" }; },
|
|
27
28
|
fileIssue: async ({ item }) => { log.push(["file", item.title]); return n++; },
|
|
28
29
|
fileCiIssue: async () => { log.push(["ci-issue"]); return n++; },
|
|
29
30
|
issueMerged: async () => false,
|
|
@@ -53,7 +54,7 @@ describe("reviewStep", () => {
|
|
|
53
54
|
|
|
54
55
|
it("realSeam exposes every effect the steps use, matching the fake seam", () => {
|
|
55
56
|
const real = Object.keys(realSeam({ repo: "o/r", def: "main", env: {}, cwd: "/tmp" })).sort();
|
|
56
|
-
assert.deepEqual(real, Object.keys(fakeSeam()).filter((k) =>
|
|
57
|
+
assert.deepEqual(real, Object.keys(fakeSeam()).filter((k) => !["log", "agents", "gateSaved", "agentCalls"].includes(k)).sort());
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
it("runs the briefs and the spec panel in parallel, then test gate, finalize and summary in order", async () => {
|
|
@@ -206,6 +207,16 @@ describe("fixStep", () => {
|
|
|
206
207
|
assert.ok(!s2.log.some((e) => e[0] === "ci-issue" || e[0] === "lane"));
|
|
207
208
|
});
|
|
208
209
|
|
|
210
|
+
it("only pending CI (#5519): blocks without a CI issue or lane; a real failure alongside still files", async () => {
|
|
211
|
+
const s = fakeSeam();
|
|
212
|
+
const r = await fixStep(ctx(s, { review: { result: { ...failed, blocking: [], filed: [], ciFailing: 1, ciPendingOnly: true } } }));
|
|
213
|
+
assert.match(r.reason, /still pending/);
|
|
214
|
+
assert.deepEqual(s.log, []);
|
|
215
|
+
const s2 = fakeSeam();
|
|
216
|
+
await fixStep(ctx(s2, { review: { result: { ...failed, blocking: [], filed: [], ciFailing: 2, ciPendingOnly: false } } }));
|
|
217
|
+
assert.ok(s2.log.some((e) => e[0] === "ci-issue"));
|
|
218
|
+
});
|
|
219
|
+
|
|
209
220
|
it("blocks when the verdict is not a pass but there is nothing to fix", async () => {
|
|
210
221
|
assert.match((await fixStep(ctx(fakeSeam(), { review: { result: { ...failed, blocking: [], ciFailing: 0 } } }))).reason, /nothing to fix|neither/);
|
|
211
222
|
});
|
|
@@ -319,3 +330,61 @@ describe("withIntegrityMarker (filing release findings through issue-create.sh)"
|
|
|
319
330
|
assert.match(out, /FORGE:BODY-INTEGRITY:fix-auto-spawned-schedd-review-finding -->/);
|
|
320
331
|
});
|
|
321
332
|
});
|
|
333
|
+
|
|
334
|
+
describe("#5516 release test gate", () => {
|
|
335
|
+
it("no integration_tests configured: no gate session, and the saved output carries the guard's SKIP marker", async () => {
|
|
336
|
+
const s = fakeSeam({ gatePlan: { clusters: 0, skill: "forgedock:test-gate" } });
|
|
337
|
+
await reviewStep(ctx(s));
|
|
338
|
+
assert.ok(!s.agents.includes("release-test-gate"), "no session decides a deterministic SKIP");
|
|
339
|
+
assert.equal(s.gateSaved.length, 1);
|
|
340
|
+
assert.match(s.gateSaved[0], /FORGE:TEST_GATE:RESULT=SKIP/);
|
|
341
|
+
assert.match(s.gateSaved[0], /reason=no-tests-configured/);
|
|
342
|
+
});
|
|
343
|
+
it("before the fix the gate output had no marker (finalize failed closed); the SKIP output has exactly one RESULT marker", () => {
|
|
344
|
+
assert.equal((TEST_GATE_SKIP_NO_TESTS.match(/FORGE:TEST_GATE:RESULT=(BLOCK|PASS|SKIP)/g) ?? []).length, 1);
|
|
345
|
+
});
|
|
346
|
+
it("clusters configured: the gate runs in a full session and the prompt names the resolved skill", async () => {
|
|
347
|
+
const s = fakeSeam({ gatePlan: { clusters: 2, skill: "forgedock:test-gate" } });
|
|
348
|
+
await reviewStep(ctx(s));
|
|
349
|
+
const g = s.agentCalls.find((a) => a.role === "release-test-gate");
|
|
350
|
+
assert.ok(g && g.fullSession === true, "Skill/Task/Bash available to the gate session");
|
|
351
|
+
assert.match(g.prompt, /Invoke the Skill "forgedock:test-gate" with args: --prs "1 2" --base main/);
|
|
352
|
+
assert.ok(!/^\/test-gate/.test(g.prompt));
|
|
353
|
+
const reviewers = s.agentCalls.filter((a) => a.role !== "release-test-gate");
|
|
354
|
+
assert.ok(reviewers.every((a) => !a.fullSession), "reviewers keep the lean session");
|
|
355
|
+
});
|
|
356
|
+
it("an unreadable config (clusters null) still runs the gate session, never a SKIP", async () => {
|
|
357
|
+
const s = fakeSeam({ gatePlan: { clusters: null, skill: "test-gate" } });
|
|
358
|
+
await reviewStep(ctx(s));
|
|
359
|
+
assert.ok(s.agents.includes("release-test-gate"));
|
|
360
|
+
});
|
|
361
|
+
it("integrationTestCount reads the verification block", () => {
|
|
362
|
+
assert.equal(integrationTestCount("project:\n repo: x\n"), 0);
|
|
363
|
+
assert.equal(integrationTestCount("verification:\n integration_tests: []\n"), 0);
|
|
364
|
+
assert.equal(integrationTestCount("verification:\n test_gate:\n posture: blocking\n"), 0);
|
|
365
|
+
assert.equal(integrationTestCount("verification:\n integration_tests:\n - cluster: api\n command: pytest\n - cluster: web\n command: npm test\n test_services:\n api: c\n"), 2);
|
|
366
|
+
assert.equal(integrationTestCount("verification:\n integration_tests: [{cluster: a}]\n"), null);
|
|
367
|
+
});
|
|
368
|
+
it("resolveSkillName: prefixed on a plugin install, bare otherwise", () => {
|
|
369
|
+
assert.equal(resolveSkillName("test-gate", { configDir: "/c", read: () => '{"plugins":{"forgedock@forgedock":[{}]}}' }), "forgedock:test-gate");
|
|
370
|
+
assert.equal(resolveSkillName("test-gate", { configDir: "/c", read: () => '{"plugins":{}}' }), "test-gate");
|
|
371
|
+
assert.equal(resolveSkillName("test-gate", { configDir: "/c", read: () => { throw new Error("ENOENT"); } }), "test-gate");
|
|
372
|
+
});
|
|
373
|
+
it("testGatePrompt", () => {
|
|
374
|
+
assert.match(testGatePrompt("test-gate", [5, 6], "main"), /Skill "test-gate" with args: --prs "5 6" --base main/);
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
describe("#5516 makeLeanRunner fullSession", () => {
|
|
379
|
+
it("fullSession drops the lean minimal flags (slash commands/Skill stay available); the default keeps them", async () => {
|
|
380
|
+
const { makeLeanRunner } = await import("./effects.mjs");
|
|
381
|
+
const seen = [];
|
|
382
|
+
const runCli = async (o) => { seen.push(o.sessionFlags); return { text: "", usage: null, costUsd: 0, durationMs: 0, turns: 0, sessionId: "s" }; };
|
|
383
|
+
const base = { role: "release-test-gate", issue: 1, cwd: process.cwd(), prompt: "p", system: "" };
|
|
384
|
+
await makeLeanRunner({ runCli, probe: () => false })({ ...base });
|
|
385
|
+
await makeLeanRunner({ runCli, probe: () => false })({ ...base, fullSession: true });
|
|
386
|
+
const [lean, full] = seen;
|
|
387
|
+
assert.deepEqual(full, [], "no --disable-slash-commands / tool restriction for the gate session");
|
|
388
|
+
if (lean.length) assert.ok(lean.some((f) => /slash|tools|mcp/i.test(f)), `lean flags restrict the session: ${lean.join(" ")}`);
|
|
389
|
+
});
|
|
390
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
/** Unit/coupling/contract/force resolver for `.forge/release.yaml` (#5551): every path resolves to a unit or "none". */
|
|
4
|
+
|
|
5
|
+
/** Glob to RegExp: `**` any depth (a trailing `/**` also matches the directory's files), `*` within a segment, `?` one char. */
|
|
6
|
+
export function unitGlobToRegExp(glob) {
|
|
7
|
+
let re = "";
|
|
8
|
+
for (let i = 0; i < glob.length; i++) {
|
|
9
|
+
const c = glob[i];
|
|
10
|
+
if (c === "*" && glob[i + 1] === "*") {
|
|
11
|
+
i++;
|
|
12
|
+
if (glob[i + 1] === "/") { i++; re += "(?:.*/)?"; } else re += ".*";
|
|
13
|
+
} else if (c === "*") re += "[^/]*";
|
|
14
|
+
else if (c === "?") re += "[^/]";
|
|
15
|
+
else re += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
16
|
+
}
|
|
17
|
+
return new RegExp(`^${re}$`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const matchesAny = (globs, path) => (globs ?? []).some((g) => unitGlobToRegExp(String(g)).test(path));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @returns {{path, unit: string|"none", units: string[], affects: string[], contracts: object[], forces: object[]}}
|
|
24
|
+
* `unit` is the first unit (declaration order) owning the path; `units` every owner; `affects` the units the matching couplings fan out to.
|
|
25
|
+
*/
|
|
26
|
+
export function resolvePath(policy, rawPath) {
|
|
27
|
+
const path = String(rawPath).replace(/^\.\//, "");
|
|
28
|
+
const units = Object.entries(policy?.units ?? {}).filter(([, u]) => matchesAny(u?.paths, path)).map(([id]) => id);
|
|
29
|
+
const affects = [...new Set((policy?.couplings ?? []).filter((c) => matchesAny(c.paths, path)).flatMap((c) => c.affects ?? []))];
|
|
30
|
+
return {
|
|
31
|
+
path, unit: units[0] ?? "none", units, affects,
|
|
32
|
+
contracts: (policy?.contracts ?? []).filter((c) => matchesAny(c.paths, path)),
|
|
33
|
+
forces: (policy?.forces ?? []).filter((f) => matchesAny(f.paths, path)),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
import { describe, it } from "node:test";
|
|
4
|
+
import assert from "node:assert/strict";
|
|
5
|
+
import { unitGlobToRegExp, resolvePath } from "./release-unitmap.mjs";
|
|
6
|
+
|
|
7
|
+
const policy = {
|
|
8
|
+
units: { api: { paths: ["services/api/**"] }, worker: { paths: ["services/worker/**"] }, web: { paths: ["web/*.js"] } },
|
|
9
|
+
couplings: [{ paths: ["shared/**"], affects: ["api", "worker"] }, { paths: ["emails/**"], affects: ["api", "web"] }],
|
|
10
|
+
contracts: [{ producer: "api", consumers: ["web"], paths: ["services/api/app/routers/**"] }],
|
|
11
|
+
forces: [{ paths: ["infra/migrations/**"], pipeline: "full", reason: "migrations" }, { paths: ["docker-compose*.yml"], pipeline: "full", reason: "deploy-mechanics" }],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe("unitGlobToRegExp", () => {
|
|
15
|
+
it("** crosses directories, * does not, ? is one char", () => {
|
|
16
|
+
assert.ok(unitGlobToRegExp("a/**").test("a/b/c.txt"));
|
|
17
|
+
assert.ok(unitGlobToRegExp("**/x.json").test("x.json") && unitGlobToRegExp("**/x.json").test("a/b/x.json"));
|
|
18
|
+
assert.ok(unitGlobToRegExp("a/*.js").test("a/b.js") && !unitGlobToRegExp("a/*.js").test("a/b/c.js"));
|
|
19
|
+
assert.ok(unitGlobToRegExp("a?.js").test("ab.js") && !unitGlobToRegExp("a?.js").test("a/.js"));
|
|
20
|
+
assert.ok(!unitGlobToRegExp("a.js").test("axjs"));
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("resolvePath", () => {
|
|
25
|
+
it("resolves a path to its unit or none", () => {
|
|
26
|
+
for (const [p, u] of [["services/api/app/main.py", "api"], ["services/worker/x.py", "worker"], ["web/a.js", "web"], ["README.md", "none"], ["web/sub/a.js", "none"]]) assert.equal(resolvePath(policy, p).unit, u, p);
|
|
27
|
+
});
|
|
28
|
+
it("fans a coupling out, flags a contract and a force", () => {
|
|
29
|
+
assert.deepEqual(resolvePath(policy, "shared/x.py").affects, ["api", "worker"]);
|
|
30
|
+
assert.equal(resolvePath(policy, "shared/x.py").unit, "none");
|
|
31
|
+
assert.equal(resolvePath(policy, "services/api/app/routers/a.py").contracts[0].producer, "api");
|
|
32
|
+
assert.equal(resolvePath(policy, "infra/migrations/001.sql").forces[0].reason, "migrations");
|
|
33
|
+
assert.equal(resolvePath(policy, "./docker-compose.prod.yml").forces[0].reason, "deploy-mechanics");
|
|
34
|
+
});
|
|
35
|
+
it("first declared unit wins and every owner is listed", () => {
|
|
36
|
+
const p = { units: { a: { paths: ["x/**"] }, b: { paths: ["x/y/**"] } } };
|
|
37
|
+
const r = resolvePath(p, "x/y/z");
|
|
38
|
+
assert.equal(r.unit, "a"); assert.deepEqual(r.units, ["a", "b"]);
|
|
39
|
+
});
|
|
40
|
+
it("an empty policy resolves everything to none", () => assert.equal(resolvePath({}, "a").unit, "none"));
|
|
41
|
+
});
|