Repository navigation
feat(pacquet-cli): implement the pnpm view command - #13181
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds the ChangesView command
CLI startup stack
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant CliCommand
participant QueryView
participant ViewRun
participant Registry
CLI->>CliCommand: parse view arguments
CliCommand->>QueryView: route ViewArgs
QueryView->>ViewRun: resolve config and directory
ViewRun->>Registry: fetch package metadata
Registry-->>ViewRun: return packument
ViewRun-->>CLI: render summary or selected output
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 4/5The The implementation is well-structured and the integration suite covers the main paths. The outstanding gap is in pnpm/crates/cli/src/cli_args/view.rs — specifically the multi-field JSON path in Reviews (8): Last reviewed commit: "docs(cli): clarify when view skips print..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/cli/tests/view.rs (1)
715-732: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winRemove the ignored test.
As per path instructions, do not ignore failing tests; every failure must be investigated and fixed as part of the PR. Since
package.yamlandpackage.json5are not yet supported, please remove this test completely. It can be safely introduced in a future PR alongside the actual functionality implementation.♻️ Proposed fix to remove the test
-#[test] -#[ignore = "pacquet's project-manifest reader (pnpm_workspace::try_read_project_manifest) \ - reads package.json only; package.yaml / package.json5 are not supported yet"] -fn uses_package_yaml_name_when_package_omitted() { - let CommandTempCwd { root, workspace, .. } = CommandTempCwd::init(); - let mut server = mockito::Server::new(); - write_registry_npmrc(&workspace, &format!("{}/", server.url())); - fs::write(workspace.join("package.yaml"), "name: is-negative\n").expect("write package.yaml"); - let mock = serve(&mut server, "/is-negative", &is_negative_body()); - let auth_file = empty_auth_file(root.path()); - - let output = run_view(&workspace, &auth_file, &[]); - - mock.assert(); - assert!(stdout_of(&output).contains("is-negative"), "summary derived from package.yaml name"); - drop((root, server)); -}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/view.rs` around lines 715 - 732, Remove the ignored test function uses_package_yaml_name_when_package_omitted and its associated setup entirely; do not replace it with another ignored test, since package.yaml support is not implemented.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/cli/src/cli_args/view.rs`:
- Around line 463-465: In the documentation comment describing the
published-time line near the relevant view formatting code, replace
“unparseable” with the repository-approved spelling “unparsable”; leave the rest
of the comment unchanged.
---
Outside diff comments:
In `@pnpm/crates/cli/tests/view.rs`:
- Around line 715-732: Remove the ignored test function
uses_package_yaml_name_when_package_omitted and its associated setup entirely;
do not replace it with another ignored test, since package.yaml support is not
implemented.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b8e84deb-49e3-412c-a8d2-3aacbaec004d
📒 Files selected for processing (8)
pnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/switch_cli_version.rspnpm/crates/cli/src/cli_args/view.rspnpm/crates/cli/src/cli_args/view/tests.rspnpm/crates/cli/tests/view.rs
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4581047168600003,
"stddev": 0.10421026303831014,
"median": 2.4146731717599996,
"user": 1.4809921199999998,
"system": 1.2865927,
"min": 2.35473563976,
"max": 2.63089482076,
"times": [
2.5203452077599997,
2.39681848976,
2.38160368476,
2.60701025876,
2.63089482076,
2.37903391976,
2.43252785376,
2.35473563976,
2.5224289297599998,
2.35564836376
]
},
{
"command": "pacquet@main",
"mean": 2.6411405645599997,
"stddev": 0.14780809593030736,
"median": 2.64968455376,
"user": 1.5095982199999998,
"system": 1.3072912,
"min": 2.36149390976,
"max": 2.80274403376,
"times": [
2.64466537576,
2.6129148547599996,
2.80274403376,
2.64447404576,
2.77144824576,
2.80150860376,
2.69105328676,
2.36149390976,
2.42639955776,
2.6547037317599997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.53195776186,
"stddev": 0.14486338414042707,
"median": 1.46005573526,
"user": 1.05179802,
"system": 1.1590107,
"min": 1.37574102576,
"max": 1.75381110176,
"times": [
1.37574102576,
1.67977557176,
1.41492298976,
1.63307279976,
1.42529604476,
1.75381110176,
1.48095071476,
1.7092277477600002,
1.40761886676,
1.4391607557600001
]
},
{
"command": "pnpr@main",
"mean": 1.50327458526,
"stddev": 0.14569312532220766,
"median": 1.4611961767600001,
"user": 1.0971381199999999,
"system": 1.1211237,
"min": 1.3381099757600001,
"max": 1.73814599176,
"times": [
1.40132448876,
1.5138091157600002,
1.39605015676,
1.4291766807600002,
1.36598102276,
1.65888258576,
1.6980501617600001,
1.3381099757600001,
1.73814599176,
1.4932156727600001
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.26179620006,
"stddev": 0.010784839341376048,
"median": 0.26003269396,
"user": 0.20517124,
"system": 0.5473961999999999,
"min": 0.25163794295999997,
"max": 0.29016612896,
"times": [
0.26524569196,
0.25936872796,
0.25901519296,
0.25163794295999997,
0.26069665996,
0.25531054896,
0.26092949796,
0.25348210496,
0.26210950396,
0.29016612896
]
},
{
"command": "pacquet@main",
"mean": 0.26025853296,
"stddev": 0.00545449045634929,
"median": 0.25908793546,
"user": 0.21708163999999996,
"system": 0.5326376999999999,
"min": 0.24994262996000002,
"max": 0.26696255496,
"times": [
0.25887613296,
0.26480962196,
0.26671521995999997,
0.25929973796,
0.25776587796,
0.26472782896,
0.25710485696,
0.24994262996000002,
0.26696255496,
0.25638086796
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28088174146,
"stddev": 0.011655444280430827,
"median": 0.28111709446,
"user": 0.21430164000000002,
"system": 0.5571135,
"min": 0.26493710096,
"max": 0.29805817596,
"times": [
0.29176688396,
0.27988861196,
0.27006612196,
0.26590122196,
0.29805817596,
0.28241785196,
0.27835456195999997,
0.26493710096,
0.28234557696,
0.29508130696
]
},
{
"command": "pnpr@main",
"mean": 0.26807307556,
"stddev": 0.007439297797496131,
"median": 0.26782045046,
"user": 0.22898873999999997,
"system": 0.5169857999999999,
"min": 0.25692779496,
"max": 0.27965806996,
"times": [
0.27227731296,
0.27014313596,
0.27965806996,
0.27767162996,
0.26191637196,
0.26549776496,
0.26120678796,
0.25692779496,
0.26361546996,
0.27181641696
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.77931212274,
"stddev": 0.027772669005122843,
"median": 2.78082824474,
"user": 1.7110688800000002,
"system": 1.32190072,
"min": 2.73844501924,
"max": 2.82098638224,
"times": [
2.7999443832399997,
2.82098638224,
2.77532565224,
2.78512767824,
2.74565864724,
2.74878692924,
2.79709852324,
2.77652881124,
2.73844501924,
2.80521920124
]
},
{
"command": "pacquet@main",
"mean": 2.79285912904,
"stddev": 0.029038423878770432,
"median": 2.78972104174,
"user": 1.7385000800000001,
"system": 1.3196480199999996,
"min": 2.74138080024,
"max": 2.83295129724,
"times": [
2.80451215524,
2.83295129724,
2.77539298824,
2.74138080024,
2.82778420924,
2.7722806582399997,
2.77415025424,
2.78254744724,
2.79689463624,
2.82069684424
]
},
{
"command": "pnpr@HEAD",
"mean": 1.65066801774,
"stddev": 0.17466590785407782,
"median": 1.58723618324,
"user": 1.23491028,
"system": 1.34354812,
"min": 1.45675398924,
"max": 1.95930030024,
"times": [
1.45675398924,
1.54341860224,
1.4656045152400001,
1.5302778062400002,
1.8589211352400001,
1.61384577924,
1.8098717772400001,
1.70805968524,
1.95930030024,
1.56062658724
]
},
{
"command": "pnpr@main",
"mean": 1.60331011494,
"stddev": 0.12804554160002882,
"median": 1.5835353147400002,
"user": 1.1644691800000002,
"system": 1.21822922,
"min": 1.4538248742400002,
"max": 1.8439918652400002,
"times": [
1.4538248742400002,
1.7266079062400002,
1.5265074032400001,
1.49224272424,
1.5808970292400002,
1.68882322424,
1.8439918652400002,
1.67450451924,
1.4595280032400002,
1.5861736002400002
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.63697360592,
"stddev": 0.02387036851279574,
"median": 0.6372680594200001,
"user": 0.7899328599999998,
"system": 0.67181642,
"min": 0.6025609124200001,
"max": 0.67855988142,
"times": [
0.6555140504200001,
0.67855988142,
0.61185921842,
0.6025609124200001,
0.6142121634200001,
0.6548068934200001,
0.6420637024200001,
0.6520862684200001,
0.6324724164200001,
0.62560055242
]
},
{
"command": "pacquet@main",
"mean": 0.59620986482,
"stddev": 0.030923883778854147,
"median": 0.5910519029200001,
"user": 0.71967316,
"system": 0.6584637199999998,
"min": 0.56337822242,
"max": 0.64523257842,
"times": [
0.64523257842,
0.6043430164200001,
0.56887111042,
0.59454270742,
0.6405255564200001,
0.62193533442,
0.56838719142,
0.56732183242,
0.56337822242,
0.58756109842
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32275579292,
"stddev": 0.008874006040836165,
"median": 0.32076672092,
"user": 0.20912385999999997,
"system": 0.5671717199999999,
"min": 0.31182452642,
"max": 0.33953915842000004,
"times": [
0.33263839142,
0.31711352142000004,
0.31600384942000004,
0.31853469742,
0.32439208842000006,
0.33953915842000004,
0.31182452642,
0.32972023542,
0.32299874442000004,
0.31479271642
]
},
{
"command": "pnpr@main",
"mean": 0.32498543822000003,
"stddev": 0.008858289874233687,
"median": 0.32290954142000006,
"user": 0.22316605999999997,
"system": 0.5684155199999998,
"min": 0.31554218242000004,
"max": 0.34388054442000004,
"times": [
0.33048076242,
0.31628007642000006,
0.33071292842000005,
0.32998065342000005,
0.31991035842000004,
0.32189982142,
0.31724779342000003,
0.31554218242000004,
0.34388054442000004,
0.32391926142000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9222224681,
"stddev": 0.018938264231303743,
"median": 1.9201355116,
"user": 0.9370754800000001,
"system": 0.7895057799999999,
"min": 1.8849275356000001,
"max": 1.9472309556,
"times": [
1.9143790146000002,
1.9074432516000002,
1.8849275356000001,
1.9234188276000002,
1.9390084486,
1.9444916826,
1.9168521956,
1.9472309556,
1.9143725216,
1.9301002476000002
]
},
{
"command": "pacquet@main",
"mean": 1.9159269053999999,
"stddev": 0.02852459407678583,
"median": 1.9150775546000003,
"user": 0.9670168799999999,
"system": 0.7582178800000001,
"min": 1.8843438066000002,
"max": 1.9858131626000002,
"times": [
1.9180563646000002,
1.9289310036,
1.9020334056000001,
1.9045220046000002,
1.9858131626000002,
1.9120987446000002,
1.9192469786000002,
1.8843438066000002,
1.8857234356,
1.9185001476
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32864240110000004,
"stddev": 0.014558643776174775,
"median": 0.3264420471,
"user": 0.22716018,
"system": 0.5482794799999999,
"min": 0.30830163160000007,
"max": 0.35398068860000004,
"times": [
0.32711988960000005,
0.32472342260000003,
0.30830163160000007,
0.31611046760000006,
0.31414500860000005,
0.32873549160000004,
0.34312627660000006,
0.35398068860000004,
0.34441692960000003,
0.32576420460000005
]
},
{
"command": "pnpr@main",
"mean": 0.3256319483000001,
"stddev": 0.014235081671460034,
"median": 0.33106995710000003,
"user": 0.22920298,
"system": 0.54721288,
"min": 0.29507971860000004,
"max": 0.33839977760000006,
"times": [
0.33024967260000004,
0.3375555626,
0.33540213160000004,
0.33806540060000007,
0.33839977760000006,
0.31762271560000005,
0.3318902416,
0.29507971860000004,
0.31242716560000006,
0.31962709660000005
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.39419934015999997,
"stddev": 0.02021780253977315,
"median": 0.39883519156,
"user": 0.3830291,
"system": 0.06457988,
"min": 0.35809774656,
"max": 0.41751919156,
"times": [
0.36713141956,
0.35809774656,
0.37666542156,
0.39552640856,
0.39799286556,
0.39967751756000003,
0.41293429656,
0.40750782256,
0.40894071156,
0.41751919156
]
},
{
"command": "pacquet@main",
"mean": 0.39721267646,
"stddev": 0.013985859039971448,
"median": 0.39189838456000003,
"user": 0.3954775,
"system": 0.05492187999999999,
"min": 0.38365926756,
"max": 0.42849117156,
"times": [
0.39574758356,
0.38365926756,
0.42849117156,
0.39000673856,
0.38438222456,
0.39082394356,
0.39297282556,
0.40825169856,
0.40872900456,
0.38906230656
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09588246949548389,
"stddev": 0.00414217101454964,
"median": 0.09596674356000001,
"user": 0.025766254838709673,
"system": 0.010664599354838707,
"min": 0.08747529956000001,
"max": 0.10487916956000001,
"times": [
0.08973720256,
0.09190649456000001,
0.08798583556,
0.08747529956000001,
0.09299796256000001,
0.09752038956,
0.09472717756000001,
0.10217161856000001,
0.10487916956000001,
0.09780713756000001,
0.09340142956000001,
0.09069809656000001,
0.09469386556,
0.09443677256,
0.09260966356000001,
0.10145736756000001,
0.10222583056000001,
0.09875718056,
0.09571884756000001,
0.09666853056000001,
0.09964831256000001,
0.09757676456000001,
0.09659767756000001,
0.09596674356000001,
0.09673447456,
0.09637873656000001,
0.09265381756,
0.09820796956000001,
0.10106637456,
0.09538282856000001,
0.09426698256
]
},
{
"command": "pnpr@main",
"mean": 0.09162511038758622,
"stddev": 0.0049356341004713885,
"median": 0.09091327956,
"user": 0.02339869310344827,
"system": 0.00981782896551724,
"min": 0.08569364456,
"max": 0.10433011956,
"times": [
0.09595273756000001,
0.09370761556000001,
0.09903458056,
0.09589666256000001,
0.09212863056000001,
0.10001923856000002,
0.10433011956,
0.09494826256000001,
0.09336352856,
0.09471112756000001,
0.09338309556,
0.09866302356000001,
0.09464057556000001,
0.09091327956,
0.08730573956000001,
0.08895745856000001,
0.08981978856,
0.09170477556000001,
0.08668949356000001,
0.08859913656000001,
0.08713212356000001,
0.08587028556000001,
0.08645451156,
0.08690663156,
0.08779181156,
0.08828494756000001,
0.08569364456,
0.08792556256,
0.08629981256000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.59931586132,
"stddev": 0.14168235076093078,
"median": 4.51884789472,
"user": 1.90052336,
"system": 1.4841048799999998,
"min": 4.484723120220001,
"max": 4.835644862220001,
"times": [
4.7235972552200005,
4.48542431422,
4.82808889122,
4.5201825942200005,
4.499147418220001,
4.835644862220001,
4.51751319522,
4.484723120220001,
4.58789503822,
4.51094192422
]
},
{
"command": "pacquet@main",
"mean": 4.667340113920001,
"stddev": 0.1441236550445362,
"median": 4.64662980272,
"user": 2.00382626,
"system": 1.5471830800000002,
"min": 4.479102060220001,
"max": 4.901557155220001,
"times": [
4.49068964022,
4.479102060220001,
4.76337331722,
4.64820558322,
4.83171492822,
4.901557155220001,
4.7666983402200005,
4.55275490422,
4.64505402222,
4.59425118822
]
},
{
"command": "pnpr@HEAD",
"mean": 3.59948081342,
"stddev": 0.12916156478192162,
"median": 3.53154025122,
"user": 1.3857628600000003,
"system": 1.3615729799999998,
"min": 3.49268114322,
"max": 3.87019891122,
"times": [
3.50577128422,
3.5012749952199997,
3.54831851122,
3.87019891122,
3.49268114322,
3.6485381872200002,
3.50471489122,
3.74831236522,
3.51476199122,
3.66023585422
]
},
{
"command": "pnpr@main",
"mean": 3.5665874054199995,
"stddev": 0.12215903197974477,
"median": 3.51002716622,
"user": 1.32276736,
"system": 1.3228381799999998,
"min": 3.47361887122,
"max": 3.81189033122,
"times": [
3.81189033122,
3.47361887122,
3.50184092922,
3.65840276522,
3.47442601622,
3.72578400322,
3.51821340322,
3.47736352922,
3.47471539822,
3.54961880722
]
}
]
} |
fb9b44d to
0acfa98
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13181 +/- ##
==========================================
+ Coverage 86.68% 86.72% +0.04%
==========================================
Files 522 523 +1
Lines 87872 88287 +415
==========================================
+ Hits 76168 76571 +403
- Misses 11704 11716 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0acfa98 to
666cb4a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm/crates/cli/src/lib.rs (1)
121-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDeduplicate scoped thread logic.
run_on_big_stackelegantly encapsulates the exact thread-spawning and panic-propagation logic that is currently duplicated in the unmodifiedblock_on_runtimefunction just below it. By parameterizing the thread name,block_on_runtimecan reuse this helper to streamline the code.♻️ Proposed refactor for `run_on_big_stack`
-fn run_on_big_stack<Work, Output>(work: Work) -> Output +fn run_on_big_stack<Work, Output>(thread_name: &str, work: Work) -> Output where Work: FnOnce() -> Output + Send, Output: Send, { std::thread::scope(|scope| { std::thread::Builder::new() - .name("pacquet-startup".to_string()) + .name(thread_name.to_string()) .stack_size(MAIN_STACK_SIZE) .spawn_scoped(scope, work) - .expect("spawn the pacquet startup thread") + .expect("spawn the big-stack thread") .join() .unwrap_or_else(|payload| std::panic::resume_unwind(payload)) }) }Then, apply these changes to the surrounding caller logic to use the updated signature:
@@ -29,3 +29,3 @@ // the whole path has uniform headroom. - run_on_big_stack(run_cli) + run_on_big_stack("pacquet-startup", run_cli) }@@ -140,25 +140,12 @@ fn block_on_runtime<Work, Output>(thread_name: &str, work: Work) -> Output where Work: Future<Output = Output> + Send, Output: Send, { - std::thread::scope(|scope| { - let handle = std::thread::Builder::new() - .name(thread_name.to_string()) - .stack_size(MAIN_STACK_SIZE) - .spawn_scoped(scope, move || { - tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .expect("build the tokio runtime") - // Boxed for `clippy::large_futures`: the command future - // exceeds the lint's stack-size threshold. - .block_on(Box::pin(work)) - }) - .expect("spawn the pacquet runtime thread"); - handle - .join() - // Re-raise a panic from the worker on this thread so the process - // still aborts with the original message and backtrace. - .unwrap_or_else(|payload| std::panic::resume_unwind(payload)) - }) + run_on_big_stack(thread_name, move || { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .expect("build the tokio runtime") + // Boxed for `clippy::large_futures`: the command future + // exceeds the lint's stack-size threshold. + .block_on(Box::pin(work)) + }) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/src/lib.rs` around lines 121 - 140, Update run_on_big_stack to accept the thread name as a parameter while preserving its stack size, scoped spawning, joining, and panic propagation behavior. Refactor block_on_runtime to call run_on_big_stack with its existing thread name and runtime-building closure, removing the duplicated scoped-thread logic while keeping its current runtime behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/cli/src/cli_args/view/tests.rs`:
- Around line 67-71: Add diagnostic logging immediately before the non-assert_eq
assertions in parse_date_accepts_iso_timestamps_only, using eprintln! or dbg! to
show the parsed results and input context while preserving the existing
assertions and test behavior.
---
Nitpick comments:
In `@pnpm/crates/cli/src/lib.rs`:
- Around line 121-140: Update run_on_big_stack to accept the thread name as a
parameter while preserving its stack size, scoped spawning, joining, and panic
propagation behavior. Refactor block_on_runtime to call run_on_big_stack with
its existing thread name and runtime-building closure, removing the duplicated
scoped-thread logic while keeping its current runtime behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e29bf960-c351-4f9c-995c-e700bfbbdf63
📒 Files selected for processing (9)
pnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/switch_cli_version.rspnpm/crates/cli/src/cli_args/view.rspnpm/crates/cli/src/cli_args/view/tests.rspnpm/crates/cli/src/lib.rspnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (7)
- pnpm/crates/cli/src/cli_args/switch_cli_version.rs
- pnpm/crates/cli/src/cli_args/dispatch.rs
- pnpm/crates/cli/src/cli_args/cli_command.rs
- pnpm/crates/cli/src/cli_args.rs
- pnpm/crates/cli/src/cli_args/dispatch_query.rs
- pnpm/crates/cli/tests/view.rs
- pnpm/crates/cli/src/cli_args/view.rs
The synchronous startup — building the negation-augmented clap command (a recursive walk over every subcommand) and parsing argv — runs on the OS main thread, whose default stack is 1 MiB on Windows (Linux and macOS default to 8 MiB). That path sits close enough to the limit that a single added subcommand can overflow it. `block_on_runtime` already runs the command body on a `MAIN_STACK_SIZE` thread; run the parsing startup that precedes it on one too so the whole path has uniform headroom on every platform. Co-Authored-By: Claude Opus 4.8 <[email protected]>
666cb4a to
881eef5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/view.rs (1)
29-112: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider a shared setup helper to cut per-test boilerplate.
Nearly every test repeats the same
CommandTempCwd::init()→mockito::Server::new()→write_registry_npmrc→serve(...)→empty_auth_filesequence. A small helper bundling these (returning the pieces each test needs) would reduce duplication across ~20 tests without changing behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/cli/tests/view.rs` around lines 29 - 112, Introduce a shared test setup helper near the existing helpers that performs the repeated CommandTempCwd initialization, mockito server creation, registry npmrc writing, mock response setup, and empty_auth_file creation, returning the workspace, server/mock, and auth-file values needed by callers. Update the affected view tests to use this helper while preserving their existing package paths, response bodies, arguments, and assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/cli/tests/view.rs`:
- Around line 29-112: Introduce a shared test setup helper near the existing
helpers that performs the repeated CommandTempCwd initialization, mockito server
creation, registry npmrc writing, mock response setup, and empty_auth_file
creation, returning the workspace, server/mock, and auth-file values needed by
callers. Update the affected view tests to use this helper while preserving
their existing package paths, response bodies, arguments, and assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 01294552-4a39-4534-8316-255bd333996a
📒 Files selected for processing (9)
pnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/switch_cli_version.rspnpm/crates/cli/src/cli_args/view.rspnpm/crates/cli/src/cli_args/view/tests.rspnpm/crates/cli/src/lib.rspnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (6)
- pnpm/crates/cli/src/cli_args/dispatch.rs
- pnpm/crates/cli/src/cli_args/view/tests.rs
- pnpm/crates/cli/src/cli_args/dispatch_query.rs
- pnpm/crates/cli/src/lib.rs
- pnpm/crates/cli/src/cli_args/switch_cli_version.rs
- pnpm/crates/cli/src/cli_args/view.rs
881eef5 to
0a5b163
Compare
Port the `view` command (aliases `info`, `show`, `v`) to pacquet: fetch a package's registry metadata and render a formatted summary, a JSON dump (`--json`), or selected dotted fields. When the package name is omitted, the nearest project manifest's name is used, searching upward from `--dir`. Reuses the existing metadata-fetch stack (full-metadata fetch, `pick_package_from_meta` version selection, registry/auth resolution) and assembles the info object from the picked version's raw JSON fragment so registry key order is preserved in `--json` output. Error codes match pnpm: ERR_PNPM_MISSING_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_JSON, ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404. The TypeScript pnpm CLI already ships `view`, so this only adds the pacquet side; no TypeScript change is needed. Covers the `view` item under the Stage 3 command surface in pnpm#11633. Tests: unit tests for the pure helpers (byte/time/field formatting) plus an integration suite that drives the built binary against a mockito registry, covering the upstream view scenarios. `package.yaml` name resolution is left as an ignored test — pacquet's project-manifest reader is package.json only today. Co-Authored-By: Claude Opus 4.8 <[email protected]>
0a5b163 to
97a283a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/cli/src/cli_args/view/tests.rs`:
- Around line 136-138: Update the assertions in
pnpm/crates/cli/src/cli_args/view/tests.rs at lines 136-138, 147-148, 167-170,
172-173, 204-205, and 215-216 to provide diagnostic context: replace simple
assert! checks with assert_eq! comparisons where appropriate, or include the
tested values in custom messages/debug output. Cover the bin_summary results,
with_email, no_email, many, future, and with_email format assertions without
changing their expected behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 078aa9d6-eed0-4903-9498-55e1fc6615d7
📒 Files selected for processing (8)
pnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/switch_cli_version.rspnpm/crates/cli/src/cli_args/view.rspnpm/crates/cli/src/cli_args/view/tests.rspnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (7)
- pnpm/crates/cli/src/cli_args/switch_cli_version.rs
- pnpm/crates/cli/src/cli_args/cli_command.rs
- pnpm/crates/cli/src/cli_args.rs
- pnpm/crates/cli/src/cli_args/dispatch_query.rs
- pnpm/crates/cli/src/cli_args/dispatch.rs
- pnpm/crates/cli/src/cli_args/view.rs
- pnpm/crates/cli/tests/view.rs
|
| Branch | pr/13181 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,456.75 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 308.30 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 311.82 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 87.48 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,375.74 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,492.68 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 264.94 ms |
Add in-process unit tests for the pure `view` rendering helpers — the full summary block (every optional section), the bin / publisher / person / field-selection formatters, and the published-by line with and without a publisher and for a future or unparsable timestamp — plus an integration test that a version's object `author` collapses to its name. These exercise the branches the subprocess-driven integration suite left uncovered. Co-Authored-By: Claude Opus 4.8 <[email protected]>
97a283a to
c48ad1b
Compare
Review feedback: bare boolean assertions panic without showing what was being tested; give both parse_date assertions a diagnostic message, in line with the test-logging convention in the style guide. Co-Authored-By: Claude Fable 5 <[email protected]>
Review feedback: the comment implied every absent-field selection emits
no output, but a multi-field --json selection of absent fields prints {}
(as pnpm view does, printing whatever truthy string the handler
returns). Spell out both cases; no behavior change.
Co-Authored-By: Claude Fable 5 <[email protected]>
…aOutcome view.rs (added in pnpm#13181 after this branch forked from main) called pick_package_from_meta(...)?.ok_or_else(...), assuming the function returned Option<Arc<PackageVersion>>. The previous commit on this branch changed that return to PickFromMetaOutcome { package, latest }. Read .package before the ok_or_else.
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.
Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).
- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
threaded through pick_package, run_picker, pick_max,
pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
(npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
and build_resolve_result reads it via BuildResolveResult.latest.
Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.
Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.
Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).
- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
threaded through pick_package, run_picker, pick_max,
pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
(npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
and build_resolve_result reads it via BuildResolveResult.latest.
Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.
Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.
Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).
- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
threaded through pick_package, run_picker, pick_max,
pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
(npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
and build_resolve_result reads it via BuildResolveResult.latest.
Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.
Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.
Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).
- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
threaded through pick_package, run_picker, pick_max,
pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
(npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
and build_resolve_result reads it via BuildResolveResult.latest.
Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.
Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
Port the
viewcommand (aliasesinfo,show,v) to pacquet: fetch a package's registry metadata and render a formatted summary, a JSON dump (--json), or selected dotted fields. When the package name is omitted, the nearest project manifest's name is used, searching upward from--dir.Reuses the existing metadata-fetch stack (full-metadata fetch,
pick_package_from_metaversion selection, registry/auth resolution) and assembles the info object from the picked version's raw JSON fragment so registry key order is preserved in--jsonoutput. Error codes match pnpm: ERR_PNPM_MISSING_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_JSON, ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404.The TypeScript pnpm CLI already ships
view, so this only adds the pacquet side; no TypeScript change is needed. Covers theviewitem under the Stage 3 command surface in #11633.Tests: unit tests for the pure helpers (byte/time/field formatting) plus an integration suite that drives the built binary against a mockito registry, covering the upstream view scenarios.
package.yamlname resolution is left as an ignored test — pacquet's project-manifest reader is package.json only today.Summary
Implements the
pnpm viewcommand (aliasesinfo,show,v) in the pacquetRust CLI.
pacquet view [<pkg>[@<spec>]] [field...]fetches a package's registrymetadata and prints either a formatted summary, a JSON dump (
--json), orselected dotted fields (e.g.
dist.shasum). When the package name is omitted,the nearest project manifest's
nameis used, searching upward from--dir.The TypeScript pnpm CLI already ships
view, so this PR only adds the pacquetside — no TypeScript change is required. It covers the
viewitem in the Stage 3command surface of the Rust roadmap (Related to #11633).
Behavior parity:
pick_package_from_meta(exact / range / dist-tag).registry key order is preserved in
--jsonoutput.ERR_PNPM_MISSING_PACKAGE_NAME,ERR_PNPM_INVALID_PACKAGE_NAME,ERR_PNPM_INVALID_PACKAGE_JSON,ERR_PNPM_PACKAGE_NOT_FOUND,ERR_PNPM_FETCH_404.if_supports_colorconvention (styling off whenstdout is not a TTY).
Known limitation:
package.yaml/package.json5name resolution isn'tsupported — pacquet's project-manifest reader is
package.json-only today. Thecorresponding upstream test is ported as an
#[ignore]d test documenting thegap.
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting. — TheTypeScript CLI already ships
view; this PR adds the pacquet side to reachparity.
integration suite (mockito registry) covering the upstream
view.tsscenarios.
Made with the help of Claude Code (claude-opus-4-8).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
pacquet viewcommand (aliasesinfo,show,v) to display registry package info with version resolution (exact, semver ranges, dist-tags).package.json(supports-C/--dir).--jsonwith dotted-path field selection; absent fields output nothing.--jsonshapes, and registry/error/version-resolution scenarios (including 404).