Skip to content

[jsweep] Clean update_work_item.cjs - #66772

Closed
github-actions[bot] wants to merge 3 commits into
mainfrom
signed/jsweep/clean-update-work-item-09ffbf59d471c611
Closed

github-actions[bot] wants to merge 3 commits into
mainfrom
signed/jsweep/clean-update-work-item-09ffbf59d471c611

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

jsweep: update_work_item.cjs

Context: Node.js / github-script safe-output handler (thin wrapper over azure_devops_work_items.cjs).

Changes

  • Added JSDoc and spacing; @ts-check was already enabled (no @ts-nocheck to remove). Logic unchanged.
  • Added new update_work_item.test.cjs with 6 tests (handler creation, default config, disabled-field rejection, area-path rejection, staged mode makes no API calls, input message not mutated).

Validation

  • Formatting: npm run format:cjs ✓
  • Linting: npm run lint:cjs ✓
  • Type checking: npm run typecheck ✓
  • Tests: targeted vitest run (new tests + azure_devops_work_items) ✓ 17/17

Generated by 🧹 jsweep - JavaScript Unbloater · copilot · auto · 19.2 AIC · ⌖ 0.875 AIC · ⊞ 11.5K · ◷

  • expires on Oct 9, 2026, 8:00 PM UTC-08:00

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 8, 2026 04:23
Copilot AI balanced review requested due to automatic review settings October 8, 2026 04:23
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #66772

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR #66772 does not have the 'implementation' label (has_implementation_label=false) and has 0 new lines in business logic directories (threshold 100, no custom .design-gate.yml). Only 2 files changed.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions github-actions Bot left a comment

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.

L15: delete: duplicate default-config handler type assertion. The preceding test already proves main() returns a handler; nothing replaces it.

net: -4 lines possible.

Generated by ✂️ Ponytail Reviewer for #66772 · codex · gpt56 · 7.9 AIC · ⌖ 6.36 AIC · ⊞ 13.4K
Comment /ponytail to run again

it("returns a handler function", async () => {
expect(typeof (await main())).toBe("function");
});

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.

L15: delete: duplicate default-config handler type assertion. The preceding test already proves main() returns a handler; nothing replaces it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed the redundant default-config test; the remaining smoke test covers handler creation, and a focused assertion checks update-specific wiring. Included in 6fb14cf.

@github-actions github-actions Bot left a comment

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.

Impeccable review (distill, extract modes) — refactor/cleanup change: JSDoc additions + a new, well-structured test file for update_work_item.cjs. Logic is unchanged.

No high-signal issues found:

  • JSDoc is accurate and concise.
  • New tests (6/6 passing) cover handler creation, default config, disabled-field rejection, area-path filtering, staged-mode no-op behavior, and input immutability — good coverage for a thin wrapper.
  • No complexity to distill or reusable patterns to extract beyond what already exists in azure_devops_work_items.cjs.

Approving.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 17.7 AIC · ⌖ 13 AIC · ⊞ 8.1K

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-08T04:26:03Z
review_event: REQUEST_CHANGES
top_themes:
  - test isolation leakage from mocked global.fetch
  - duplicate shared-handler coverage in wrapper-specific test
files_reviewed:
  - actions/setup/js/update_work_item.cjs
  - actions/setup/js/update_work_item.test.cjs
  - actions/setup/js/azure_devops_work_items.cjs
  - actions/setup/js/azure_devops_work_items.test.cjs
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 40.2 AIC · ⌖ 5.51 AIC · ⊞ 19.8K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

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.

Blocking issues

The new wrapper test leaves global.fetch mocked across suite boundaries, and it repeats shared-handler assertions instead of focusing on wrapper-specific coverage.

Review themes
  • Cross-suite test isolation is broken because global.fetch is never restored.
  • The new cases largely duplicate azure_devops_work_items.test.cjs, so maintenance cost increases without materially improving confidence in update_work_item.cjs.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 40.2 AIC · ⌖ 5.51 AIC · ⊞ 19.8K
Comment /review to run again

describe("update_work_item", () => {
beforeEach(() => {
vi.clearAllMocks();
global.fetch = vi.fn();

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.

global.fetch is installed in beforeEach but never restored, so this file can leak a mocked network layer into later suites and make unrelated tests pass or fail for the wrong reason.

💡 Restore the global after each test

The existing shared-handler suite already deletes global.fetch in afterEach, and this wrapper test needs the same isolation. Without that cleanup, any later test file that forgets to stub fetch will silently run against this leftover mock instead of the real environment.

afterEach(() => {
  delete global.fetch;
});

That keeps this file self-contained and avoids cross-suite state pollution in CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added afterEach cleanup to delete the mocked global.fetch after every test. Included in 6fb14cf.

@github-actions github-actions Bot left a comment

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.

Skills-Based Review 🧠

Applied /codebase-design and /tdd — small, non-blocking suggestions only.

📋 Key Themes & Highlights

Key Themes

  • JSDoc consistency: the new JSDoc on update_work_item.cjs doesn't use the established HandlerFactoryFunction typedef that ~45 other safe-output handlers already share — worth aligning before this pattern gets copy-pasted into sibling ado_* wrappers.
  • Test overlap: the new update_work_item.test.cjs suite duplicates validation scenarios already covered by azure_devops_work_items.test.cjs rather than focusing on the wrapper's unique responsibility (type-string delegation).

Positive Highlights

  • ✅ Logic is genuinely unchanged — this is a safe, low-risk documentation/spacing cleanup.
  • ✅ New tests correctly verify staged-mode no-API-calls and input-immutability, both good regression guards for a handler that mutates fields in place elsewhere in the module.
  • ✅ No behavior regressions found in the diff.

Note: pr-triage agent ran successfully and classified this as tests_only change — no fallback heuristic needed.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 59.7 AIC · ⌖ 14.6 AIC · ⊞ 10.1K
Comment /matt to run again

*/
async function main(config = {}) {
return createAzureDevOpsWorkItemHandler("ado_update_work_item", config);
}

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.

[/codebase-design] New JSDoc uses ad-hoc @param {Object} / @returns {Promise<Function>} instead of the established @type {HandlerFactoryFunction} typedef that ~45 other safe-output handlers (e.g. noop_handler.cjs, add_comment.cjs) already use for this exact factory shape.

💡 Suggested fix
// @ts-check
const { createAzureDevOpsWorkItemHandler } = require("./azure_devops_work_items.cjs");

/**
 * @typedef {import('./types/handler-factory').HandlerFactoryFunction} HandlerFactoryFunction
 */

/**
 * Creates the Azure DevOps update work item safe-output handler.
 * @type {HandlerFactoryFunction}
 */
async function main(config = {}) {
  return createAzureDevOpsWorkItemHandler("ado_update_work_item", config);
}

module.exports = { main };

Since this is the first ado_* wrapper to gain JSDoc, this pattern risks being copy-pasted into the other four sibling wrappers (create_work_item.cjs, assign_work_item.cjs, comment_on_work_item.cjs, link_work_items.cjs) by future jsweep runs, diverging from the codebase's shared vocabulary for handler factories and losing the stronger typing (HandlerConfig, MessageHandlerFunction) that the typedef provides.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated the wrapper JSDoc to use the shared HandlerFactoryFunction typedef. Included in 6fb14cf.

it("works with default config", async () => {
const handler = await main(undefined);
expect(typeof handler).toBe("function");
});

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.

[/tdd] Good coverage of the wrapper's thin-pass-through contract, but these 6 tests duplicate behavior already exercised in azure_devops_work_items.test.cjs (field rejection, area-path rejection use near-identical fixtures) without adding tests for behavior unique to this wrapper, e.g. that main() correctly forwards the "ado_update_work_item" type string vs. another type.

💡 Suggestion

Consider either: (a) trimming this file to just the handler-creation/default-config smoke tests (2 tests) since the validation logic is already fully covered in azure_devops_work_items.test.cjs, or (b) adding one assertion that proves type-specific wiring, e.g. asserting the error message explicitly references ado_update_work_item (which test 3 already does) and is not reused verbatim from another handler's config. As-is, 4 of the 6 tests re-verify handleUpdateWorkItem internals rather than the main() wrapper's own responsibility (delegating to the correct handler type), so a bug in the wrapper's type string wouldn't be caught by tests that only check validation errors.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Trimmed duplicated shared-handler cases and focused wrapper coverage on its configured handler type and input immutability. Included in 6fb14cf.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The input-mutation test does not exercise any code path that mutates the working message.

1 open finding
What changed in this PR

Adds documentation and targeted tests for the Azure DevOps work-item update wrapper.

Changes:

  • Documents the handler factory.
  • Adds six wrapper-focused tests.
File Description
actions/​setup/​js/​update_work_item.cjs Adds JSDoc without changing behavior.
actions/​setup/​js/​update_work_item.test.cjs Adds handler and validation tests.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment on lines +44 to +47
const handler = await main({ staged: true, target: "*", title: true });
const message = { id: 42, title: "T" };
await handler(message, {});
expect(message).toEqual({ id: 42, title: "T" });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated the regression test to pass body with a configured footer and verify the handler succeeds without mutating the caller's message. Included in 6fb14cf.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/update_work_item.test.cjs:47): This test does not exercise a branch that mutates the handler's working message: title is only read, so the assertion would still pass if the wrapper stopped cloning and leaked mutations to callers. Use body with a configured footer (or another normalized field) so the test fails when the clone is removed. - [jsweep] Clean update_work_item.cjs #66772 (comment)
  3. Fix failing check JS Tests (shard 4/4) (FAILURE): https://github.com/github/gh-aw/actions/runs/37725451853/job/113148175041.

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: f32621f
Sous-chef work: 31f7e812d45f0792093269b7b90445aa9803225a204ec130694b9ceb0227d7cc e32f63616b28fafa3cdfe78396dbedc55227de4547212483dcf6a4ee4989c9a8
Sous-chef state: ee9763e82799747755d5d1689222c08249d9d28ce9e0f1e87c2409ab5543ce2d

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 3.1 AIC · ⌖ 11.1 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 8, 2026 05:05
…pdate-work-item-09ffbf59d471c611

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 8, 2026 05:31
@pelikhan pelikhan closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants