Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/w3c/templates/sotd.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,18 @@ function renderNotRec(conf) {
break;
case "CRD":
statusExplanation = html`A Candidate Recommendation Draft integrates
changes from the previous Candidate Recommendation that the Working Group
intends to include in a subsequent Candidate Recommendation Snapshot.`;
changes from the previous Candidate Recommendation that the Working
Group${conf.multipleWGs ? "s intend" : " intends"} to include in a
subsequent Candidate Recommendation Snapshot.`;
Comment on lines 198 to +201
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pluralization here keys off Array.isArray(conf.wg), which will incorrectly pluralize when the user provides a single group as an array (e.g., group: ["payments"] => conf.wg becomes an array of length 1). Since this template already relies on conf.multipleWGs elsewhere, use conf.multipleWGs (or Array.isArray(conf.wg) && conf.wg.length > 1) to decide between “Group intends” vs “Groups intend”.

Copilot uses AI. Check for mistakes.
if (conf.pubMode === "LS") {
updatePolicy = lsUpdatePolicy;
}
break;
case "CRYD":
statusExplanation = html`A Candidate Registry Draft integrates changes
from the previous Candidate Registry Snapshot that the Working Group
intends to include in a subsequent Candidate Registry Snapshot.`;
from the previous Candidate Registry Snapshot that the Working
Group${conf.multipleWGs ? "s intend" : " intends"} to include in a
subsequent Candidate Registry Snapshot.`;
Comment on lines 207 to +210
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the CRD branch: Array.isArray(conf.wg) will pluralize even for a single WG if it was configured via an array. Switch this conditional to conf.multipleWGs (or check conf.wg.length > 1) so pubrules-style pluralization is based on the actual number of working groups, not the value type.

Copilot uses AI. Check for mistakes.
if (conf.pubMode === "LS") {
updatePolicy = lsUpdatePolicy;
}
Expand Down
34 changes: 33 additions & 1 deletion tests/spec/w3c/group-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("W3C — Group", () => {
]);
});

it("when a multiple groups are specified, it pluralizes the groups", async () => {
it("when multiple groups are specified, it pluralizes the groups", async () => {
const ops = makeStandardOps({
group: ["payments", "webapps"],
specStatus: "NOTE",
Expand All @@ -49,6 +49,38 @@ describe("W3C — Group", () => {
);
});

for (const specStatus of ["CRD", "CRYD"]) {
it(`${specStatus}: writes "Working Group intends" for a single group`, async () => {
const ops = makeStandardOps({
group: "payments",
specStatus,
});
const doc = await makeRSDoc(ops);
const sotd = doc.getElementById("sotd").textContent.replace(/\s+/g, " ");
expect(sotd).toContain("that the Working Group intends to include in");
});

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new CRD/CRYD SotD tests cover string vs multi-element array, but they don’t cover the common edge case where a single group is provided as an array (e.g., group: ["payments"]). Adding that case would prevent regressions where pluralization is based on Array.isArray(conf.wg) instead of the actual group count.

Suggested change
it(`when one group is specified as an array in a ${specStatus}, "Working Group" is singular`, async () => {
const ops = makeStandardOps({
group: ["payments"],
specStatus,
});
const doc = await makeRSDoc(ops);
const sotd = doc.getElementById("sotd").textContent.replace(/\s+/g, " ");
expect(sotd).toContain("that the Working Group intends to include in");
});

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I had intentionally not done this as it seemed there were other places in the codebase that already exhibit the same behavior, but upon pulling further on this thread I see that headers.js does in fact consider this, and is responsible for assigning config.multipleWGs, which sotd.js uses in one other location, so I can use that for this PR as well.

it(`${specStatus}: writes "Working Group intends" for a single group in an array`, async () => {
const ops = makeStandardOps({
group: ["payments"],
specStatus,
});
const doc = await makeRSDoc(ops);
const sotd = doc.getElementById("sotd").textContent.replace(/\s+/g, " ");
expect(sotd).toContain("that the Working Group intends to include in");
});

it(`${specStatus}: writes "Working Groups intend" for multiple groups`, async () => {
const ops = makeStandardOps({
group: ["payments", "webapps"],
specStatus,
});
const doc = await makeRSDoc(ops);
const sotd = doc.getElementById("sotd").textContent.replace(/\s+/g, " ");
expect(sotd).toContain("that the Working Groups intend to include in");
});
}

it("overrides superseded options", async () => {
const inputConf = { group: "payments", wg: "foo", wgId: "1234" };
const conf = await getGroupConf(inputConf);
Expand Down
Loading