Repository navigation
fix(config): day-unit durations + de-dup helpers (#294-298) - #331
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…298) "2d"/"1d12h" were parsed by time.ParseDuration, which rejects "d", so the value silently became 0. config.ParseDuration now uses a day-aware parser (ParseDurationE); the CLI's parseDuration delegates to it, so the CLI and config paths share one implementation. Regression test added. Also de-duplicated three helper pairs (no behavior change): - #294: formatDurationForTTL was byte-identical to formatDuration; deleted it and repointed the TTL path + tests to formatDuration. - #295: truncate == truncateValue; kept one truncate in cmd/utils.go. - #296: ~20 identical tabwriter.NewWriter(...,2,' ',0) call sites now go through newTableWriter(); normalized the one padding-3 outlier (dns.go). Deferred #297 (per-region EC2 client helper): it spans 40+ pkg/aws sites on the AWS hot path and the finding rated it optional — better as its own focused PR than bundled here.
scttfrdmn
force-pushed
the
audit/dups-294-298
branch
from
July 11, 2026 18:50
754d32e to
8785608
Compare
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #294, #295, #296, #298. Defers #297 (see below). Part of the audit tracker #328 (Phase 0/1).
#298 — real bug (Fixed)
A local config
ttl: 2d(oridle-timeout,completion-delay) was parsed bytime.ParseDuration, which rejects thedunit, soconfig.ParseDurationreturned0and the setting was silently dropped. This hitspkg/provider/local.go(TTL/IdleTimeout/CompletionDelay).Fix:
config.ParseDurationnow delegates to a new day-awareParseDurationE(native Go syntax first, then<n>{s,m,h,d}segments). The CLI'scmd/state.go:parseDuration— which already had the day-aware logic — now delegates to the same shared parser, so the two paths can't drift again. Regression test added (TestParseDuration, incl.2d→48h).De-duplication (Changed, no behavior change)
formatDurationForTTLwas byte-identical toformatDuration→ deleted, TTL path + tests repointed.truncate==truncateValue→ onetruncateincmd/utils.go, single caller repointed.tabwriter.NewWriter(w,0,0,2,' ',0)sites → onenewTableWriter(w)helper; normalized the lone padding-3 outlier indns.go; strandedtext/tabwriterimports removed.Deferred
pkg/awssites on the AWS hot path; the finding itself rated it optional. Better as its own focused PR than bundled with unrelated cleanups. Left [audit] Dup: per-region EC2 client boilerplate repeated ~43+ times in pkg/aws — add c.regionalEC2(region) #297 open.Verification
go build ./...,go vet ./cmd ./pkg/config,gofmtall clean.go test ./pkg/config ./cmdgreen;TestParseDurationcovers the [audit] Bug+Dup: config.ParseDuration silently dropsd(day) support —ttl: 2dparses to 0; delegate to the complete parser #298 fix.pkg/aws/pkg/agentpass isolated (thesignal: terminatedunder a full./pkg/...run is CPU-contention timeout, not these changes). Pre-existing unrelatedTestCatalogValid(feat(plugin): permissions declaration block (#388) #392) still fails onmain.CHANGELOG updated under Fixed + Changed.