Skip to content

Extract resolve_worker_target from the drifted worker-apply/upgrade duplication - #963

Merged
VijitSingh97 merged 1 commit into
develop-v2from
refactor/927-worker-resolve
Aug 14, 2026
Merged

Extract resolve_worker_target from the drifted worker-apply/upgrade duplication#963
VijitSingh97 merged 1 commit into
develop-v2from
refactor/927-worker-resolve

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #927. control_worker_apply and control_worker_upgrade duplicated the worker-resolution block nearly line-for-line — the name charset pin, the three WORKER_LIST_JQ lookups, the host/port/token guards — the exact drift class the shared-function rule exists for, in fleet-control code.

One resolve_worker_target now owns it: resolves the dial target from the HOST's own config.json (never the caller's intent — the SSRF rule), preserves both charset pins verbatim (including the LC_ALL=C byte-range lesson), fails closed on missing host/token, and hands back RESOLVED_* or an operator-facing error — callers keep their own rejection/audit shapes since the verbs audit under different names. Also folds the port check onto the existing is_valid_port instead of a third regex copy.

Behavior byte-identical: the tier-1 rejection tables for both verbs pass UNCHANGED (they are the proof). Solo suite 2271/0, lint clean. Ponytail: net +2 lines, kills the drift.

🤖 Generated with Claude Code

…grade

control_worker_apply and control_worker_upgrade duplicated the entire
worker-resolution block line-for-line (name charset pin, the three
WORKER_LIST_JQ lookups, host-empty/host-charset/port/token guards) — the
next edit to any of those rules would land in one verb and silently not
the other. Both verbs now call a single resolve_worker_target, which also
picks up the existing is_valid_port() helper instead of re-deriving the
same port-range check inline.

Tier-1 rejection-table coverage for both verbs is unchanged and passes as
proof the refactor is behavior-preserving.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit 9b440fd into develop-v2 Aug 14, 2026
15 checks passed
@VijitSingh97
VijitSingh97 deleted the refactor/927-worker-resolve branch August 14, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant