fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#2476
Open
ousamabenyounes wants to merge 1 commit into
Open
fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#2476ousamabenyounes wants to merge 1 commit into
ousamabenyounes wants to merge 1 commit into
Conversation
…k-ai#1416) `rtk aws eks list-clusters` rendered cluster names like `my-cluster` as `date?` in the schema output. The JSON schema extractor's date heuristic matched any string of length 10 containing `-`, which collides with plenty of common identifiers (cluster names, slugs, short IDs). Tightened to a strict `^\d{4}-\d{2}-\d{2}$` regex via lazy_static. ISO calendar dates are still classified as `date?`; everything else falls back to `string`. Closes rtk-ai#1416 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes #1416.
extract_schemaflagged any 10-character string containing a-asdate?. EKS cluster names likemy-cluster(10 chars, dashed) were therefore rendered asdate?instead ofstring, corrupting the inferred schema foraws eks list-clustersoutput.Fix
Replace the
s.contains('-') && s.len() == 10heuristic with a strict, anchored ISO-8601 regex^\d{4}-\d{2}-\d{2}$, so only real calendar dates are tagged.Test verification (RED → GREEN)
RED — prod heuristic restored (
s.contains('-') && s.len() == 10):GREEN — with the anchored ISO-date regex:
(Re-proposes the accidentally-closed #1530, rebased onto current
develop.)