Repository navigation
feat(vis): answer security sync natively for pnpm workspaces - #257
Conversation
The run summary and the security scan still imported the JSON type through `sort_package_json::json`, a path that stopped being public when the module moved to `crate::json`. Both merged branches compiled alone; together on `next` the native build failed with E0603. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`vis security sync` pushes `security.policies.installScripts.allow` and `security.policies.firstSeen` of vis.config into `pnpm-workspace.yaml` and `package.json`. It makes no request, so the native path is a port of the file edits and the pail output, gated like `security list`: a unix CI run off a terminal at the root of a pnpm workspace, a config readable as data, and pail's layout decided by the environment. The yaml is edited with the same line rules as the Node code (a block ends at the first line without two blanks) and read through the strict grammar of `security list`; `package.json` goes through the JS-faithful JSON module. The files are written like `@visulima/fs` does: a sibling temporary file, renamed over the target, after every file is staged. Whatever the port cannot reproduce exactly is handed to Node before anything is printed or written: other flags, other package managers, truthy allow values other than `true`, names with `$` or outside ASCII, yaml or json outside the supported grammar, a non-root collation, and messages that would wrap. Adds the launcher gate, the route row, the shared routing cases and a native-vs-Node parity suite that also compares file modes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e path The module no longer needs a unix-only gate (the run itself is still declined off unix by the CI-root context), so nothing is dead code on Windows. A failure to replace the first file now hands the run to Node, since no target has changed by then. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
ⓘ Qodo did not review this PR because this workspace reached its daily trial limit of 100 reviews. Reviews start again at 00:00 UTC. Choose a plan to continue now. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Thank you for following the naming conventions! 🙏 |
Drop a one-use binding and correct a doc comment. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
# Conflicts: # packages/tooling/vis/native/cli/tests/fixtures/routing.json
What
vis security syncnow runs in the native binary for pnpm workspaces, without starting Node. It pushessecurity.policies.installScripts.allowandsecurity.policies.firstSeenofvis.configintopnpm-workspace.yamlandpackage.json, and prints the same pail lines as the Node command.The command makes no request, so it doesn't use the HTTP client (
native/cli/src/http/is untouched).Native
security syncwith--skip-allow-buildsand/or--skip-min-release-age, each at most once, in either order.vis.configreadable as data (the reader ofsecurity list, now shared throughsync_input). A config without asecurityblock syncs the loader's defaults, like Node.pnpm-workspace.yamlfollow the line rules of the Node code (a block ends at the first line without two blanks). The file is read through the strict grammar ofsecurity listwhere Node parses it.package.jsongoes through the JS-faithful JSON module.@visulima/fsdoes: a sibling temporary file renamed over the target. Everything is staged before the first rename.Node resets a rewritten file's mode to the default for a new file, so native does too. The parity suite compares modes.
Handed to Node before any output or write
allowvalue that isn'ttrue, names containing$or outside ASCII, or non-integerminutes.allowBuildsis read, nested maps, inline comments, fractions inpackage.json).Tests
security-sync-parity.test.ts: native vs Node for stdout, stderr, exit status, written bytes and file modes, plus the declined cases (exit 70, files untouched), also underFORCE_COLOR=3/CI colour environments.bin/route.mjs,route.rs, the sharedrouting.jsoncases and the route snapshot.The first commit is the two-line import fix from #252, so this branch compiles on
next; it merges cleanly with #252.Not verified: Windows (the command is declined there) and Linux (only run on macOS here).
🤖 Generated with Claude Code