Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

feat(reporter): emit pnpm:context at install start#354

Merged
zkochan merged 1 commit into
mainfrom
feat/reporter-context
May 1, 2026
Merged

feat(reporter): emit pnpm:context at install start#354
zkochan merged 1 commit into
mainfrom
feat/reporter-context

Conversation

@zkochan

@zkochan zkochan commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

First channel from the backfill (#347). Adds the Context variant to
LogEvent and emits it once from Install::run immediately before the
existing 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.

currentLockfileExists is hard-coded false because pacquet doesn't
yet read or write node_modules/.pnpm/lock.yaml. The emit site carries
a TODO so the value gets flipped when that path lands.

Convention compliance

Per the per-PR conventions in #347:

Test plan

  • cargo nextest run -p pacquet-reporter
    — 5 tests, all passing (the new context_event_matches_pnpm_wire_shape
    asserts 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.
  • Smoke check: pacquet install --reporter=ndjson emits a
    pnpm:context line before the pnpm:stage lines.

References

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.04     16.8±0.62ms   258.5 KB/sec    1.00     16.1±0.16ms   269.8 KB/sec

@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.57%. Comparing base (7097cdc) to head (f8a4e47).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/package-manager/src/install.rs 96.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

Integrated-Benchmark Report (Linux)

Scenario: Frozen Lockfile

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.764 ± 0.084 2.653 2.901 1.03 ± 0.04
pacquet@main 2.694 ± 0.049 2.612 2.797 1.00
pnpm 6.655 ± 0.071 6.552 6.732 2.47 ± 0.05
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)

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 716.3 ± 33.0 686.9 787.5 1.00
pacquet@main 731.0 ± 27.9 701.5 783.6 1.02 ± 0.06
pnpm 2644.6 ± 116.6 2555.8 2908.1 3.69 ± 0.24
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
      ]
    }
  ]
}

@zkochan zkochan force-pushed the feat/reporter-backfill-audit branch 2 times, most recently from 3741e62 to 76c6ffa Compare May 1, 2026 19:55
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.
@zkochan zkochan force-pushed the feat/reporter-context branch from a6a2ab4 to f8a4e47 Compare May 1, 2026 20:27
@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 93e93f9a-f019-47fb-b721-a18d353fc68a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reporter-context

Comment @coderabbitai help to get the list of available commands and usage tips.

@zkochan zkochan changed the base branch from feat/reporter-backfill-audit to main May 1, 2026 20:27
@zkochan zkochan requested a review from Copilot May 1, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::Context and ContextLog payload with camelCase serde field naming for pnpm wire-compatibility.
  • Emit pnpm:context once at the start of Install::run, immediately before the existing pnpm: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.

zkochan added a commit that referenced this pull request May 1, 2026
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.
@zkochan zkochan merged commit 5999435 into main May 1, 2026
18 of 19 checks passed
@zkochan zkochan deleted the feat/reporter-context branch May 1, 2026 20:36
@zkochan zkochan restored the feat/reporter-context branch May 1, 2026 20:40
zkochan added a commit that referenced this pull request May 1, 2026
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.
zkochan added a commit that referenced this pull request May 1, 2026
* 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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants