You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tokenize yarn-classic .yarnrc lines in one formats/yarn helper: the crawler's copy keeps single quotes that redirect's reader strips #1901
[agent] Filed by the scheduled architecture audit (audit-core). Register: register comment.
Kind: refactor. Register ID: A42.
Problem
Yarn classic's .yarnrc (one key value pair per line) is tokenized twice:
crawlers/npm_crawler.rsparse_yarnrc_modules_folder and split_yarnrc_token, L344-L389.`` A double-quoted string has its \ escapes removed by hand, and any other value runs to the next whitespace.
patch/redirect/yarnrc.rsyarnrc_setting and yarnrc_token, L140-L168 and L447-L490.```` This copy follows yarn's lockfile tokenizer: a double-quoted string is decoded as JSON, a single-quoted string is accepted (yarn's YAML fallback), a bare word ends at a space, : or `,`, and a token yarn can't read is `None`.
The two have drifted. Given --modules-folder 'deps', the crawler resolves the folder 'deps' with the quotes kept, while redirect reads deps. Given --modules-folder ~/x, the crawler accepts the value, while redirect rejects it as unreadable. (This is from reading the code; it was not executed.) Neither tokenizer belongs where it is, because formats/yarn/rc.rs holds only the berry YAML reader.
Proposed change
Move one line reader into formats/yarn/ (for example formats/yarn/classic_rc.rs), based on redirect's yarnrc_token since it is the one that matches yarn. It would offer classic_rc_value(text, key) -> Option<String> (last setting wins) and the tokenizer. Make npm_crawler::yarnrc_modules_folder and redirect/yarnrc.rs callers of it, and delete split_yarnrc_token and the crawler's private line loop.
Size: 3 files, about −70/+30 lines.
Acceptance criteria
Existing .yarnrc tests pass: redirect/yarnrc_tests.rs, and the npm_crawler modules-folder tests.
A new test pins a single-quoted --modules-folder.
A new test pins a value yarn can't tokenize: it is ignored by both callers.
[agent] Triage: priority:p1 (yarn classic). No duplicate or open PR found. It touches yarnrc_modules_folder like #1902, but the cause is separate: two drifted tokenizers, not the relative --cwd. One fix won't close both.
[agent] The audit-core run of 2026-11-01 found that the yarn-1 token grammar has two more copies inside formats::yarn, beyond the two in this issue.
The extra copies:
patterns.rs L9-L31split_key_patterns toggles on every " and ignores escapes. Executed: "a\"b@1" comes back as a\b@1.
classic_deps.rs L193-L214 yarn_token keeps \", and a bare word there ends only at whitespace. Its doc (L196-197) claims it agrees with split_key_patterns, and it doesn't.
redirect/yarnrc::yarnrc_token JSON-decodes, and a bare word there ends at :, space or ,.
This is not a request to widen PR #1915. If the merged helper lands in formats/yarn/patterns.rs, these two can follow it in a later PR.
Activity
mikolalysenko commentedon Nov 1, 2026
[agent] Triage: priority:p1 (yarn classic). No duplicate or open PR found. It touches
yarnrc_modules_folderlike #1902, but the cause is separate: two drifted tokenizers, not the relative--cwd. One fix won't close both.Generated by Claude Code
mikolalysenko commentedon Nov 1, 2026
[agent] Claiming this issue (shared root cause:
.yarnrclines tokenized by two drifted readers). Branch: agent/fix-yarnrc-classic-tokenizer. Claim-ID: 2026-11-01T06:21:14Z-e4a8f6Generated by Claude Code
mikolalysenko commentedon Nov 1, 2026
[agent] Draft PR: #1915
Generated by Claude Code
Read .yarnrc lines through one yarn tokenizer
Read single-quoted .yarnrc values like yarn 1
Read .yarnrc as yarn 1 reads the whole file
Match js-yaml and yarn's tokenizer in .yarnrc
mikolalysenko commentedon Nov 1, 2026
[agent] The audit-core run of 2026-11-01 found that the yarn-1 token grammar has two more copies inside
formats::yarn, beyond the two in this issue.The extra copies:
split_key_patternstoggles on every"and ignores escapes. Executed:"a\"b@1"comes back asa\b@1.yarn_tokenkeeps\", and a bare word there ends only at whitespace. Its doc (L196-197) claims it agrees withsplit_key_patterns, and it doesn't.redirect/yarnrc::yarnrc_tokenJSON-decodes, and a bare word there ends at:, space or,.This is not a request to widen PR #1915. If the merged helper lands in
formats/yarn/patterns.rs, these two can follow it in a later PR.Generated by Claude Code
Cap .yarnrc block nesting before recursing
Drop unused strip_bom import in npm crawler