fix: avoid path claims for non-path inline code - #83
Conversation
- Skip inline IP/CIDR values, file extensions, shell commands, and dotted annotation keys when extracting path claims - Add regression coverage for Kubernetes/GitOps-style inline code snippets
theDakshJaitly
left a comment
There was a problem hiding this comment.
Thanks for the focused hardening here. The overall direction makes sense, especially after #80, since ROUTER.md can still contain inline values that look path-like but are not filesystem paths.
I found one false-negative risk before approving: DOTTED_KEY_WITH_SLASH also matches valid root hidden-directory paths like .github/CODEOWNERS and .github/workflows. Those are realistic scaffold references, and this change would stop extracting them as path claims, so checkPaths would no longer validate them.
Could you tighten that matcher so Kubernetes-style dotted annotation/config keys are skipped without excluding .github/... paths? A regression test for .github/CODEOWNERS or .github/workflows would cover it.
DOTTED_KEY_WITH_SLASH allowed the dotted segment to be empty, so it matched a leading-dot directory as readily as a Kubernetes annotation: .github/CODEOWNERS, .github/workflows and .mex/ROUTER.md all stopped being extracted as path claims, which would have dropped mex's own scaffold paths out of checkPaths entirely. Require a real character before the dot. argocd.argoproj.io/sync-wave and k8s.io/api are still skipped; the hidden directories are checked again. Addresses the review on mex-memory#83.
|
Thanks for this, and sorry it sat so long. Your commit is now in The one review point from @theDakshJaitly is addressed there rather than here. The rest of #170 is the other half of #107: with the false positives gone from extraction, path checking could be widened from Closing this since the commit is merged. Thanks again. |
Summary
Why
checkPathscurrently treats many backtick-wrapped values as path claims when they contain/or a known extension. In project docs this creates noisyMISSING_PATHerrors for Kubernetes/GitOps notes like192.168.5.0/24,argocd.argoproj.io/sync-wave,sudo ls /var/lib/kubelet/plugins_registry/, or.yaml.Those are inline code snippets, not files the scaffold depends on.
Testing
npm test -- test/claims.test.tsnpm test -- test/checkers.test.tsnpm run typecheckgit diff --check