[log] Add debug logging to token/offset/input helpers#36182
Merged
Conversation
Add logger package debug logging to four pkg/ helpers following the pkg:filename naming convention: - workflow:daily_effective_workflow - log each branch of max-daily-effective-tokens resolution (frontmatter, imported config, default fallbacks) - workflow:utc_offset - log format-mismatch, out-of-range, and successful normalization in NormalizeUTCOffset - typeutil (reused shared typeutilLog) - log parse and int64-overflow rejections in ParseInt64KMSuffix - types:input_definition - log fallback coercion of unexpected default value types in GetDefaultAsString All log arguments are side-effect-free. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Fixed in the latest commit. The custom linter was flagging four discarded error returns from |
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.
Fix discarded errors and add diagnostic logging to token/offset/input helpers
Summary
This PR addresses two related concerns across the UTC offset, token limit, and input-definition helpers:
strconv.Atoierror returns inutc_offset.gowere silently discarded; they are now propagated as proper errors.logstatements have been added at every notable resolution, rejection, and fallback branch in the affected packages to make misbehaviour easier to trace in production and test runs.Changes by file
pkg/workflow/utc_offset.gopkg/workflow/daily_effective_workflow.gopkg/typeutil/effective_token_limits.gopkg/types/input_definition.goDetail
pkg/workflow/utc_offset.goNormalizeUTCOffsetandParseUTCOffsetLocationboth calledstrconv.Atoiand discarded the returned error. Those errors are now returned to the caller instead of being silently swallowed.pkg/workflow/daily_effective_workflow.goresolveMaxDailyEffectiveTokensnow emits a structured log line, making it straightforward to trace which limit source was applied at runtime.pkg/typeutil/effective_token_limits.goParseInt64KMSuffixnow logs at the two rejection paths: invalid integer input and integer overflow, aiding diagnosis of misconfigured token-limit strings.pkg/types/input_definition.goGetDefaultAsStringnow logs a diagnostic message when it encounters an unexpected default value type, replacing a previously silent no-op branch.Testing notes
strconv.Atoierror-propagation change inutc_offset.gois the only behaviour-altering change; callers that previously received a zero value on bad input will now receive an error — verify that all call sites handle the new error return correctly.Commits
5a97addb226e86