Answer stability round 2: 0 🔴, 1 🟡 (0 misread); kill the cycle mutant with a test, restore two spaces
CI / full-gate (push) Successful in 3m25s
CI / full-gate (push) Successful in 3m25s
This commit is contained in:
@@ -424,7 +424,7 @@ const EMPTIED_NOTICE = "group-emptied"; // the `info-msg` that removing a group'
|
||||
const emptiedNotice = (url: URL, t: Translate): string | undefined =>
|
||||
url.searchParams.get("info-msg") === EMPTIED_NOTICE ? t("admin.groups.emptied") : undefined;
|
||||
|
||||
const tupleId =(t: RelationTuple): string => {
|
||||
const tupleId = (t: RelationTuple): string => {
|
||||
const subject = t.subject_set ? `${t.subject_set.namespace}:${t.subject_set.object}#${t.subject_set.relation}` : t.subject_id;
|
||||
return `${t.namespace}:${t.object}#${t.relation}@${subject}`;
|
||||
};
|
||||
|
||||
@@ -72,7 +72,7 @@ const messages = {
|
||||
"admin.groups.delete": "Delete group",
|
||||
"admin.groups.deleteMessage": "Delete group {{name}}? This can't be undone.",
|
||||
"admin.groups.emptied": "That was the last member, so the group no longer exists and its permissions and parent groups are removed.",
|
||||
"admin.groups.error.duplicate":"A group with that name already exists.",
|
||||
"admin.groups.error.duplicate": "A group with that name already exists.",
|
||||
"admin.groups.error.selfLockout": "This change would lock you out of {{permissions}}, which you hold through this group. Ask another administrator to make it.",
|
||||
"admin.groups.field.name": "Group name",
|
||||
"admin.groups.field.nameHint": "Lowercase letters, digits, dashes and underscores.",
|
||||
|
||||
@@ -72,7 +72,7 @@ const messages: AdminMessages = {
|
||||
"admin.groups.delete": "Radera grupp",
|
||||
"admin.groups.deleteMessage": "Ta bort gruppen {{name}}? Det går inte att ångra.",
|
||||
"admin.groups.emptied": "Det var den sista medlemmen, så gruppen finns inte längre och dess behörigheter och föräldragrupper är borttagna.",
|
||||
"admin.groups.error.duplicate":"Det finns redan en grupp med det namnet.",
|
||||
"admin.groups.error.duplicate": "Det finns redan en grupp med det namnet.",
|
||||
"admin.groups.error.selfLockout": "Ändringen skulle låsa ute dig från {{permissions}}, som du har genom den här gruppen. Be en annan administratör att göra den.",
|
||||
"admin.groups.field.name": "Gruppnamn",
|
||||
"admin.groups.field.nameHint": "Små bokstäver, siffror, bindestreck och understreck.",
|
||||
|
||||
@@ -478,6 +478,19 @@ test("admin group delete: a nesting cycle ends the cascade at a group that keeps
|
||||
assert.deepEqual(tuples, [groupTuple("c", { subject_id: "user:other" }), grantTo("c", "groups:read")]);
|
||||
});
|
||||
|
||||
// The walk reaches `a` a second time, through the cycle, while `p` still waits: it must go on to `p`.
|
||||
// Keto lists `p@b` before `a@b`, so `a` is popped before `p`.
|
||||
test("admin group delete: a nesting cycle back to an emptied group doesn't end the cascade", async (t) => {
|
||||
const tuples: RelationTuple[] = [
|
||||
groupTuple("a", { subject_id: `user:${ADA}` }), groupTuple("p", inGroup("b")), groupTuple("a", inGroup("b")),
|
||||
groupTuple("b", inGroup("a")), grantTo("p"),
|
||||
];
|
||||
const { post, token } = await groupsAdminHarness(t, tuples);
|
||||
|
||||
assert.equal((await post("/auth-admin/groups/a/delete", `_csrf=${token}`)).status, 303);
|
||||
assert.deepEqual(tuples, []);
|
||||
});
|
||||
|
||||
test("admin group delete: a diamond of nested groups empties the top once both its members are gone", async (t) => {
|
||||
const tuples: RelationTuple[] = [
|
||||
groupTuple("eng", { subject_id: `user:${ADA}` }),
|
||||
|
||||
Reference in New Issue
Block a user