Commit a585174
committed
test(tools): type the path-safety harnesses instead of erasing with any
These two harnesses are the template every service copied when the path
hardening sweep began, and both open with `type AnyTool = ToolConfig<any, any>`
plus an `as any` at the `url(...)` call. CLAUDE.md forbids `any` outright, and
because they are the template the violation propagated into ten in-flight PRs
before review flagged it. Fixing the source stops the next copy inheriting it.
The obvious repair does not compile. `ToolConfig` takes its param type in the
contravariant position of `request.url`, so no concrete member of the barrel's
union is assignable to a widened `ToolConfig<Record<string, unknown>, ...>`, and
`filter`'s type-predicate overload intersects rather than replaces -- filtering
the union directly leaves the mismatch standing. Seeding the enumeration as
`Object.values<unknown>(...)` makes the existing `isVercelTool` / `isDaytonaTool`
predicate the single narrowing point, which is the `unknown`-plus-type-guard form
the guidelines actually ask for, and removes the need for a cast at the call site.
Note these files have no type coverage in CI from either direction:
`apps/sim/tsconfig.json` excludes `**/*.test.ts`, and vitest does not typecheck.
Verified with a temporary tsconfig lifting the exclusion, confirming via
`--listFiles` that both files were genuinely in the program -- an empty program
also reports zero errors. That config was not committed.
Behaviour is unchanged: 1129 tests pass, identical to before.1 parent 34276b9 commit a585174
2 files changed
Lines changed: 22 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | | - | |
| 99 | + | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
105 | | - | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
111 | 118 | | |
112 | | - | |
| 119 | + | |
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
| |||
0 commit comments