Skip to content

[log] Add debug logging to token/offset/input helpers#36182

Merged
pelikhan merged 2 commits into
mainfrom
add-debug-logging-2026-06-01-24faea86f46133d0
Jun 1, 2026
Merged

[log] Add debug logging to token/offset/input helpers#36182
pelikhan merged 2 commits into
mainfrom
add-debug-logging-2026-06-01-24faea86f46133d0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 1, 2026

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:

  1. Bug fixstrconv.Atoi error returns in utc_offset.go were silently discarded; they are now propagated as proper errors.
  2. Observability — diagnostic log statements 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

File Kind Impact Breaking
pkg/workflow/utc_offset.go Bug fix + logging Medium No
pkg/workflow/daily_effective_workflow.go Logging Low No
pkg/typeutil/effective_token_limits.go Logging Low No
pkg/types/input_definition.go Logging Low No

Detail

pkg/workflow/utc_offset.go ⚠️ notable fix

  • NormalizeUTCOffset and ParseUTCOffsetLocation both called strconv.Atoi and discarded the returned error. Those errors are now returned to the caller instead of being silently swallowed.
  • Added a package-level logger.
  • Log statements added for: invalid offset strings, out-of-range offset values, and successful normalization.

pkg/workflow/daily_effective_workflow.go

  • Added a package-level logger.
  • Every resolution and fallback branch in resolveMaxDailyEffectiveTokens now emits a structured log line, making it straightforward to trace which limit source was applied at runtime.

pkg/typeutil/effective_token_limits.go

  • ParseInt64KMSuffix now logs at the two rejection paths: invalid integer input and integer overflow, aiding diagnosis of misconfigured token-limit strings.

pkg/types/input_definition.go

  • Added a package-level logger.
  • GetDefaultAsString now logs a diagnostic message when it encounters an unexpected default value type, replacing a previously silent no-op branch.

Testing notes

  • The strconv.Atoi error-propagation change in utc_offset.go is 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.
  • All other changes are purely additive log calls with no change to return values or control flow.

Commits

SHA Message
5a97add Fix discarded strconv.Atoi error returns in utc_offset.go
b226e86 Add debug logging to token/offset/input helpers

Generated by PR Description Updater for issue #36182 · sonnet46 1M ·

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>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jun 1, 2026
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 1, 2026

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

@copilot lint go https://github.com/github/gh-aw/actions/runs/26736025229/job/78789841141

Fixed in the latest commit. The custom linter was flagging four discarded error returns from strconv.Atoi in pkg/workflow/utc_offset.go (lines 26, 27, 45, 46). These calls were present in the original code before my changes, but my edits to the file brought them under linter scrutiny. I've updated both NormalizeUTCOffset and ParseUTCOffsetLocation to properly handle the errors instead of silently discarding them with _.

Copilot AI requested a review from pelikhan June 1, 2026 05:13
@pelikhan pelikhan merged commit e0d8d6f into main Jun 1, 2026
@pelikhan pelikhan deleted the add-debug-logging-2026-06-01-24faea86f46133d0 branch June 1, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants