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

docs(guide/dev): don't ref private item from public docs#351

Merged
zkochan merged 6 commits into
mainfrom
claude/add-private-items-guidance-94HRm
Apr 30, 2026
Merged

docs(guide/dev): don't ref private item from public docs#351
zkochan merged 6 commits into
mainfrom
claude/add-private-items-guidance-94HRm

Conversation

@KSXGitHub

Copy link
Copy Markdown
Contributor

No description provided.

@KSXGitHub KSXGitHub requested a review from zkochan April 30, 2026 18:12
Comment thread CODE_STYLE_GUIDE.md Outdated
@KSXGitHub KSXGitHub marked this pull request as ready for review April 30, 2026 18:32
KSXGitHub pushed a commit that referenced this pull request Apr 30, 2026
After merging main (which brought in PR #352's "Doc comment intra-links"
guide and PR #351's "Documentation comments / private item refs" guide),
re-audit the bin-linking docs against the new sections and convert two
remaining bare-prose item mentions:

* `crates/cmd-shim/src/capabilities.rs:23` — the `FsReadHead` trait doc
  said "via `read_head_filled`" with the helper's name as bare prose.
  Convert to [`crate::read_head_filled`].
* `crates/package-manager/src/link_bins.rs:69` — the `LinkVirtualStoreBins`
  struct doc named `create_symlink_layout` as bare prose. The function
  shares its name with the module that hosts it, so the link needs to
  disambiguate; use `[create_symlink_layout](crate::create_symlink_layout())`
  to point at the function form.

The `Command` mention in `bin_resolver.rs:9` deliberately stays as bare
backticks: it refers to *upstream pnpm's* `Command` class (in
`@pnpm/bins.resolver`), not the local struct, so the bare-prose form is
the accurate reading.
@KSXGitHub KSXGitHub enabled auto-merge (squash) April 30, 2026 18:42
@zkochan zkochan disabled auto-merge April 30, 2026 18:43
@zkochan zkochan merged commit 1b23ba4 into main Apr 30, 2026
@zkochan zkochan deleted the claude/add-private-items-guidance-94HRm branch April 30, 2026 18:43
KSXGitHub pushed a commit that referenced this pull request Apr 30, 2026
…links

Apply the convention added by #352: when a doc comment
mentions an identifier that is rustdoc-linkable from the current scope,
write it as an intra-doc link rather than bare backticks. Two callouts
in `crates/modules-yaml/src/lib.rs` qualify (`serde_json::to_string_pretty`
and `serde_json::Value`); both are public re-exports of in-tree
dependencies, so rustdoc can resolve them and a renamed/removed item
will surface as a `cargo doc` warning instead of stale prose.

`cargo doc --no-deps` runs clean with `-D
rustdoc::broken_intra_doc_links -D rustdoc::private_intra_doc_links`,
confirming no `///` doc references a more-private item per the
guidance in #351.
zkochan added a commit that referenced this pull request Apr 30, 2026
`EnvVar` is `pub` but `resolve_hostname` is private; rustdoc rejects
the intra-link with `-D rustdoc::private-intra-doc-links` (the rule
added to `CODE_STYLE_GUIDE.md` in #351). Rephrase the doc to talk
about "env-dependent helpers" generally without naming the private
function.
KSXGitHub pushed a commit that referenced this pull request Apr 30, 2026
After merging main (which brought in PR #352's "Doc comment intra-links"
guide and PR #351's "Documentation comments / private item refs" guide),
re-audit the bin-linking docs against the new sections and convert two
remaining bare-prose item mentions:

* `crates/cmd-shim/src/capabilities.rs:23` — the `FsReadHead` trait doc
  said "via `read_head_filled`" with the helper's name as bare prose.
  Convert to [`crate::read_head_filled`].
* `crates/package-manager/src/link_bins.rs:69` — the `LinkVirtualStoreBins`
  struct doc named `create_symlink_layout` as bare prose. The function
  shares its name with the module that hosts it, so the link needs to
  disambiguate; use `[create_symlink_layout](crate::create_symlink_layout())`
  to point at the function form.

The `Command` mention in `bin_resolver.rs:9` deliberately stays as bare
backticks: it refers to *upstream pnpm's* `Command` class (in
`@pnpm/bins.resolver`), not the local struct, so the bare-prose form is
the accurate reading.
zkochan added a commit that referenced this pull request May 1, 2026
#349)

* feat(reporter): add NDJSON reporting engine with pnpm:stage smoke test

Introduces `pacquet-reporter` carrying the typed `LogEvent` enum, the
no-`self` `Reporter` capability trait per #339, and `NdjsonReporter` /
`SilentReporter` implementations. Adds the `--reporter=ndjson|silent`
flag and threads a `R: Reporter` generic through `Install::run`,
emitting `pnpm:stage` `importing_started` / `importing_done` to
bracket the install — one channel wired end-to-end as a smoke test
for the schema-mirror approach.

The wire format mirrors what `@pnpm/core-loggers` defines and
`@pnpm/cli.default-reporter` consumes under `pnpm --reporter=ndjson`.

Engine only. The JS-reporter spawn-and-pipe (`--reporter=default`),
the backfill of missing log events in already-ported code (#347), and
the porting convention in AGENTS.md (#346) land in follow-up PRs. The
default reporter is `silent` until the spawn-and-pipe exists, so user-
facing output is unchanged.

Refs #345. Design: #344.

* docs(package-manager): name pnpm's `lockfileDir` and link findWorkspaceDir

Upstream emits stage events with `prefix: lockfileDir` — the directory
holding `pnpm-lock.yaml`, which collapses to the workspace root when a
workspace is present. The previous comment described the *result* in
pacquet's no-workspace world but didn't name the upstream concept or
point at the helper to mirror once workspaces land. Replacing the
comment with a TODO that links `findWorkspaceDir` makes the migration
path explicit so the next person editing this site doesn't have to
re-derive it.

No behavior change.

* fix(cli): make --reporter accepted on either side of the subcommand

Adding `global = true` to the clap attribute lets users write either
`pacquet --reporter=ndjson install` or `pacquet install --reporter=ndjson`,
matching pnpm. Without it the flag is parsed by the top-level `CliArgs`
only, so a sub-command-side use ("pacquet install --reporter=...")
produced "unexpected argument '--reporter' found".

* refactor(reporter,package-manager): apply review fixes from #349

Address feedback on the reporter PR.

reporter:
- Drop the dependency-injection issue link (#339) from `Reporter`,
  the recording-fake test, and the module-level docs; convention is
  visible from the code.
- Wrap `bunyan` and `bole` references as markdown links.
- Demote `Envelope`'s `#[serde(flatten)]` rationale to a regular `//`
  comment so private impl detail isn't part of `///` rustdoc.
- Introduce `pub trait EnvVar` + `pub struct RealEnvVar` (reporter-
  local capability trait) and split `hostname` into a generic
  `resolve_hostname<E>` plus a non-generic cached production wrapper.
  Add four unit tests covering `HOSTNAME`, `COMPUTERNAME` fallback,
  precedence, and the unset case.
- Switch the wire-shape test to `pipe-trait`; add `pipe-trait` to
  dev-dependencies.
- Fix intra-link rule violation in the `SilentReporter` test doc.

package-manager:
- Tighten the install `prefix` extraction to fail loudly on
  non-UTF-8 / parentless manifest paths instead of silently emitting
  an empty string. Workspace-aware resolution tracked at #357.
- Replace `concat!` YAML literals in two tests with
  `text_block_macros::text_block!`; add as dev-dependency.
- Convert bare-prose identifiers in
  `install_emits_stage_events_bracketing_the_run` to intra-doc
  links; drop the recording-fake DI prose.

Long inline `mod tests` extraction tracked at #358.

* fix(reporter): drop private-item link from `EnvVar` public doc

`EnvVar` is `pub` but `resolve_hostname` is private; rustdoc rejects
the intra-link with `-D rustdoc::private-intra-doc-links` (the rule
added to `CODE_STYLE_GUIDE.md` in #351). Rephrase the doc to talk
about "env-dependent helpers" generally without naming the private
function.

* refactor(reporter): switch hostname to gethostname syscall + DI capability

Address the second round of review feedback on #349.

reporter:
- Replace env-var-based hostname (HOSTNAME / COMPUTERNAME) with the
  real gethostname(2) syscall via the `gethostname` crate. The
  env-var approach was unsound: shells set `HOST` (zsh) or
  `HOSTNAME` (bash) as private variables that don't propagate to
  spawned binaries, so a packaged `pacquet` would have observed an
  empty hostname in most production environments.
- Introduce `pub trait GetHostName` + `pub struct RealApi`. Real
  resolution lives in `RealApi::get_host_name`. Tests can supply
  their own impl.
- Cache the production value in `static HOSTNAME: LazyLock<String>
  = LazyLock::new(RealApi::get_host_name)`. The wire emit path
  reads `&HOSTNAME` directly; the previous `hostname()` wrapper is
  no longer needed.
- Drop the now-redundant `EnvVar` trait, `RealEnvVar`,
  `resolve_hostname`, and the four env-resolution unit tests (those
  scenarios no longer exist after the syscall switch).

reporter test layout:
- Move the tests module into its own file at
  `crates/reporter/src/tests.rs` per the unit-test-layout rule in
  `CODE_STYLE_GUIDE.md`. Drop `use super::*` in favor of explicit
  merged imports of just the items the tests touch.
- Two new tests: `get_host_name_capability_is_mockable` (proves the
  trait dispatch works for fakes) and
  `real_api_returns_a_non_empty_host_name` (smoke-checks the real
  syscall path).

Documentation style:
- Restructure the workspace-prefix and stage-bracketing comments to
  drop em dashes per `CONTRIBUTING.md`'s writing-style guidance and
  to render `bunyan` as a markdown link.
- Fix the `@pnpm/core-loggers` link to point at the package
  directory rather than its `src` subdirectory.

Imports:
- Replace seven occurrences of `pacquet_reporter::SilentReporter`
  qualified at the call site with a single `use pacquet_reporter::
  SilentReporter` in the test module.
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.

3 participants