Repository navigation
fix(kernel): name the other identity flag and the closest device name in selector errors - #4861
Conversation
… in selector errors A `--udid` that resolves nothing while the same value identifies an observed Android/HarmonyOS/Vega device answered "No Apple device with UDID emulator-5580" with no hint when the request carried no explicit --platform (the explicit case was already rejected by assertSelectorFlagMatchesPlatform). The failure now reads the flag the value belongs to through deviceIdentityFlag — no third inline pairing — and says "Did you mean --serial <value>?"; --serial answers the reverse the same way. Only an observed identity earns the hint, and a platform with no identity flag (web, linux) earns none, matching the callstack#2065 precedent for --device. A --device name that survives the matcher but sits one punctuation character away from exactly one candidate (curly quotes on renamed simulators) is now answered with that candidate's name; more than one candidate under the quote fold earns no hint. The id-mistaken-for-name answer still wins when it applies. device.ts carried this work past the 1000-line lint cap, so the host-scoped id grammar (app devices, web sessions) moved verbatim into device-identity.ts, which every closure through device.ts already evaluates; @agent-device/kernel /device re-exports keep every import path stable. The moved web-session refusal now reads its wire reason from a declared table. Co-Authored-By: Claude Code <noreply@anthropic.com>
The barrel re-export of hostAppDeviceId and hostDeviceIdPrefix had no production consumer after the move, so the production-unused-exports gate refused it; both are used only by tests. The barrel keeps the symbols with production call sites, the tests import the two from @agent-device/kernel/device-identity (new exports-map entry), and the gate passes again. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for tightening these selector errors. The hint logic reads correct at 9449b7e, but the Coverage check fails because of this PR, so the change is not ready yet. The new Not blocking, and these can be taken or left: the Could one helper taking the candidates, the value and an optional requested flag serve all three not-found sites, with the quote fold kept as a short helper? That would keep device.ts under 1000 lines, so no move, no new export and no test import changes, at roughly +40 production lines instead of +220/-127. Not verified here: a live |
…able spacing claim The two-candidate quote-fold case requested a quote-less name, which folds onto neither quoted candidate, so the close list stayed empty and the no-hint assertion passed without exercising the branch. The request now keeps its straight quotes while the two candidates spell theirs with U+2018 and U+2019, so both land under the fold and the answer names neither; flipping the single-candidate guard to >= 1 fails exactly this test. The closest-name hint said "punctuation or spacing", but the shared name matcher already folds whitespace, so a spacing-only difference resolves before any hint and the spacing claim was unreachable copy. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for the update. The evidence the earlier review asked for is now in place at 0a424cc. One problem from that review remains: the new The Coverage job log stops mid-run with no error line, so the failure cannot be attributed from the log alone. Not verified here: whether it comes from this export or is unrelated. Body rules was cancelled in a different run, not failed. After the export is removed, Coverage and Body rules need to pass before merge. Re-running Coverage once would show whether the failure reproduces. |
… not-found sites with one helper The review asked for the smallest structural footprint: the ./device-identity package export made device-identity.ts a package entry whose eager closure grew from one module to three (errors.ts via the moved web-session refusal, plus redaction.ts), which the eager-closure budget gate refuses on no-growth, and the export had no production consumer. This drops the move and the export entirely: the host-scoped id grammar returns to device.ts, device-identity.ts returns to its merge-base content, and the three test files that had been pointed at the new entry go back to @agent-device/kernel/device. The two hints this branch added and the pre-existing mistaken-name answer now collapse into one helper: deviceNotFoundHint(candidates, value, flag?) reads the flag the request used, answers with the flag an observed device carries the value under, and for --device names the single candidate one quote fold away (quoteFoldDeviceName). device.ts absorbs the consolidation with no net line growth (989 at base, 989 here) against the 1000-line oxlint cap, so no module move and no new entry are needed. Co-Authored-By: Claude Code <noreply@anthropic.com>
The merge preview joins this branch with main, where dd7d81c (callstack#4853) grew device.ts by ten lines, so the branch's own zero-growth accounting does not hold on the tree CI actually checks: 994 head lines plus those ten crossed the 1000 limit and failed oxlint there. Compress the helper's one-line docblock, put its signature back on one line, and pass an empty value for a serial-less selector (an empty string matches no id, so that miss stays hint-free): 987 lines at head, 997 on the merge preview. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks for the quick update. At 05bd92c the earlier findings (#4861 (comment)) are fixed, and this PR is ready. The earlier Coverage failure came from the |
Summary
With no explicit
--platform, a--udidnaming an attached Android/HarmonyOS/Vega serial answered "No Apple device with UDID X" with no hint. The failure now names the flag the value belongs to, read throughdeviceIdentityFlag: "Did you mean --serial X?", and--serialanswers the reverse. Only an observed candidate earns a hint; a--devicename one punctuation character from exactly one candidate gets that name; two candidates under the fold, or an unknown name, earn none.Per the review, the footprint shrank to consolidation: the host-scoped id grammar returned to device.ts,
device-identity.tsis back to its merge-base content, the./device-identityexport is gone, with the three test files back on@agent-device/kernel/device— one entry, no eager-closure growth. The three not-found answers share one helper,deviceNotFoundHint(candidates, value, flag?), with the quote fold asquoteFoldDeviceName; messages are unchanged. device.ts sits at 987 lines at head and 997 on the merge preview with main, under the 1000 cap.Before / after
Validation
At 05bd92c: kernel 284 and daemon-side 260 unit tests,
tsc -bexit 0. In an isolated clone atorigin/mainat 18c6c42cd (merge-base 357e0d4), everycheck:affectedlane passes andeager-closure-budgetspasses 919 tests — the Coverage blocker. The earlier layering and eager-closure failures were fork-base misreports (origin = a private mirror). upload-http-deadline.test.ts fails identically at the merge-base on this host, (not this diff). The merge preview with main passes oxlint; its earlier failure was the device.ts cap, now fixed. CI owns Coverage and Body rules.🤖 Generated with Claude Code