Skip to content

fix: reject non-array needs with clear error#1863

Open
firecow wants to merge 1 commit into
masterfrom
fix/needs-not-array-clear-error
Open

fix: reject non-array needs with clear error#1863
firecow wants to merge 1 commit into
masterfrom
fix/needs-not-array-clear-error

Conversation

@firecow
Copy link
Copy Markdown
Owner

@firecow firecow commented May 20, 2026

Summary

  • needs: build (scalar string instead of a list) crashed with TypeError: Attempted to assign to readonly property in needsEach because Object.entries iterated the string's characters and assignment to string indices is read-only.
  • Now asserts needs is an array up front, matching the upstream GitLab schema (top-level needs is "type": "array").

Test plan

  • bunx vitest run tests/test-cases/needs-not-array/ passes
  • Existing needs-* tests still pass

Summary by cubic

Reject non-array job needs with a clear error. Prevents a crash when a string is used and aligns with GitLab’s array schema.

  • Bug Fixes
    • Assert array type in needsEach to replace the prior TypeError with a helpful message.
    • Add integration test case to verify rejection and error text.

Written for commit 4739609. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/data-expander.ts
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant