devantler-tech / devantler-tech/ksail

refactor(hetzner): share one Hetzner user_data ceiling constant instead of two copies

Open Beginner friendly
#6,613 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
165
Forks
12
Avg merge
5h 41m
Merged PRs (30d)
337

Description

> 🤖 Generated by the Agentic Engineer

### Evidence

Two constants independently define the same Hetzner `user_data` limit (32 KiB):

- `pkg/svc/provisioner/cluster/internal/hetznerbase/serverspecs.go` — `maxProviderUserDataBytes`
- `pkg/svc/provisioner/cluster/talos/autoscaler_worker_config.go` — `hetznerUserDataLimitBytes`

Raised as an exact-head CodeRabbit finding on #6609 and confirmed against current code. Both are
first-party and production-relied-upon; each carries its own comment explaining the same provider
behaviour ("invalid input in field `user_data`").

### Audience and impact

Whoever next changes the ceiling. If Hetzner moves the limit, or one path is corrected and the other
is not, the two silently disagree — and the failure is asymmetric: the provisioner refuses locally
with a named error, while the autoscaler path hands an oversize payload to the API to reject
opaquely. Nothing in either package points at the other, so the drift is not discoverable from
either side.

### Why this is not in #6609

#6609 is a security change. Sharing a constant across two packages is a behaviour-preserving
refactor, and this repo deliberately keeps the two apart — mixing them would make the security fix
harder to review and harder to revert.

Distinct from #6612, which changes a *capability* (forwarding gzip as base64 rather than refusing
it). This issue is only about the duplicated definition.

### Acceptance criteria

- One exported constant is the single definition of the Hetzner `user_data` ceiling.
- Both `maxProviderUserDataBytes` and `hetznerUserDataLimitBytes` reference it; neither restates the
literal.
- Existing tests pass unmodified (behaviour-preserving), and the tests that pin the ceiling derive it
from the shared constant rather than a local literal.

**Size:** small — one new exported constant plus two references, no behaviour change.

Contributor guide

Open the contributing guide

Research direction

Start by reading pkg/svc/provisioner/cluster/internal/hetznerbase/serverspecs.go and pkg/svc/provisioner/cluster/talos/autoscaler_worker_config.go to trace the two 32 KiB definitions and their package relationship. Update the tests that pin the ceiling to derive it from the shared constant, then run the existing tests; done means both local constants reference one exported definition and behavior is unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cloud
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.