Skip to content

[Repo Assist] fix: null source raises ArgumentNullException for insertAt, removeAt, updateAt#360

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-null-checks-insertAt-removeAt-updateAt-e5494698cb332bdb
Draft

[Repo Assist] fix: null source raises ArgumentNullException for insertAt, removeAt, updateAt#360
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-null-checks-insertAt-removeAt-updateAt-e5494698cb332bdb

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated pull request from Repo Assist.

Summary

Five functions in the library (insertAt, insertManyAt, removeAt, removeManyAt, updateAt) were missing a checkNonNull guard on the source parameter. Passing null would cause a NullReferenceException buried in the taskSeq builder rather than an ArgumentNullException at the call site — inconsistent with every other function in the module.

insertManyAt also failed to validate its values argument, which would similarly throw a confusing NullReferenceException on enumeration.

Root cause

The five internal helpers (insertAt, removeAt, removeManyAt, updateAt) were added with raiseCannotBeNegative for the index parameter but without the corresponding checkNonNull that is present on all other source-consuming functions.

Fix

Add checkNonNull (nameof source) source (and checkNonNull "values" values for the Many case of insertAt) before the lazy taskSeq { … } block in each affected function in TaskSeqInternal.fs. No logic changes.

New tests

  • TaskSeq.InsertAt.Tests.fs: 2 new null-arg tests (Null source is invalid, Null values argument is invalid for insertManyAt)
  • TaskSeq.RemoveAt.Tests.fs: 1 new null-arg test covering both removeAt and removeManyAt
  • TaskSeq.UpdateAt.Tests.fs: 1 new null-arg test

Test Status

Build: ✅ succeeded (0 warnings, 0 errors)
Tests: ✅ 5017 passed, 2 skipped (infrastructure), 0 failed
Format: ✅ dotnet fantomas . --check passes

Branch: repo-assist/fix-null-checks-insertAt-removeAt-updateAt

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@d1d884596e62351dd652ae78465885dd32f0dd7d

… updateAt

Previously, passing null to TaskSeq.insertAt, insertManyAt, removeAt,
removeManyAt, and updateAt would throw a NullReferenceException from deep
within the taskSeq builder, inconsistent with every other function in the
library which eagerly raises ArgumentNullException via checkNonNull.

- Add checkNonNull (nameof source) source to insertAt, removeAt, removeManyAt, updateAt
- Add checkNonNull "values" values to insertAt when called with Many (insertManyAt)
- Add null-source tests to TaskSeq.InsertAt, RemoveAt, UpdateAt test files
- 5017 tests pass (4 new null-arg tests added)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation bug Something isn't working repo-assist labels Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation bug Something isn't working repo-assist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants