Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 1 addition & 4 deletions actions/setup/js/firewall_blocked_domains.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ function generateBlockedDomainsSection(blockedDomains) {
const domainWord = domainCount === 1 ? "domain" : "domains";

let section = "\n\n> [!WARNING]\n";
section += `> <details>\n`;
section += `> <summary><strong>⚠️ Firewall blocked ${domainCount} ${domainWord}</strong></summary>\n`;
section += `> **⚠️ Firewall blocked ${domainCount} ${domainWord}**\n`;
section += `>\n`;
section += `> The following ${domainWord} ${domainCount === 1 ? "was" : "were"} blocked by the firewall during workflow execution:\n`;
section += `>\n`;
Expand All @@ -220,8 +219,6 @@ function generateBlockedDomainsSection(blockedDomains) {
section += `> \`\`\`\n`;
section += `>\n`;
section += `> See [Network Configuration](https://github.github.com/gh-aw/reference/network/) for more information.\n`;
section += `>\n`;
section += `> </details>\n`;

return section;
}
Expand Down
8 changes: 2 additions & 6 deletions actions/setup/js/firewall_blocked_domains.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,7 @@ describe("firewall_blocked_domains.cjs", () => {
const result = generateBlockedDomainsSection(["blocked.example.com"]);

expect(result).toContain("> [!WARNING]");
expect(result).toContain("> <details>");
expect(result).toContain("> </details>");
expect(result).toContain("> <summary><strong>⚠️ Firewall blocked 1 domain</strong></summary>");
expect(result).toContain("> **⚠️ Firewall blocked 1 domain**");
expect(result).toContain("> - `blocked.example.com`");
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

This test title still says it "generate[s] details section", but the implementation no longer uses a

/ wrapper for the WARNING block. Update the test description to match the new behavior to avoid confusion when reading failures.

This issue also appears on line 319 of the same file.

Copilot uses AI. Check for mistakes.
expect(result).toContain("> The following domain was blocked by the firewall during workflow execution:");
expect(result).toContain('> ```yaml\n> network:\n> allowed:\n> - defaults\n> - "blocked.example.com"\n> ```');
Expand All @@ -323,9 +321,7 @@ describe("firewall_blocked_domains.cjs", () => {
const result = generateBlockedDomainsSection(domains);

expect(result).toContain("> [!WARNING]");
expect(result).toContain("> <details>");
expect(result).toContain("> </details>");
expect(result).toContain("> <summary><strong>⚠️ Firewall blocked 3 domains</strong></summary>");
expect(result).toContain("> **⚠️ Firewall blocked 3 domains**");
expect(result).toContain("> - `alpha.example.com`");
expect(result).toContain("> - `beta.example.com`");
expect(result).toContain("> - `gamma.example.com`");
Expand Down
9 changes: 4 additions & 5 deletions actions/setup/js/gateway_difc_filtered.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ function generateDifcFilteredSection(filteredEvents) {

const count = uniqueEvents.length;
const itemWord = count === 1 ? "item" : "items";
const verb = count === 1 ? "was" : "were";
const pronoun = count === 1 ? "it doesn't" : "they don't";
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

The variable name pronoun is misleading here because the value includes more than a pronoun (it also includes the negated auxiliary verb: "it doesn't" / "they don't"). Rename it to something that reflects the full phrase (e.g., subject/negation phrase) or split into subject and auxVerb to keep the sentence assembly clear.

See below for a potential fix:

  const subjectNegationPhrase = count === 1 ? "it doesn't" : "they don't";

  let section = "\n\n> [!NOTE]\n";
  section += `> <details>\n`;
  section += `> <summary>🔒 Integrity filter blocked ${count} ${itemWord}</summary>\n`;
  section += `>\n`;
  section += `> The following ${itemWord} ${verb} blocked because ${subjectNegationPhrase} meet the GitHub integrity level.\n`;

Copilot uses AI. Check for mistakes.

let section = "\n\n> [!NOTE]\n";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot keep details for NOTE

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.

Updated to keep the NOTE section collapsible with <details>/<summary> in gateway_difc_filtered.cjs, and adjusted tests accordingly in commit 05a15ac.

Screenshot: /tmp/gh-aw-note-details-preview.png (preview of the restored NOTE details block).

section += `> <details>\n`;
section += `> <summary>🔒 Integrity filter blocked ${count} ${itemWord}</summary>\n`;
section += `> **🔒 Integrity filter blocked ${count} ${itemWord}**\n`;
section += `>\n`;
section += `> The following ${itemWord} were blocked because they don't meet the GitHub integrity level.\n`;
section += `> The following ${itemWord} ${verb} blocked because ${pronoun} meet the GitHub integrity level.\n`;
section += `>\n`;

const maxItems = 16;
Expand Down Expand Up @@ -129,8 +130,6 @@ function generateDifcFilteredSection(filteredEvents) {
for (const line of remediationText.trimEnd().split("\n")) {
section += line ? `> ${line}\n` : `>\n`;
}
section += `>\n`;
section += `> </details>\n`;

return section;
}
Expand Down
16 changes: 7 additions & 9 deletions actions/setup/js/gateway_difc_filtered.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ describe("gateway_difc_filtered.cjs", () => {
const result = generateDifcFilteredSection(events);

expect(result).toContain("> [!NOTE]");
expect(result).toContain("> <details>");
expect(result).toContain("> </details>");
expect(result).toContain("> <summary>🔒 Integrity filter blocked 1 item</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 1 item**");
expect(result).toContain("[#42](https://github.com/org/repo/issues/42)");
expect(result).toContain("`list_issues`");
expect(result).toContain("Integrity check failed");
Expand All @@ -202,7 +200,7 @@ describe("gateway_difc_filtered.cjs", () => {
const result = generateDifcFilteredSection(events);

expect(result).toContain("> [!NOTE]");
expect(result).toContain("> <summary>🔒 Integrity filter blocked 2 items</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 2 items**");
expect(result).toContain("[#42](https://github.com/org/repo/issues/42)");
expect(result).toContain("[#99](https://github.com/org/repo/issues/99)");
});
Expand Down Expand Up @@ -259,7 +257,7 @@ describe("gateway_difc_filtered.cjs", () => {
const events = [{ type: "DIFC_FILTERED", tool_name: "tool", reason: "reason" }];
const result = generateDifcFilteredSection(events);

expect(result).toContain("blocked because they don't meet");
expect(result).toMatch(/blocked because (it doesn't|they don't) meet/);
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

In this test case the input contains a single event, so the output should always use the singular phrasing ("it doesn't"). Using a regex that allows both singular and plural makes the test permissive and could miss regressions; assert the singular phrase explicitly for this 1-item scenario (and add/keep a separate test that asserts the plural phrasing for 2+ items).

Suggested change
expect(result).toMatch(/blocked because (it doesn't|they don't) meet/);
expect(result).toContain("blocked because it doesn't meet");

Copilot uses AI. Check for mistakes.
expect(result).toContain("GitHub integrity level");
});

Expand Down Expand Up @@ -318,7 +316,7 @@ describe("gateway_difc_filtered.cjs", () => {

const result = generateDifcFilteredSection(events);

expect(result).toContain("> <summary>🔒 Integrity filter blocked 2 items</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 2 items**");
expect(result).toContain("[#42](https://github.com/org/repo/issues/42)");
expect(result).toContain("[#99](https://github.com/org/repo/issues/99)");
});
Expand Down Expand Up @@ -363,7 +361,7 @@ describe("gateway_difc_filtered.cjs", () => {
const result = generateDifcFilteredSection(events);

// Summary still shows the total count
expect(result).toContain("> <summary>🔒 Integrity filter blocked 20 items</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 20 items**");
// First 16 items rendered
expect(result).toContain("[#1](https://github.com/org/repo/issues/1)");
expect(result).toContain("[#16](https://github.com/org/repo/issues/16)");
Expand Down Expand Up @@ -418,7 +416,7 @@ describe("gateway_difc_filtered.cjs", () => {
const result = generateDifcFilteredSection(events);

// Both entries should be shown; #unknown text hidden, tool_name used instead
expect(result).toContain("> <summary>🔒 Integrity filter blocked 2 items</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 2 items**");
expect(result).not.toContain("#unknown");
expect(result).toContain("`search_issues`");
expect(result).toContain("[#42](https://github.com/org/repo/issues/42)");
Expand All @@ -436,7 +434,7 @@ describe("gateway_difc_filtered.cjs", () => {

const result = generateDifcFilteredSection(events);

expect(result).toContain("> <summary>🔒 Integrity filter blocked 1 item</summary>");
expect(result).toContain("> **🔒 Integrity filter blocked 1 item**");
expect(result).toContain("`search_issues`");
expect(result).not.toContain("#unknown");
});
Expand Down
Loading