- wget: remove -t flag incompatible with BusyBox 25.12+, add curl-first fallback in download_to_file() with wget as fallback - startup/reload speedup (5 improvements): - cut sing-box verification timeout from 45 iterations to 15 - remove redundant second stability wait for sing-box process - batch requirement check + runtime validation into single ucode fork - replace dnsmasq full restart with procd reload (config-conditional bounce) - move telegram and watchdog runtime start to background - telegram: fix "API failure" spam - empty result[] from getUpdates is now treated as a successful idle poll, not an error that triggers backoff - watchdog SmartDetect: extract domain from proxy and VPN URLs for DNS health check, use real domains (google.com/example.com) instead of provider-specific endpoints that trigger false alerts - tests: new invariants for wget -t prohibition, telegram empty-result handling, DNS apply reload-vs-restart, and combined validation mode ownership
66 lines
3.2 KiB
Bash
66 lines
3.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
TACHYON_FILES="$ROOT_DIR/tachyon/files"
|
|
TACHYON_BIN="$TACHYON_FILES/usr/bin/tachyon"
|
|
TACHYON_LIB="$TACHYON_FILES/usr/lib"
|
|
CLI_UC="$TACHYON_BIN"
|
|
VALIDATOR="$TACHYON_LIB/config/validator.uc"
|
|
RULE_CONFIG="$TACHYON_LIB/config/rule.uc"
|
|
GENERATOR="$TACHYON_LIB/singbox/generator.uc"
|
|
SECTION_JS="$ROOT_DIR/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/section.js"
|
|
LIFECYCLE="$TACHYON_LIB/service/lifecycle.uc"
|
|
|
|
fail() {
|
|
printf 'FAIL: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
[ ! -e "$TACHYON_LIB/config_validation.sh" ] ||
|
|
fail "config_validation.sh shell owner must be removed"
|
|
|
|
if grep -R -n "config_validation.sh" "$TACHYON_FILES" >/dev/null 2>&1; then
|
|
fail "runtime files must not reference config_validation.sh"
|
|
fi
|
|
|
|
legacy_symbols='(^|[^A-Za-z0-9_])(config_validate_runtime|check_requirements|commit_tachyon_config|mwan3_is_active|get_inline_remote_ruleset_format|detect_inline_ruleset_reference_kind)([^A-Za-z0-9_]|$)'
|
|
if grep -R -n -E "$legacy_symbols" "$TACHYON_BIN" "$TACHYON_LIB" --include='*.sh' >/dev/null 2>&1; then
|
|
fail "runtime shell must not keep config_validation.sh symbols"
|
|
fi
|
|
|
|
grep -Fq 'mode == "check-requirements"' "$VALIDATOR" ||
|
|
fail "config validator must own requirement checks"
|
|
grep -Fq 'mode == "mwan3-is-active"' "$VALIDATOR" ||
|
|
fail "config validator must own mwan3 runtime predicate"
|
|
grep -Fq 'require("core.uci")' "$VALIDATOR" ||
|
|
fail "config validator must use core.uci for runtime UCI access"
|
|
grep -Fq 'text_list_values,' "$RULE_CONFIG" ||
|
|
fail "config.rule must export the shared comment-aware text parser"
|
|
grep -Fq 'rule_config.text_list_values(value, "comma-space")' "$VALIDATOR" ||
|
|
fail "domain validation must use the shared comment-aware text parser"
|
|
grep -Fq 'rule_config.text_list_values(option(section, "domain", ""), "comma-space")' "$TACHYON_LIB/singbox/generator_routes.uc" ||
|
|
fail "sing-box domain generation must use the shared comment-aware text parser"
|
|
grep -Fq 'return appendUniqueDomainTextValues(textValue, values);' "$SECTION_JS" ||
|
|
fail "Domains field loading must preserve the original combined text"
|
|
if grep -n -E 'require\("uci"\)\.cursor|uci -q|uci", "-q"|command_output\("uci' "$VALIDATOR" >/dev/null 2>&1; then
|
|
fail "config validator must not own direct UCI cursor or CLI access"
|
|
fi
|
|
grep -Fq '#!/usr/bin/ucode' "$TACHYON_BIN" ||
|
|
fail "tachyon entrypoint must be a direct ucode executable"
|
|
grep -Fq 'service/lifecycle.uc' "$CLI_UC" ||
|
|
fail "service/cli.uc must dispatch service lifecycle through service/lifecycle.uc"
|
|
if grep -n -E 'MIGRATION_UC|config[./]migration|"migrate"' "$LIFECYCLE" >/dev/null 2>&1; then
|
|
fail "service/lifecycle.uc must not run configuration migration"
|
|
fi
|
|
grep -Fq 'mark_internal_config_guard();' "$LIFECYCLE" ||
|
|
fail "service/lifecycle.uc must preserve the internal config trigger guard"
|
|
grep -Fq 'VALIDATOR_UC' "$LIFECYCLE" &&
|
|
grep -Fq 'validate-runtime' "$LIFECYCLE" ||
|
|
fail "service/lifecycle.uc must run runtime validation directly through ucode"
|
|
|
|
grep -Fq 'mode == "check-requirements-and-validate-runtime"' "$VALIDATOR" ||
|
|
fail "config validator must own the combined start-path validation mode"
|
|
|
|
printf 'config validation ownership checks passed\n'
|