[grade=C urn:ump:meylbfvzagdtgff4oapeyqkvjmletbb6q7iul5suvwcw5gq66wxa] fix(ux): invalid explicit DNS ports are REJECTED, not silently defaulted

Deploy judge r1 (dc-prod-deploy-dns2-full, grade C) blocked on the
serialiser silently replacing an invalid explicit port (9090junk/0/-1/
70000) with the provider default — pointing the adapter at the wrong
service instead of reporting the user's typo. Now: empty field →
provider default (legitimate); invalid EXPLICIT value → buildDnsConfig
throws with an actionable message; the wizard surfaces it via
showNotification and aborts the save. Tests flipped to pin the
reject-not-fallback contract (throw + empty-field default preserved).
This commit is contained in:
Hermes committed 2026-11-19 13:21:25 -08:00
1 parent 9cff937e7c
commit 3d6856a795
5 files changed
+146 -129

No files matched your search

+28 -15
View File
@@ -77,13 +77,19 @@ window.populateTimezoneSelect = function(selectEl, selectedTz) {
const tld = document.getElementById('setup-tld')?.value?.trim() || '.home';
const caName = document.getElementById('setup-ca-name')?.value?.trim() || '';
const dnsIP = document.getElementById('setup-dns-ip')?.value?.trim() || '';
const dnsPort = DnsProviderConfig.buildDnsConfig(
document.getElementById('setup-dns-provider')?.value || 'technitium',
dnsIP,
document.getElementById('setup-dns-port')?.value?.trim() || '',
'',
DC.DEFAULTS.DNS_PORT,
).port;
const dnsPort = (() => {
try {
return DnsProviderConfig.buildDnsConfig(
document.getElementById('setup-dns-provider')?.value || 'technitium',
dnsIP,
document.getElementById('setup-dns-port')?.value?.trim() || '',
'',
DC.DEFAULTS.DNS_PORT,
).port;
} catch (e) {
return document.getElementById('setup-dns-port')?.value?.trim() || DC.DEFAULTS.DNS_PORT;
}
})();
html += `
<div>
@@ -184,14 +190,21 @@ window.populateTimezoneSelect = function(selectEl, selectedTz) {
// Serialisation extracted to js/dns-provider-config.js (shared with
// the backend parity tests) so the wizard→builder mapping is the
// exact code the tests exercise: per-provider port defaults and
// provider-specific field aliases live there.
config.dns = DnsProviderConfig.buildDnsConfig(
selectedProvider,
document.getElementById('setup-dns-ip')?.value?.trim() || '',
document.getElementById('setup-dns-port')?.value?.trim() || '',
document.getElementById('setup-dns-token')?.value?.trim() || '',
DC.DEFAULTS.DNS_PORT,
);
// provider-specific field aliases live there. An invalid explicit
// port THROWS — surface it and abort the save (never silently
// substitute a default that would point at the wrong service).
try {
config.dns = DnsProviderConfig.buildDnsConfig(
selectedProvider,
document.getElementById('setup-dns-ip')?.value?.trim() || '',
document.getElementById('setup-dns-port')?.value?.trim() || '',
document.getElementById('setup-dns-token')?.value?.trim() || '',
DC.DEFAULTS.DNS_PORT,
);
} catch (e) {
showNotification(e.message, 'error', 6000);
return;
}
config.defaults = {
dnsType: 'private',
sslType: 'internal',