fix: autosave, cell name overflow, length validation, apply-and-verify tests
Autosave on Apply (was broken):
- App.jsx called useDraftConfig() in the same component that rendered
DraftConfigProvider — a component cannot consume context it provides.
Fixed by splitting into AppCore (consumes context, all logic) and App
(thin shell that wraps AppCore in DraftConfigProvider). The hook now
runs inside the provider and hasDirty()/flushAll() work correctly.
Cell name / domain length validation (255-char DNS standard):
- api/app.py: reject cell_name or domain > 255 chars or empty with 400
- api/app.py: reject ip_range without CIDR prefix (bare IPs shift all VIPs)
- webui/src/pages/Settings.jsx: cellNameError + domainError computed values
block saveIdentity and show inline error; maxLength={255} on inputs
- tests/test_identity_validation.py: 8 unit tests for the new validation
Cell name overflow on all pages:
- Dashboard.jsx: add min-w-0 to flex child div + truncate + title on cell_name
- CellNetwork.jsx: min-w-0 + truncate + title on cell_name, domain, endpoint,
vpn_subnet in invite cards and connected-cells list
Apply-and-verify integration tests:
- tests/integration/test_apply_propagation.py: TestPendingState (no restarts)
and TestApplyAndVerify (triggers real container restart + health poll)
covering the full save → apply → wait → verify propagation lifecycle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
@@ -438,6 +438,22 @@ def update_config():
|
||||
identity_keys = {'cell_name', 'domain', 'ip_range', 'wireguard_port'}
|
||||
identity_updates = {k: v for k, v in data.items() if k in identity_keys}
|
||||
|
||||
# Validate cell_name — must be non-empty and at most 255 characters (DNS limit)
|
||||
if 'cell_name' in identity_updates:
|
||||
v = str(identity_updates['cell_name'])
|
||||
if len(v) > 255:
|
||||
return jsonify({'error': 'cell_name must be 255 characters or fewer'}), 400
|
||||
if not v:
|
||||
return jsonify({'error': 'cell_name cannot be empty'}), 400
|
||||
|
||||
# Validate domain — must be non-empty and at most 255 characters (DNS limit)
|
||||
if 'domain' in identity_updates:
|
||||
v = str(identity_updates['domain'])
|
||||
if len(v) > 255:
|
||||
return jsonify({'error': 'domain must be 255 characters or fewer'}), 400
|
||||
if not v:
|
||||
return jsonify({'error': 'domain cannot be empty'}), 400
|
||||
|
||||
# Validate ip_range — must be a valid CIDR within an RFC-1918 range
|
||||
if 'ip_range' in identity_updates:
|
||||
import ipaddress as _ipa
|
||||
|
||||
Reference in New Issue
Block a user