Repository navigation
A committed TypeScript binding outlives its type no more: 38 orphans deleted, and a ratchet counts any new one - #5730
Conversation
…deleted, and a ratchet counts any new one ts-rs writes protocol/typescript/<module>/<Type>.ts when a crate's tests run, and the CI drift step (git diff --exit-code protocol/typescript/) catches a regenerated binding that changed. A binding whose Rust type was deleted is never regenerated, so it stayed committed behind a green check, barrel line and all. Canary held 38: the threat classifier's 12, the cargo tool's 6, the tool-name codec's 7, the base-model ladder's 4, ContentTypes (its generator script is gone), ModelCapability, InferenceStatus, LocalModel, EndpointId, PeerId, PersonaId and the model registry's 2. No TypeScript outside protocol/typescript imports any of them; inside it, only barrels did. - source-hygiene ts_bindings: reads every `export_to` (file and directory forms) under core/, client/ and apps/, lists protocol/typescript/**/*.ts, and holds `orphan_ts_bindings` (base 38, head 0; the count may only fall). Delete a ts-rs type, delete its binding and barrel line in the same change. - The 38 files, their module barrel lines (ai, cognition, genome) and the 17 master index.ts lines naming them are deleted; every remaining master export resolves. - generated_barrel_sync's recovery text named a generator that no longer exists; it now says to edit the barrel line. Found while reviewing #5726, which deletes six more ts-rs types without their bindings (card ad4fa41f). Not fixed here: generated_barrel_sync lives in continuum-core's tests/, which CI never runs (`cargo test -p continuum-core --lib`), and its rule reports 63 drifting modules on canary (60 after this change). Follow-up card filed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Review at 6290c96 (Fable): PASS. Claims verified:
Right:
One nit, non-blocking: in the directory form, |
… a doc or attribute line (Fable on #5730) A doc line between the attribute and the item saying "the struct for X" named the binding for.ts. Comment and attribute lines are skipped; the test now carries such a line, and removing the filter fails it. continuum card ad4fa41f Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Delta 6290c96 → 5ab091a (Fable): PASS. |
…one never names a binding (Fable on #5730) The line filter left a multi-line attribute's continuation lines in: #[serde( / tag = "type" / content = ... )] read as an item named content. next_item_name now tokenizes once: it starts inside the export_to attribute, skips it and every later attribute by bracket depth (strings ignored), skips // comments, and returns the word after the first struct/enum/type. The test carries a multi-line ts attribute, a multi-line serde attribute with tag = "type", a doc line and a generic pub(crate) enum; removing the attribute skip yields scene/content.ts and fails it. Test-only walkers moved into the test module (clippy: dead in the lib build). continuum card ad4fa41f Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Delta 5ab091a → 92f6f90 (Fable): PASS. I traced |
ts-rs writes protocol/typescript//.ts when a crate's tests run, and the CI drift
step (git diff --exit-code protocol/typescript/) catches a regenerated binding that changed. A
binding whose Rust type was deleted is never regenerated, so it stayed committed behind a green
check, barrel line and all. Canary held 38: the threat classifier's 12, the cargo tool's 6, the
tool-name codec's 7, the base-model ladder's 4, ContentTypes (its generator script is gone),
ModelCapability, InferenceStatus, LocalModel, EndpointId, PeerId, PersonaId and the model
registry's 2. No TypeScript outside protocol/typescript imports any of them; inside it, only
barrels did.
export_to(file and directory forms) under core/,client/ and apps/, lists protocol/typescript/**/*.ts, and holds
orphan_ts_bindings(base 38,head 0; the count may only fall). Delete a ts-rs type, delete its binding and barrel line in
the same change.
lines naming them are deleted; every remaining master export resolves.
to edit the barrel line.
Found while reviewing #5726, which deletes six more ts-rs types without their bindings (card
ad4fa41f). Not fixed here: generated_barrel_sync lives in continuum-core's tests/, which CI never
runs (
cargo test -p continuum-core --lib), and its rule reports 63 drifting modules on canary(60 after this change). Follow-up: card 5b03490f (owner Cormac).
Validation
cargo run -p source-hygiene --bin ratchets -- origin/canary: exit 0, 85/85 on base and head;orphan_ts_bindings 38 -> 0.index.tsexport resolves to a file or a module barrel that names it.protocol/typescriptimports any deleted type (searched .ts/.tsx/.swift/.kt, excluding node_modules and legacy).🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE