Repository navigation
[jsweep] Clean workflow_metadata_helpers.cjs - #76127
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
There was a problem hiding this comment.
What this change does: It adds an optional context override to workflow metadata and tests it. Existing callers continue to use the global context.
Should fix: The override has no production caller, so it adds an unused option and tests to maintain. Remove it until needed.
Verdict: fix 1 first.
Lean: -15 lines possible.
Generated by ✂️ Ponytail Reviewer for #76127 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 181
Comment /ponytail to run again
| * @returns {{workflowName: string, workflowId: string, runId: number, runUrl: string}} Workflow metadata | ||
| */ | ||
| function getWorkflowMetadata(owner, repo) { | ||
| function getWorkflowMetadata(owner, repo, ctx = context) { |
There was a problem hiding this comment.
Should fix: All three production callers use the global context, and the override is used only by the two new tests; remove the unused parameter and those tests until a caller needs it, saving 15 net lines of code to maintain.
There was a problem hiding this comment.
Reviewed the changed helper and tests. The explicit context override preserves existing callers and correctly falls back to the default context; coverage includes custom and missing run IDs. No actionable correctness or regression issues found in the changed lines.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~1 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the injectable context change and its documented fallback behavior.
No open issues 🎉
What changed in this PR
Updates getWorkflowMetadata to accept an optional GitHub Actions context while preserving existing callers that use the global context.
Changes:
- Added an optional
ctxparameter with a globalcontextfallback. - Updated the JSDoc and metadata URL construction.
- Added tests for explicit context overrides and missing
runIdfallback behavior.
| File | Summary |
|---|---|
actions/setup/js/workflow_metadata_helpers.test.cjs |
Covers explicit context handling and default runId behavior. |
actions/setup/js/workflow_metadata_helpers.cjs |
Adds injectable context support while retaining existing behavior. |
Review effort: Lite (auto)
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd. No blocking issues. One design point left as a comment.
📋 Key Themes & Highlights
Key Themes
- Unused seam: the new
ctxparameter has no caller in this PR. All threeclose_expired_*callers still rely on the global default. - Test quality: the two new tests cover the explicit-context path and the missing-
runIdfallback. Both read as specifications.
Positive Highlights
- ✅ Change is additive: existing two-argument callers are unaffected.
- ✅ JSDoc updated to describe the default.
- ✅ Tests assert the full
runUrl, not just therunId.
Verification notes
npm ciinactions/setup/jsfailed on a sandbox TLS error, so the vitest suite was not run here.- I checked the new behaviour with plain Node against the same inputs the two new tests use. All assertions passed.
- Edge case noted: an explicit
nullforctxthrows aTypeError, because the default only applies toundefined. No caller passesnull, so this is low risk.
@copilot please address the review comment above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again
| * @returns {{workflowName: string, workflowId: string, runId: number, runUrl: string}} Workflow metadata | ||
| */ | ||
| function getWorkflowMetadata(owner, repo) { | ||
| function getWorkflowMetadata(owner, repo, ctx = context) { |
There was a problem hiding this comment.
[/codebase-design] The new ctx parameter has no caller in this PR, and its default still reads the implicit global, so the coupling is moved into a default argument rather than removed. Either pass context explicitly from the three close_expired_* callers, or reword the PR description to present this as an injection seam.
💡 Suggested call-site change
const { workflowName, workflowId, runUrl } = getWorkflowMetadata(owner, repo, context);This makes the dependency visible at each call site and gives the new parameter a real consumer. Existing two-argument calls keep working through the default, so the change stays additive.
@copilot please address this.
|
🎉 This pull request is included in a new release. Release: |
jsweep: workflow_metadata_helpers.cjs
Context: github-script
Changes
getWorkflowMetadatanow accepts an optionalctxparameter (defaults to globalcontext) instead of reading the implicit global directly; JSDoc updated. Existing callers unchanged.Tests
Validation
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npm run test:jsshows failures only in unrelatedupload_assets.test.cjs.