Repository navigation
fix(import): the path error says each name starts with a letter or _ - #1964
Conversation
|
Thanks, the new wording fixes the #1961 repro: One problem before merge:
Please split the two: keep the name message for the shape checks, and give the hub-boundary case its own message (that is what the "the hub's files import the hub's" clause was trying to say). If the shape check fails on the resolved path, show that path in Please also add a test for each message: a segment that starts with a digit (e.g. |
… that breaks the name rule is shown (#1961)
|
Split as you asked. The shape checks keep the name message, now without the hub clause. The hub crossing gets its own: "an import on its side of the hub (a hub file imports only hub files, and a local path stays out of the hub's store)". Together the two checks refuse exactly what the old one did. When the resolved file breaks the name rule, Tests: One gap: I couldn't run ping as a whole, because it needs the private site repo. I ran the new block on its own, with the source CLI and the same temp |
|
The red |
…hs; GUIDE fits its cap The error now names the import as written and where it resolves, relative to the importing file: './link.bend' (resolves to '../2d/x.bend'), not a path relative to the entry file with .bend appended. The hub-edge check in gates/ping.ts is dropped (gate changes go through Taelin). GUIDE's imports sentence is 3 ttok shorter, so it fits the 8,000 cap on current main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t from the importer Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fixes #1961.
An import is refused at two points, and both used one message: "an import path of plain names (letters, digits, _ and -; the hub's files import the hub's)". It named neither of the two rules behind it.
_([A-Za-z_][\w-]*), so no name segment starts with a digit and every key has one spelling (A name is words joined by dots, a namespace is the file's real path, a C id is unique, and every clash is refused #1042).import sub/2d/main.bendfailed here with a message that listed the digit as allowed.observedshowed the path as written, even when the resolved path was the problem, as with a link to2d/.Change: the rules don't change, and neither does what they refuse. The new hub check takes two cases out of the old condition: a file in the store without a
0xhead, and a hub file that reaches outside the store. Everything else the old condition refused keeps the name message.bend2/bend.ts: a shape failure says "an import path of plain names (each starts with a letter or _, then letters, digits, _ and -)". When the resolved file fails it,observedis the resolved path. A hub crossing says "an import on its side of the hub (a hub file imports only hub files, and a local path stays out of the hub's store)", with the path as written.guide/GUIDE.md: the imports paragraph states the name rule (7976 → 7980 ttok, cap 8000).tests/import/digit_segment.bend(new):./2d/x.bendgets the name message.gates/ping.ts: two checks for the hub message. A file in the store imports../stray.bend(the store's root) or../../out.bend(outside it). A test undertests/can't place files in the store, and ping already runs bend with its ownHOME.tests/import/{dotted_path,hub_head_path,hub_head_local,tilde_path}.bend: their#|lines carry the name message../2d/x.bend'./2d/x.bend'./good/x.bend,gooda link to2d'./good/x.bend''2d/x.bend'../stray.bend'../stray.bend'../../out.bend'../../out.bend'./d2/x.bend; a store file importing./inner.bendVerification (macOS arm64, Bun 1.4.2, Apple clang 21; Linux arm64 in Docker, Debian 13, Bun 1.4.2, clang 19 with X11 and ALSA headers)
BEND_LIBfor the store cases.bun bend2/main.tsin place of the installed bend and the same tempHOME): 0/2 on main, 2/2 with the change, on macOS and Linux.gates/test.tson all tests, base9d514f3vs this branch, macOS and Linux: each test interpreted, built with-o t.js -o t, and the JS and the binary run under the gate's 5 s alarm. The only lanes that change are the four updated tests' message line, plus the new test. Against the#|lines: macOS interp 1782/1782, JS 927/927, C 875/878; Linux interp 1779/1782, JS 923/927, C 874/878. The misses are the same on the base: windows with no display, andstack_fault_trap's exit code on macOS.gates/repo.ts: 54/54 (bend.ts 44,567 / 48,000 ttok; GUIDE.md 7,980 / 8,000)gates/ping.tsas a whole: it needs the site repo, which is privategates/test.tson the minis