feat(reporter): emit pnpm:context at install start#354
Conversation
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #354 +/- ##
==========================================
+ Coverage 88.55% 88.57% +0.01%
==========================================
Files 65 65
Lines 5769 5784 +15
==========================================
+ Hits 5109 5123 +14
- Misses 660 661 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Scenario: Frozen Lockfile
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.7640885919400002,
"stddev": 0.08368640518456263,
"median": 2.7770964402400002,
"user": 2.40487346,
"system": 3.37183728,
"min": 2.65261093924,
"max": 2.9009532052400004,
"times": [
2.81818626624,
2.78114023424,
2.85196854324,
2.80712065824,
2.67451327424,
2.70054251624,
2.6807976362400003,
2.65261093924,
2.9009532052400004,
2.77305264624
]
},
{
"command": "pacquet@main",
"mean": 2.69359111464,
"stddev": 0.049144216012903856,
"median": 2.68267707724,
"user": 2.40979466,
"system": 3.33940578,
"min": 2.6121138962400003,
"max": 2.7971228002400004,
"times": [
2.6876682572400004,
2.7971228002400004,
2.66879468824,
2.6121138962400003,
2.6806052102400004,
2.72688991624,
2.67252233724,
2.6730340972400004,
2.7324109992400003,
2.6847489442400003
]
},
{
"command": "pnpm",
"mean": 6.655084771740002,
"stddev": 0.07081937110567853,
"median": 6.67093649624,
"user": 9.251535360000002,
"system": 4.451146679999999,
"min": 6.55222988624,
"max": 6.73183391524,
"times": [
6.58127847324,
6.55222988624,
6.7076541052400005,
6.62677957724,
6.6542619182400005,
6.73183391524,
6.56035527324,
6.72227056324,
6.68761107424,
6.72657293124
]
}
]
}Scenario: Frozen Lockfile (Hot Cache)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7162617503,
"stddev": 0.033006086479589455,
"median": 0.7010187447,
"user": 0.25279358,
"system": 1.3474599599999997,
"min": 0.6869276002000001,
"max": 0.7875483962000001,
"times": [
0.7875483962000001,
0.7403634332000001,
0.6921857572000001,
0.6922518582000001,
0.7000107482000001,
0.7489482432000001,
0.7020267412000001,
0.7200840312000001,
0.6869276002000001,
0.6922706942000001
]
},
{
"command": "pacquet@main",
"mean": 0.7310338188000001,
"stddev": 0.027856591893837334,
"median": 0.7195884477000001,
"user": 0.25700848,
"system": 1.35390746,
"min": 0.7014542512,
"max": 0.7836205362,
"times": [
0.7615435232000001,
0.7208874852000001,
0.7014542512,
0.7064111492,
0.7192053472000001,
0.7166897972,
0.7836205362,
0.7172055692000001,
0.7633489812,
0.7199715482000001
]
},
{
"command": "pnpm",
"mean": 2.6445505925,
"stddev": 0.11655103937802802,
"median": 2.5814654207,
"user": 3.18492308,
"system": 2.2069262599999995,
"min": 2.5557841992,
"max": 2.9081002442,
"times": [
2.7555545971999997,
2.5838814162,
2.5699191152,
2.9081002442,
2.6489086762,
2.5790494252,
2.5648433092,
2.5557841992,
2.7192241081999997,
2.5602408342
]
}
]
} |
3741e62 to
76c6ffa
Compare
Adds the `Context` variant to `LogEvent` (camelCase serde so the wire shape matches `@pnpm/cli.default-reporter`'s expectations) and emits it once from `Install::run`, immediately before `pnpm:stage importing_started`. Mirrors pnpm's emit at https://github.com/pnpm/pnpm/blob/086c5e91e8/installing/context/src/index.ts#L196. `currentLockfileExists` is hard-coded `false` for now because pacquet doesn't read or write `node_modules/.pnpm/lock.yaml` yet. The site carries a TODO so the value gets flipped when that path lands. Test: extends the existing recording-fake DI test (per #339) to assert the full event sequence (`Context`, `ImportingStarted`, `ImportingDone`) and spot-checks the context payload's directory fields. Verified the test catches the regression by temporarily commenting out the emit and confirming a fail; restored. Refs #347. Engine: #345.
a6a2ab4 to
f8a4e47
Compare
|
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 ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds the pnpm:context reporting channel so installs emit pnpm-compatible “install context” metadata at the start of the install run, matching pnpm’s NDJSON wire shape for @pnpm/cli.default-reporter.
Changes:
- Add
LogEvent::ContextandContextLogpayload with camelCase serde field naming for pnpm wire-compatibility. - Emit
pnpm:contextonce at the start ofInstall::run, immediately before the existingpnpm:stage importing_started. - Add/extend tests to validate JSON shape and that the install emits
[Context, ImportingStarted, ImportingDone]in order.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/reporter/src/lib.rs | Introduces LogEvent::Context and ContextLog (camelCase) for the pnpm pnpm:context channel. |
| crates/reporter/src/tests.rs | Adds a serialization test asserting the pnpm:context record’s wire shape and field casing. |
| crates/package-manager/src/install.rs | Emits the new context event at install start and updates the install event-sequence test accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds the `Summary` variant to `LogEvent` and emits it from `Install::run` immediately after `pnpm:stage importing_done`. Mirrors pnpm's emit at https://github.com/pnpm/pnpm/blob/086c5e91e8/installing/deps-installer/src/install/index.ts#L1663. The payload carries only `prefix`; the reporter combines this with the accumulated `pnpm:root` events (still TODO under #347) to render the final "+N -M" diff block. Test: extends the install integration test (renamed to `install_emits_pnpm_event_sequence` to match the growing scope) to assert the four-event success sequence (`Context`, `ImportingStarted`, `ImportingDone`, `Summary`) and spot-checks summary's `prefix`. Verified the test catches the regression by temporarily commenting out the emit and confirming it failed with a Summary-shaped gap. Refs #347. Engine: #345. Previous channel: #354.
Adds the `Summary` variant to `LogEvent` and emits it from `Install::run` immediately after `pnpm:stage importing_done`. Mirrors pnpm's emit at https://github.com/pnpm/pnpm/blob/086c5e91e8/installing/deps-installer/src/install/index.ts#L1663. The payload carries only `prefix`; the reporter combines this with the accumulated `pnpm:root` events (still TODO under #347) to render the final "+N -M" diff block. Test: extends the install integration test (renamed to `install_emits_pnpm_event_sequence` to match the growing scope) to assert the four-event success sequence (`Context`, `ImportingStarted`, `ImportingDone`, `Summary`) and spot-checks summary's `prefix`. Verified the test catches the regression by temporarily commenting out the emit and confirming it failed with a Summary-shaped gap. Refs #347. Engine: #345. Previous channel: #354.
* feat(reporter): emit pnpm:summary at install end Adds the `Summary` variant to `LogEvent` and emits it from `Install::run` immediately after `pnpm:stage importing_done`. Mirrors pnpm's emit at https://github.com/pnpm/pnpm/blob/086c5e91e8/installing/deps-installer/src/install/index.ts#L1663. The payload carries only `prefix`; the reporter combines this with the accumulated `pnpm:root` events (still TODO under #347) to render the final "+N -M" diff block. Test: extends the install integration test (renamed to `install_emits_pnpm_event_sequence` to match the growing scope) to assert the four-event success sequence (`Context`, `ImportingStarted`, `ImportingDone`, `Summary`) and spot-checks summary's `prefix`. Verified the test catches the regression by temporarily commenting out the emit and confirming it failed with a Summary-shaped gap. Refs #347. Engine: #345. Previous channel: #354. * docs(reporter): clarify SummaryLog payload comment Per review feedback on #355: the original wording said the `pnpm:summary` payload "is just `prefix`", which omitted the `level` field that's also part of the serialized record. `level` is the bunyan-envelope severity carried by every channel, not channel-specific to summary; say so explicitly so a reader doesn't try to "fix" the struct based on the comment. Same fix applied to the wire-shape test's doc comment.
Summary
First channel from the backfill (#347). Adds the
Contextvariant toLogEventand emits it once fromInstall::runimmediately before theexisting
pnpm:stage importing_started.Mirrors pnpm's emit at
installing/context/src/index.ts:196.The wire format uses camelCase serde so the record renders identically
through
@pnpm/cli.default-reporter.currentLockfileExistsis hard-codedfalsebecause pacquet doesn'tyet read or write
node_modules/.pnpm/lock.yaml. The emit site carriesa TODO so the value gets flipped when that path lands.
Convention compliance
Per the per-PR conventions in #347:
LogEvent::Contextmirrors the upstream payload field-for-field.a pinned SHA (
086c5e91e8).install_emits_pnpm_event_sequence.out the emit, confirmed the test failed with
unexpected event sequence: [Stage(...ImportingStarted), Stage(...ImportingDone)],restored the emit.
pnpm:contextbox in chore(reporter): backfill missing log events in already-ported code #347 on merge.Test plan
cargo nextest run -p pacquet-reporter— 5 tests, all passing (the new
context_event_matches_pnpm_wire_shapeasserts the camelCase JSON shape).
cargo nextest run -p pacquet-package-manager install_emits_pnpm_event_sequence— passes; full sequence and payload spot-checked.
just ready— 254 tests pass, lint clean.pacquet install --reporter=ndjsonemits apnpm:contextline before thepnpm:stagelines.References
core/core-loggers/src/contextLogger.ts.installing/context/src/index.ts:196.