Skip to content

build: guard against a null .type field - #15590

Merged
kgryte merged 3 commits into
developfrom
philipp/ci-fix-process-metadata-jq-type-2026-09-27
Sep 27, 2026
Merged

kgryte merged 3 commits into
developfrom
philipp/ci-fix-process-metadata-jq-type-2026-09-27

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Fixes a jq crash in the process_metadata workflow's "Check metadata for workflow dispatch directives" step.

Failing run: https://github.com/stdlib-js/stdlib/actions/runs/36308648844 (process_metadata / "Process Metadata"), triggered by an issue_comment event.

The step fails with:

jq: error (at <stdin>:1): null (null) and string ("workflow_d...) cannot have their containment checked

and exits 5.

The step runs jq -c '.[] | select(.type | contains("workflow_dispatch"))' against metadata from stdlib-js/metadata-action. When that action can't extract a recognized metadata block from an ordinary PR comment, it emits an entry with no type key. .type evaluates to null, and piping null into contains() throws rather than evaluating to a non-match. This step runs on every issue_comment (created/edited) from a write-access user, so any ordinary comment reproduces the failure.

Fix: null-coalesce .type before the contains check — select((.type // "") | contains("workflow_dispatch")). Matching behavior for entries with a type is unchanged; a missing/null type is now a non-match instead of a crash.

Related Issues

Does this pull request have any related issues?

This pull request has no related issues.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

1 file changed, 1 line (.github/workflows/process_metadata.yml).

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was investigated, written, and validated by an automated Claude Code CI-monitoring routine, including root-cause investigation and independent multi-reviewer validation of the fix.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz


Generated by Claude Code

The job `Process Metadata` (issue_comment trigger) failed on develop
with `jq: error ... null (null) and string ("workflow_d...) cannot
have their containment checked`, exit code 5.

Root cause: the "Check metadata for workflow dispatch directives" step
runs `jq -c '.[] | select(.type | contains("workflow_dispatch"))'`
against the output of `stdlib-js/metadata-action`. When that action
cannot extract a recognized metadata block from a plain PR comment, it
emits an entry with no `type` key at all, so `.type` is `null`, and
piping `null` into `contains()` is a jq type error rather than a
non-match. Since this workflow runs on every `issue_comment` event
from a write-access user, an ordinary comment reliably reproduces this.

This commit null-coalesces `.type` to an empty string before the
`contains` check, so a missing/null type is treated as a non-match
instead of crashing the step, while preserving the existing matching
behavior for entries that do carry a `type`.

Ref: https://github.com/stdlib-js/stdlib/actions/runs/36308648844

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
@kgryte kgryte added Tools Issue or pull request related to project tooling. CI Issue or pull request specific to continuous integration environments. labels Sep 27, 2026
Comment thread .github/workflows/process_metadata.yml
@kgryte
kgryte marked this pull request as ready for review September 27, 2026 22:10
@kgryte
kgryte requested a review from a team September 27, 2026 22:10
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 27, 2026
Adds a comment explaining why the null-coalesce is needed, per
@kgryte's review request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
Comment thread .github/workflows/process_metadata.yml Outdated
@kgryte's request was for an explanation of the change, not a code
comment; the explanation was given inline on the PR instead. Reverts
to the one-line fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
@kgryte kgryte changed the title build(workflows): guard process_metadata against a null .type field build: guard against a null .type field Sep 27, 2026
@kgryte
kgryte merged commit d7c4ea0 into develop Sep 27, 2026
9 checks passed
@kgryte
kgryte deleted the philipp/ci-fix-process-metadata-jq-type-2026-09-27 branch September 27, 2026 22:18
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Issue or pull request specific to continuous integration environments. Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants