Skip to content

Reject null name on POST /packs (#43032) - #45259

Merged
juan-fdz-hawa merged 1 commit into
mainfrom
43032-post-packs-accepts-null-name-creating-a-pack-with-empty-string-name
May 13, 2026
Merged

juan-fdz-hawa merged 1 commit into
mainfrom
43032-post-packs-accepts-null-name-creating-a-pack-with-empty-string-name

Conversation

@juan-fdz-hawa

@juan-fdz-hawa juan-fdz-hawa commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Related issue: Fixes #43032

Added a nil-check in NewPack so a missing/null name returns the same BadRequestError as an empty-string name.

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • Bug Fixes
    • The POST /packs endpoint now properly rejects requests with null pack names, returning a 400 Bad Request error with clear validation messaging instead of silently creating packs with empty names. This improves data integrity by aligning null-name handling with existing empty-string validation behavior.

Review Change Stack

Fixes #43032

Added a nil-check in NewPack so a missing/null name returns the same
BadRequestError as an empty-string name.
@juan-fdz-hawa
juan-fdz-hawa requested a review from a team as a code owner May 12, 2026 17:11

@claude claude 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b40b09ba-eaa6-423f-a0e3-3aec45ca30d4

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5fae6 and 81ed9a0.

📒 Files selected for processing (4)
  • changes/43032-post-packs-null-name
  • server/service/integration_core_test.go
  • server/service/packs.go
  • server/service/packs_test.go

Walkthrough

This PR fixes a validation bug where POST /packs accepted JSON null for the pack name field and created packs with empty names instead of rejecting the request. The fix adds an explicit nil check in the NewPack service method to reject null names with HTTP 400, aligning the behavior with existing empty-string validation. Unit and integration tests were added to verify the fix works at both the service and API levels.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: rejecting null names on the POST /packs endpoint, directly addressing issue #43032.
Description check ✅ Passed The PR description adequately covers the change, references the issue #43032, notes that a changes file was added, and indicates testing was completed and manual QA was performed.
Linked Issues check ✅ Passed The changes fully address issue #43032: a nil-check was added to NewPack to return BadRequestError when Name is nil, matching empty-string validation behavior, with test coverage added.
Out of Scope Changes check ✅ Passed All changes are scoped to the pack creation validation logic: changes file, NewPack nil-check, integration test, and unit test—all directly related to issue #43032.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 43032-post-packs-accepts-null-name-creating-a-pack-with-empty-string-name

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.86%. Comparing base (81bc4a3) to head (81ed9a0).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45259      +/-   ##
==========================================
+ Coverage   66.81%   66.86%   +0.05%     
==========================================
  Files        2724     2724              
  Lines      219027   219087      +60     
  Branches    10754    10754              
==========================================
+ Hits       146342   146501     +159     
+ Misses      59519    59421      -98     
+ Partials    13166    13165       -1     
Flag Coverage Δ
backend 68.74% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juan-fdz-hawa

Copy link
Copy Markdown
Contributor Author

Failures unrelated to changes

@juan-fdz-hawa
juan-fdz-hawa merged commit 8228f50 into main May 13, 2026
55 of 56 checks passed
@juan-fdz-hawa
juan-fdz-hawa deleted the 43032-post-packs-accepts-null-name-creating-a-pack-with-empty-string-name branch May 13, 2026 11:24

This branch was previously deployed

1 inactive deployment
Docker Hub — 81ed9a0e Deployed May 12, 2026 by juan-fdz-hawa via publish #88668
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.

POST /packs accepts null name, creating a pack with empty string name

2 participants