Conversation
ConvertStringToTime and ConvertStringToTimeInLoc matched timestamps with a
`+hh:mm` offset against fixed-width layouts (".000" and ".000000"). Any
other precision failed: .NET's round-trip format (7 digits, e.g. PowerShell
`Get-Date -Format o`), Go's RFC3339Nano (up to 9 digits, trailing zeros
trimmed) and trimmed 4/5-digit values all returned a parse error.
This parser backs the mapstructure decode hook, so a webhook deployment or
incident posted with such a timestamp was rejected with 400 and never
counted, and an Iso8601Time field in an extractor failed the subtask.
Replace the two fixed-width entries with one entry that accepts any
fraction length through the ".999999999" layout.
Generated-by: Claude Code (Claude Opus 5.5)
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.
Pre Checklist
pr-type/bug-fix,pr-type/feature-development, etc. (I can't set labels from a fork.pr-type/bug-fixfits.)Summary
ConvertStringToTimeandConvertStringToTimeInLoc(backend/core/models/common/iso8601time.go) match timestamps that end in a+hh:mmoffset against fixed-width layouts:.000(3 digits) and.000000(6 digits, added in #8828). Any other number of fractional digits fails to parse:2026-09-29T10:00:00.1234567+08:00Get-Date -Format ocannot parse "7+08:00" as "-07:00"2025-09-15T17:53:36.337932123+09:00time.RFC3339Nano, JavaOffsetDateTimewith nanos2025-09-15T10:53:36.3379+02:00This matters because the same function backs the mapstructure decode hook (
helpers/pluginhelper/api/mapstructure.go). So when a CI script posts a deployment to the webhook plugin withstartedDate/finishedDatein one of these formats,DecodeMapStructfails andpostDeploymentsreturns 400. That deployment is never stored, so deployment frequency, change lead time and failed deployment recovery time are all computed without it. The same thing happens to webhook incidents and issues. AnIso8601Timefield in a plugin extractor fails its subtask the same way, which is what #8708 hit with 6 digits.The fix replaces the two fixed-width entries with one entry,
\.[\d]+[+-][\d]{2}:[\d]{2}$, using the layout2006-01-02T15:04:05.999999999-07:00. That layout accepts a fraction of any length. The 3- and 6-digit cases parse exactly as before.Does this close any open issues?
No open issue. This is a follow-up to #8708 / #8828, which fixed only the 6-digit case.
Screenshots
N/A. Test evidence:
TestConvertStringToTime(7, 9, 4 and 1 fractional digits) andTestConvertStringToTimeInLoc(7 digits).main(b0a75899):go test ./core/models/common/ -run TestConvertStringToTime -vfails the 7-, 9- and 4-digit cases and the 7-digitInLoccase (4 failures). The existing 3/6-digit cases and the 1-digit case pass.go test ./core/models/common/is green.gofmt -landgo vetare clean.api.DecodeMapStructon a{startedDate, finishedDate}payload with 7- and 9-digit timestamps. It returns an error onmainand decodes both values with the fix.Other Information
I used an AI coding assistant (Claude Code) to write this change, following the ASF generative tooling guidance; the commit carries a
Generated-by:trailer.