row 285: mos-1333, withdraw the publish fence; N10 option (a) with an assistant instance; a chief with its gitea ref, identity and publish loads; restore the creative publish test; BUILD.md gate scope (sage-2946) (#1790)

This commit is contained in:
jason.woltje committed 2026-10-23 13:54:09 -05:00
1 parent 66e3c3d616
commit cf8ba6ef45
4 files changed
+50 -39

No files matched your search

-6
View File
@@ -162,12 +162,6 @@ function checkRoles(roles, file, rolesDir, business) {
// names are checked against projects once those are read.
if (entry.identity !== undefined) out[instance].identity = checkIdentity(entry.identity, `${at}.identity`);
if (entry.publish !== undefined) {
// Row 285 (#1790, mos-1332 item 3): the chief of staff and the creative roles declare gitea for
// the library alone, so publish refuses at load as it did before they declared it. #giteaRole
// refuses both at raise (mos-1163, sage-2921).
if (CREATIVE_DEFINITIONS.includes(entry.definition) || entry.definition === "chief-of-staff") {
refuse(`${at}.publish needs identity and a gitea definition (${entry.definition} never publishes)`);
}
// N10: one message for both, naming the grant.
if (!out[instance].identity || !services.includes("gitea")) refuse(`${at}.publish needs identity and a gitea definition`);
out[instance].publish = requireDistinctList(entry.publish, `${at}.publish`, (p) => requireId(p, `${at}.publish entry`), { nonEmpty: true });
@@ -46,15 +46,21 @@ test("a granted agent loads with its identity, grant and the project's upstream"
test("N10: publish needs identity and a gitea definition, and the error names the grant", () => {
refuses(() => check((d) => { delete d.roles.coder.identity; }), /roles\.coder\.publish needs identity and a gitea definition/);
refuses(() => check((d) => { d.roles.chief.identity = structuredClone(IDENTITY); d.roles.chief.publish = ["stack"]; }),
/roles\.chief\.publish needs identity and a gitea definition/);
// Row 285 (mos-1333 item 3): the chief's definition now declares gitea, so this case names an
// instance whose definition has none.
refuses(() => check((d) => { d.roles.helper = { definition: "assistant", holder: "mos", identity: structuredClone(IDENTITY), publish: ["stack"] }; }),
/roles\.helper\.publish needs identity and a gitea definition/);
});
// Row 285 (mos-1332 item 3): the chief now declares gitea and refuses at the row 285 fence, so this
// case is the one that reaches N10's "no gitea definition" branch.
test("row 285: an instance whose definition has no gitea refuses publish with the N10 text", () => {
refuses(() => check((d) => { d.roles.helper = { definition: "assistant", holder: "mos", identity: structuredClone(IDENTITY), publish: ["stack"] }; }),
/roles\.helper\.publish needs identity and a gitea definition$/);
// Row 285 (mos-1333 item 4, brief :1829): the chief's grant needs identity and publish on the
// instance, so a chief with its gitea reference loads with both. X-G1 (gitea-grant.test) shows the
// same chief refuses at raise.
test("row 285: a chief with its gitea reference, identity and publish loads", () => {
const identity = { name: "Chief", email: "[email protected]", gitea: { url: "https://git.example", user: "acme-chief" } };
const business = check((d) => { d.roles.chief.identity = structuredClone(identity); d.roles.chief.publish = ["stack"]; });
assert.deepEqual({ ...business.roles.chief.identity, gitea: { ...business.roles.chief.identity.gitea } }, identity);
assert.deepEqual([...business.roles.chief.publish], ["stack"]);
assert.deepEqual(Object.keys(business.roles.chief.credentials), ["gitea"]);
});
test("publish names declared projects that have a remote, each once", () => {
+7 -8
View File
@@ -308,17 +308,16 @@ test("row 285: a chief or creative instance without credentials.gitea refuses at
}
});
// Row 285 (mos-1332 item 3): a creative instance holds gitea and may hold an identity, but publish
// still refuses at load with the N10 text, as before its definition declared gitea.
test("row 285: a creative instance with gitea, identity and publish refuses at load", () => {
// Row 285 (C2-08b, brief): a creative instance may carry identity and publish, under the rules at
// business.mjs:155-166, which the grant path reads. The grant itself still refuses it (#giteaRole).
test("row 285: a creative instance with identity and publish loads", () => {
const identity = { name: "Bean", email: "[email protected]", gitea: { url: "https://git.example", user: "acme-bean" } };
const bean = (extra) => (d) => {
const business = check((d) => {
d.projects.stack.remote = "https://git.example/acme/stack";
d.roles.bean = { definition: "companion", credentials: CREATIVE_GITEA, identity, ...extra };
};
const business = check(bean({}));
d.roles.bean = { definition: "companion", credentials: CREATIVE_GITEA, identity, publish: ["stack"] };
});
assert.deepEqual({ ...business.roles.bean.identity, gitea: { ...business.roles.bean.identity.gitea } }, identity);
refuses(() => check(bean({ publish: ["stack"] })), /roles\.bean\.publish needs identity and a gitea definition \(companion never publishes\)/);
assert.deepEqual([...business.roles.bean.publish], ["stack"]);
});
// Row 194 (#1692, D2.5, T17): the per-agent forbid and the retired list.