Samba: Normalize stored enabled_shares values to lower case - #4717
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Samba add-on now normalizes stored ChangesEnabled shares normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant init_smbd as init-smbd run
participant SupervisorAPI
participant StoredOptions
init_smbd->>SupervisorAPI: Fetch stored options
SupervisorAPI->>StoredOptions: Read enabled_shares
StoredOptions-->>SupervisorAPI: Return share names
SupervisorAPI-->>init_smbd: Return options
init_smbd->>init_smbd: Lowercase non-normalized names
init_smbd->>SupervisorAPI: POST migration payload
SupervisorAPI->>StoredOptions: Persist normalized options
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
This writes back all options, including the newly introduced Just wanted to point this out for this PR. I'd like to test this PR again before merging, probably later today or tomorrow. |
Summary
Step 1 of the plan agreed in home-assistant/supervisor#7023: prepare
enabled_sharesfor a strictlist()schema by normalizing stored values to lower case at startup. Values have always been validated case-insensitively and lower-cased at runtime before rendering smb.conf, so this changes no behavior — it only persists the canonical form.On startup the app reads its stored options via the Supervisor API and, only when an
enabled_sharesvalue is not already lower case, writes them back lower-cased. On API failure it logs a warning and continues to boot, retrying on the next start.Step 2 (separate, breaking): #4718 switches the schema from
match()tolist(), which also fixes the empty suggestion list in the configuration UI (home-assistant/frontend#51510).Summary by CodeRabbit
New Features
Documentation
Chores