Skip to content

[jsweep] Clean assign_milestone.cjs#21522

Closed
github-actions[bot] wants to merge 2 commits intomainfrom
jsweep/assign-milestone-cleanup-269978ce62eb94bc
Closed

[jsweep] Clean assign_milestone.cjs#21522
github-actions[bot] wants to merge 2 commits intomainfrom
jsweep/assign-milestone-cleanup-269978ce62eb94bc

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 18, 2026

Summary

Cleaned assign_milestone.cjs (github-script context handler factory) and added temporary ID support.

Changes to assign_milestone.cjs

  • Removed unused HANDLER_TYPE constant — declared but never referenced anywhere in the file
  • Removed unnecessary item aliasconst item = message was dead indirection; now uses message directly (7 occurrences simplified)
  • Moved staged-mode early return before try/catch — the staged path (logStagedPreviewInfo + return) cannot throw, so wrapping it in a try/catch added noise without benefit; it now clearly sits outside the error boundary
  • Added temporary ID support for issue_numberissue_number can now be a temporary ID (aw_* format); unresolved temporary IDs are deferred ({ success: false, deferred: true }) rather than treated as errors

Changes to assign_milestone.test.cjs

Added 11 new test cases (7 → 18 total):

New test What it covers
Staged mode returns preview without calling API GH_AW_SAFE_OUTPUTS_STAGED=true path
Failure when fetching milestones for allowed-list validation Network error during milestone list fetch
Milestone not found in repository Milestone number absent from fetched list
Allowed by number string in allowed list allowed: ["5"] matches milestone #5
Cached milestones — only one fetch on multiple calls listMilestones called exactly once
Zero issue_number is invalid Guards against issue_number: 0
Zero milestone_number is invalid Guards against milestone_number: 0
Resolve temporary ID in issue_number aw_issue1 resolves to real issue number
Defer when issue_number is an unresolved temporary ID Returns deferred: true
Resolve temporary ID with hash prefix #aw_issue1 resolves correctly

Context

  • Execution context: github-script (uses global core, github, context)
  • Pattern: Handler factory — main(config) returns a closure handleAssignMilestone(message, resolvedTemporaryIds)

✅ Validation Checks

  • Formatting: npm run format:cjs
  • Linting: npm run lint:cjs
  • Type checking: npm run typecheck
  • Tests: npm run test:js -- --no-file-parallelism ✓ (assign_milestone.test.cjs: 18/18 passed; pre-existing failures in unrelated infrastructure tests)

Generated by jsweep - JavaScript Unbloater ·

[!WARNING]

  • expires on Mar 20, 2026, 3:22 AM UTC

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Remove unused HANDLER_TYPE constant
- Remove unnecessary 'item' alias (use 'message' directly)
- Move staged-mode early return before try/catch (it cannot throw)
- Add 8 new test cases: staged mode, cached milestones, fetch failure,
  milestone not found, allowed by number string, zero issue/milestone

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot add temporary id support

Copy link
Contributor

Copilot AI commented Mar 18, 2026

@copilot add temporary id support

Added in commit 519d49b. assign_milestone.cjs now resolves issue_number via resolveRepoIssueTarget — supporting aw_* temporary IDs, hash-prefixed variants, and deferring when a temporary ID isn't resolved yet. Three new test cases cover these paths.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js -success ode-gyp-bin/git git show�� --verify --quiet tnet/tools/git --verify --quiet modules/@npmcli/-e git (http block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js Initial commit bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /pre�� 24b517b4a633c3a447baacc53ac10923456af84d..HEAD --stdout 0/x64/bin/node :(exclude)dist/*bash Token option bas--norc ache/uv/0.10.11/--noprofile 0/x64/bin/node (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from pelikhan March 18, 2026 10:30
@pelikhan pelikhan closed this Mar 18, 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.

2 participants