Skip to content

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

Merged
firecow merged 2 commits into
masterfrom
fix/needs-not-array-clear-error
Jun 4, 2026
Merged

fix: reject non-array needs with clear error#1863
firecow merged 2 commits into
masterfrom
fix/needs-not-array-clear-error

Conversation

@firecow

@firecow firecow commented May 20, 2026

Copy link
Copy Markdown
Owner

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 and empty job needs with clear errors. Prevents crashes and aligns with GitLab’s array schema.

  • Bug Fixes
    • Enforce array type for needs in needsEach; add test for string needs.
    • Reject null/empty needs entries; add test for needs: [~].

Written for commit 4648adc. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 3 files

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

Re-trigger cubic

Comment thread src/data-expander.ts
A null array element (e.g. `needs: [~]` or a dangling list dash) crashed
with `TypeError: null is not an object` in needsComplex. Assert each entry
is non-null so it produces a helpful message instead.
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

@firecow
firecow merged commit cc3b886 into master Jun 4, 2026
16 checks passed
@firecow
firecow deleted the fix/needs-not-array-clear-error branch June 4, 2026 06:02
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jul 9, 2026
This MR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [npm:gitlab-ci-local](https://github.com/firecow/gitlab-ci-local) | `4.72.0` → `4.73.0` | ![age](https://developer.mend.io/api/mc/badges/age/npm/gitlab-ci-local/4.73.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/gitlab-ci-local/4.73.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/gitlab-ci-local/4.72.0/4.73.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/gitlab-ci-local/4.72.0/4.73.0?slim=true) |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>firecow/gitlab-ci-local (npm:gitlab-ci-local)</summary>

### [`v4.73.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.73.0)

[Compare Source](firecow/gitlab-ci-local@4.72.0...4.73.0)

#### What's Changed

- fix: prevent ENAMETOOLONG crash for long parallel:matrix job names by [@&#8203;gyanranjan](https://github.com/gyanranjan) in [#&#8203;1865](firecow/gitlab-ci-local#1865)
- fix: reject non-array needs with clear error by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1863](firecow/gitlab-ci-local#1863)
- A support for GPU by [@&#8203;zapadinsky](https://github.com/zapadinsky) in [#&#8203;1866](firecow/gitlab-ci-local#1866)
- fix: validate spec:inputs:regex instead of logging a no-op warning by [@&#8203;ApoorvaMohan](https://github.com/ApoorvaMohan) in [#&#8203;1869](firecow/gitlab-ci-local#1869)
- feat: support image.docker.platform by [@&#8203;inistor](https://github.com/inistor) in [#&#8203;1856](firecow/gitlab-ci-local#1856)
- Allow to use `component.reference`, `component.sha`, `component.version` and `component.name` by [@&#8203;jrd](https://github.com/jrd) in [#&#8203;1836](firecow/gitlab-ci-local#1836)

#### New Contributors

- [@&#8203;zapadinsky](https://github.com/zapadinsky) made their first contribution in [#&#8203;1866](firecow/gitlab-ci-local#1866)
- [@&#8203;ApoorvaMohan](https://github.com/ApoorvaMohan) made their first contribution in [#&#8203;1869](firecow/gitlab-ci-local#1869)
- [@&#8203;jrd](https://github.com/jrd) made their first contribution in [#&#8203;1836](firecow/gitlab-ci-local#1836)

**Full Changelog**: <firecow/gitlab-ci-local@4.72.0...4.73.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
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