fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#1530
Open
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
Open
fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#1530ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
ousamabenyounes wants to merge 1 commit intortk-ai:developfrom
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.
Problem (#1416)
rtk aws eks list-clusters(and any AWS list-* op handled by the generic JSON schema path) rendered cluster names like `my-cluster` as `date?` instead of a string. EKS cluster names of length 10 that contain a `-` (very common!) hit the placeholder.Root cause
`src/cmds/system/json_cmd.rs` extracts a schema for JSON values. The string-classification heuristic treated any string of length 10 containing `-` as a probable date:
```rust
} else if s.contains('-') && s.len() == 10 {
format!("{}date?", indent)
```
That collides with EKS cluster names, slugs, and many short identifiers (`abcd-12-xy`, `foo-bar-ab`, `my-cluster`, …).
Fix
Tightened the heuristic to a strict `^\d{4}-\d{2}-\d{2}$` regex, compiled once via `lazy_static`. Real ISO calendar dates are still classified as `date?`; everything else falls back to `string`.
Test plan
Closes #1416
🤖 Generated with Claude Code