Commit b205a52
refactor(qa)!: replace the route-envelope package with a repo-wide check script (#3843 review)
Review feedback: a whole workspace package for one ~150-line pure function is
over-engineering, and its name broke the repo's one naming rule.
Both points stand. `@objectstack/route-envelope-conformance` was also the only
package in 40+ whose directory name did not match its package name (the sole
prior exception, objectstack-vscode, is a VS Code extension requirement).
Replaced by `scripts/check-route-envelope.mjs` + `pnpm check:route-envelope`,
wired into lint.yml beside the nine sibling `check:*` guards — which is what
this repo's guard convention actually is. framework has zero custom ESLint
plugins (objectui has the eslint-rules/ precedent, framework does not) and no
root vitest for a rule's own tests, so the check-script form fits without
inventing new infrastructure. Net: one workspace package, one build node, five
devDependencies and one tsconfig removed; one script added.
Going repo-wide is not just tidier — it is a stronger guard, and it proved that
immediately by finding two modules #3843's hand survey missed:
* plugin-sharing/share-link-routes.ts — the FIFTH drifting module. No body
carries `success`, and one answers `{ ok: true }`, the private second word
#3689 retired from storage. Filed #3983, pinned by the guard's ratchet.
(#3675's own changeset had cited this file as an example of the good shape;
that was true of its `error` object and nothing else.)
* metadata/routes/hmr-routes.ts — declared EXEMPT with a reason (dev-only SSE
endpoint, not on the SDK surface), not skipped.
A per-package scan structurally cannot notice a module nobody thought to
convert. Three states are declared deliberately — conformant / ratcheted /
exempt — the honest classification ADR-0049 asks for; a module the scan finds
but the table does not declare is an ERROR, never a default, since applying the
2/1/1 default to an unknown module would let a new one pass by coincidence.
The scan now parses the TypeScript AST instead of matching regexes, which fixes
two real bugs the three copied blocks had:
1. comments were stripped with String.replace, whose line-comment pattern
also ate `//` inside string literals and truncated the rest of that line —
response writes included. A guard that under-counts passes while drift
ships.
2. `.json(` does not mean "write a response". hmr-routes.ts calls
`c.req.json()` twice to READ a request body; a textual count reports that
as two unenveloped responses.
Comments and literals are not AST tokens and request-vs-response is a property
of the callee, so both disappear and the 110-line tokenizer is gone. The script
carries a --self-test pinning each case: the nine sibling guards have none, but
both of these bugs survived a review of the regex version.
The driven-body half stays in each module's suite, where it belongs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYbS3kS8xzsHNXFTzp4e2z1 parent 0931185 commit b205a52
25 files changed
Lines changed: 472 additions & 1076 deletions
File tree
- .changeset
- .github/workflows
- packages
- qa/route-envelope
- src
- rest
- src
- services
- service-datasource
- src/__tests__
- service-i18n
- src
- service-settings
- src
- service-storage
- src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
This file was deleted.
0 commit comments