Skip to content

Samba: Restrict enabled_shares schema to list() of share names#4718

Open
kingpanther13 wants to merge 4 commits into
home-assistant:masterfrom
kingpanther13:samba-enabled-shares-list-schema
Open

Samba: Restrict enabled_shares schema to list() of share names#4718
kingpanther13 wants to merge 4 commits into
home-assistant:masterfrom
kingpanther13:samba-enabled-shares-list-schema

Conversation

@kingpanther13

@kingpanther13 kingpanther13 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Step 2 of the plan from home-assistant/supervisor#7023: switch enabled_shares from match(^(?i:(...))$) to list(addons|addon_configs|backup|config|media|share|ssl). The configuration UI then offers the valid share names as a populated multi-select instead of an empty free-text suggestion list, resolving home-assistant/frontend#51510.

BREAKING: values must be exactly lower case. Configs saved on 12.7.2+ (#4717) were migrated automatically; older configs with non-lower-case values fail validation with a clear message. The step-1 startup migration and the runtime lower-casing are removed as dead code.

Stacked on #4717 (the diff includes it until that PR merges). Opened as a draft so maintainers can schedule/bundle it with other breaking changes (e.g. the NetBIOS default change mentioned in the supervisor discussion).

Summary by CodeRabbit

  • Breaking Changes

    • Enabled share names must now be entered in lowercase.
    • Existing configurations saved on version 12.8.1 or later are migrated automatically.
    • Older configurations with uppercase share names may fail validation and require the shares to be selected again.
  • Documentation

    • Simplified the enabled shares label and instructions.
    • Updated release information for version 13.0.0.

Update (2026-07-15): #4717 merged; the step-1 migration shipped as 12.8.1 (the 12.7.2 references above predate the renumbering). This PR is no longer stacked — the diff is step 2 only, rebased on current master. Configs saved on 12.8.1 or later were migrated automatically; older configs with non-lower-case values fail validation with a clear message. The 12.8.1 startup migration and the runtime lower-casing are removed as dead code: with the strict schema, validation rejects a non-migrated config before the add-on can start, so the migration could never run when it was needed.

kingpanther13 and others added 2 commits July 11, 2026 08:07
Values have always been validated case-insensitively and lower-cased at
runtime before rendering smb.conf. Persisting the canonical lower-case
form prepares for a future release that restricts the schema to the
exact share names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The configuration UI offers the share names as a multi-select instead
of an empty free-text suggestion list. Values must now be lower case;
12.7.2 migrated stored configs automatically. The startup migration and
runtime lower-casing are removed as dead code.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With the list() schema the Supervisor rejects non-lower-case values
before the add-on starts, so the startup migration from 12.8.1 can
never run against a config that needs it.
@kingpanther13
kingpanther13 marked this pull request as ready for review July 15, 2026 20:39
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The Samba add-on version advances to 13.0.0, enabled_shares accepts an explicit lower-case allowlist, and startup/runtime lowercasing logic is removed. Changelog and English configuration text are updated accordingly.

Changes

Enabled shares validation

Layer / File(s) Summary
Explicit enabled shares schema
samba/config.yaml, samba/CHANGELOG.md, samba/translations/en.yaml
The add-on version is set to 13.0.0, enabled_shares uses an explicit allowlist, and related release and configuration text is updated.
Remove runtime normalization
samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run
Startup persistence migration and jq-based lowercasing during smb.conf generation are removed.

Estimated code review effort: 3 (Moderate) | ~15 minutes

Possibly related PRs

Suggested reviewers: atx32, madbrain76

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: tightening enabled_shares to an explicit list of share names.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@samba/CHANGELOG.md`:
- Around line 7-9: Update the migration version reference in the changelog entry
from 12.8.1 to 12.7.2, preserving the surrounding explanation that
configurations from that version onward migrate automatically.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7ec7f75b-7aaf-4527-ae81-0c8bf03742d5

📥 Commits

Reviewing files that changed from the base of the PR and between 4afd6cb and df4c191.

📒 Files selected for processing (4)
  • samba/CHANGELOG.md
  • samba/config.yaml
  • samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run
  • samba/translations/en.yaml
💤 Files with no reviewable changes (1)
  • samba/rootfs/etc/s6-overlay/s6-rc.d/init-smbd/run

Comment thread samba/CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant