Skip to content

fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#2476

Open
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/issue-1416
Open

fix(json): only flag strict ISO dates, not 10-char dashed strings (#1416)#2476
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/issue-1416

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Fixes #1416.

extract_schema flagged any 10-character string containing a - as date?. EKS cluster names like my-cluster (10 chars, dashed) were therefore rendered as date? instead of string, corrupting the inferred schema for aws eks list-clusters output.

Fix

Replace the s.contains('-') && s.len() == 10 heuristic 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):

test ...test_extract_schema_eks_cluster_name_is_string_not_date ... FAILED
test ...test_extract_schema_dashed_non_date_strings ... FAILED
test result: FAILED. 3 passed; 2 failed

GREEN — with the anchored ISO-date regex:

running 5 tests
test result: ok. 5 passed; 0 failed

(Re-proposes the accidentally-closed #1530, rebased onto current develop.)

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws eks list-clusters - cluster name silently replaced with "date?" type placeholder

1 participant