Skip to content

Add host name template types, activity, and validation#48699

Merged
juan-fdz-hawa merged 3 commits into
38806-macos-iosipados-rename-hostsfrom
48621-rename-hosts-config-types-template-validation-and-activity-type
Jul 6, 2026
Merged

Add host name template types, activity, and validation#48699
juan-fdz-hawa merged 3 commits into
38806-macos-iosipados-rename-hostsfrom
48621-rename-hosts-config-types-template-validation-and-activity-type

Conversation

@juan-fdz-hawa

@juan-fdz-hawa juan-fdz-hawa commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Related issue: Relates to #48621

  • Add name_template to TeamMDM, TeamSpecMDM and TeamPayloadMDM.
  • Add the edited_host_name_template activity type.
  • Add ValidateHostNameTemplate and ResolveHostNameTemplate in server/fleet/name_template.go.

Checklist for submitter

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

Testing

  • Added/updated automated tests

Summary by CodeRabbit

  • New Features

    • Added support for setting a host display name template for fleet-managed devices.
    • Host name templates now accept approved variables and can be previewed from host data.
  • Bug Fixes

    • Improved validation to reject invalid, empty, overlong, or unsafe templates.
    • Clearing a template is now handled cleanly and shown correctly in activity history.

@juan-fdz-hawa

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 4722bd20-9997-4a9d-ae0c-3e429543deeb

📥 Commits

Reviewing files that changed from the base of the PR and between 5fc14b8 and f8213c0.

📒 Files selected for processing (6)
  • server/fleet/activities.go
  • server/fleet/name_template.go
  • server/fleet/name_template_test.go
  • server/fleet/teams.go
  • server/fleet/teams_test.go
  • tools/dibble/pkg/seed/activities.go

Walkthrough

This PR adds host name template functionality to Fleet. It introduces ValidateHostNameTemplate and ResolveHostNameTemplate functions supporting a restricted set of $FLEET_VAR_HOST_* variables, a new ActivityTypeEditedHostNameTemplate activity type, and NameTemplate fields on TeamPayloadMDM, TeamMDM, and TeamSpecMDM structs using optjson.String where distinguishing "clear" from "unset" matters. Unit tests cover validation, resolution, JSON round-tripping, and activity marshaling. The dibble seed tool is updated to include the new activity template.

Sequence Diagram(s)

Not applicable — this PR primarily adds data validation/resolution logic and type definitions rather than a new interactive request/response flow.

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the issue and testing, but omits most template checklist items and doesn't mark non-applicable sections. Fill in or remove each template section as applicable, especially changes files, validation, testing details, migrations, and GitOps/config-setting checks.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change set.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 48621-rename-hosts-config-types-template-validation-and-activity-type

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.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (38806-macos-iosipados-rename-hosts@5fc14b8). Learn more about missing BASE report.

Additional details and impacted files
@@                          Coverage Diff                          @@
##             38806-macos-iosipados-rename-hosts   #48699   +/-   ##
=====================================================================
  Coverage                                      ?   67.99%           
=====================================================================
  Files                                         ?     3680           
  Lines                                         ?   233873           
  Branches                                      ?    12268           
=====================================================================
  Hits                                          ?   159025           
  Misses                                        ?    60518           
  Partials                                      ?    14330           
Flag Coverage Δ
backend 69.64% <100.00%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.

Relates to #48621

- Add name_template to TeamMDM, TeamSpecMDM and TeamPayloadMDM.
- Add the edited_host_name_template activity type.
- Add ValidateHostNameTemplate and ResolveHostNameTemplate in
server/fleet/name_template.go.
@juan-fdz-hawa juan-fdz-hawa force-pushed the 48621-rename-hosts-config-types-template-validation-and-activity-type branch from f8213c0 to 45eb941 Compare July 3, 2026 16:43
@juan-fdz-hawa juan-fdz-hawa marked this pull request as ready for review July 3, 2026 16:43
@juan-fdz-hawa juan-fdz-hawa requested a review from a team as a code owner July 3, 2026 16:43

@claude claude Bot left a comment

Copy link
Copy Markdown

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.

@lucasmrod lucasmrod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Left two comments/questions.

Comment thread server/fleet/activities.go Outdated
Comment thread server/fleet/name_template.go Outdated
@juan-fdz-hawa juan-fdz-hawa merged commit b89bc70 into 38806-macos-iosipados-rename-hosts Jul 6, 2026
20 of 23 checks passed
@juan-fdz-hawa juan-fdz-hawa deleted the 48621-rename-hosts-config-types-template-validation-and-activity-type branch July 6, 2026 11:36
@juan-fdz-hawa juan-fdz-hawa restored the 48621-rename-hosts-config-types-template-validation-and-activity-type branch July 6, 2026 12:21
@juan-fdz-hawa juan-fdz-hawa deleted the 48621-rename-hosts-config-types-template-validation-and-activity-type branch July 6, 2026 12:23
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.

Rename hosts: config types, template validation, and activity type

2 participants