Skip to content

start implementing dependencies of dependency#6

Merged
anonrig merged 11 commits intomainfrom
dependency-of-dependencies
Jul 14, 2023
Merged

start implementing dependencies of dependency#6
anonrig merged 11 commits intomainfrom
dependency-of-dependencies

Conversation

@anonrig
Copy link
Copy Markdown
Member

@anonrig anonrig commented Jul 14, 2023

pretty much work in progress

@anonrig anonrig force-pushed the dependency-of-dependencies branch from 76beb2e to b03e977 Compare July 14, 2023 22:29
@anonrig anonrig merged commit e29da61 into main Jul 14, 2023
@anonrig anonrig deleted the dependency-of-dependencies branch July 14, 2023 22:32
@KSXGitHub KSXGitHub mentioned this pull request Apr 30, 2026
KSXGitHub pushed a commit that referenced this pull request Apr 30, 2026
`FsReadHead::read_head` mirrors a single `read(2)` syscall, which POSIX
permits to return short. The previous shebang reader took the result of
that one call as the whole prefix — fine for regular files (which never
return short on a fresh open at offset 0), but wrong on pseudo-fs paths
(`/proc`, `/sys`, FUSE) where short reads are routine. A short read at
offset 0 could truncate the shebang and silently misroute the runtime.

Keep the capability dead simple — one syscall, no algorithm hidden in
the trait — and add the loop one level up:

* Extend `FsReadHead::read_head` with an `offset: u64` parameter so the
  loop can advance the file position between calls without each fake
  having to track state. `RealApi::read_head` seeks before its single
  `read` call when offset > 0.
* Add `pub fn read_head_filled<Api: FsReadHead>(path, buf)` in `shim.rs`
  that loops the trait until `buf` is full or `Ok(0)` (EOF). Stays
  generic over `Api` so test fakes don't have to grow.
* `read_shebang` now calls `read_head_filled` instead of the raw trait
  method.

Five unit tests pin the new utility's behaviour:

* long file fills the buffer (real fs, hot path)
* short file returns the partial count without erroring (real fs)
* fake-driven short reads accumulate, with offsets advancing 0/3/6
* `Ok(0)` from the fake terminates the loop with the partial count
* IO error from the fake propagates without retry

Each test was broken-and-verified against a deliberately wrong
implementation to confirm it actually catches the regression it claims
to.

Refs #333 (comment)
zkochan added a commit to Saturate/pacquet that referenced this pull request May 7, 2026
Match upstream's NDJSON wire format for the build phase so
@pnpm/cli.default-reporter parses pacquet's lifecycle output the same
way it parses pnpm's.

- Add `LogEvent::Lifecycle(LifecycleLog)` with the three upstream
  message shapes (Script, Stdio, Exit) as a `#[serde(untagged)]`
  union, mirroring `core/core-loggers/src/lifecycleLogger.ts`.
- Add `LogEvent::IgnoredScripts(IgnoredScriptsLog)` carrying
  `packageNames` (camelCase), mirroring `ignoredScriptsLogger.ts`.
- `pacquet-executor` depends on `pacquet-reporter`. `run_postinstall_hooks`
  / `run_lifecycle_hook` are now generic over `R: Reporter`. The hook
  switches from `Stdio::inherit()` to `Stdio::piped()` and reads each
  stream on its own thread, emitting one `Stdio` event per line. A
  `Script` event fires before spawn, `Exit` fires after wait — same
  ordering as `runLifecycleHook.ts:102/165`.
- `BuildModules::run::<R>` collects sorted (peer-stripped) keys of
  packages that hit the "not in allowBuilds" branch and returns them
  as `Vec<String>`. Explicit `false` is silently skipped, matching
  upstream's switch in `building/during-install/src/index.ts:88-101`.
- `InstallFrozenLockfile::run` emits one `pnpm:ignored-scripts` event
  with the returned list (always, even when empty) — mirrors the
  unconditional emit at `installing/deps-installer/src/install/index.ts:414`.

Tests:
- Wire-shape tests for both new variants pin the JSON output.
- Recording-fake tests for `run_postinstall_hooks` cover Script→Stdio→Exit
  ordering and non-zero exit propagation.
- Recording-fake tests for `BuildModules::run` cover the ignored-builds
  return value (sorted, peer-stripped, excludes explicit-deny).
- Updated `install_emits_pnpm_event_sequence` to expect the new
  `IgnoredScripts` event between `Stats` and `ImportingDone`.

Addresses items pnpm#6 and pnpm#8 from pnpm#397.

Upstream refs at `pnpm/pnpm@80037699fb`:
- core/core-loggers/src/lifecycleLogger.ts
- core/core-loggers/src/ignoredScriptsLogger.ts
- exec/lifecycle/src/runLifecycleHook.ts
- building/during-install/src/index.ts
- installing/deps-installer/src/install/index.ts
zkochan added a commit to Saturate/pacquet that referenced this pull request May 7, 2026
Match upstream's NDJSON wire format for the build phase so
@pnpm/cli.default-reporter parses pacquet's lifecycle output the same
way it parses pnpm's.

- Add `LogEvent::Lifecycle(LifecycleLog)` with the three upstream
  message shapes (Script, Stdio, Exit) as a `#[serde(untagged)]`
  union, mirroring `core/core-loggers/src/lifecycleLogger.ts`.
- Add `LogEvent::IgnoredScripts(IgnoredScriptsLog)` carrying
  `packageNames` (camelCase), mirroring `ignoredScriptsLogger.ts`.
- `pacquet-executor` depends on `pacquet-reporter`. `run_postinstall_hooks`
  / `run_lifecycle_hook` are now generic over `R: Reporter`. The hook
  switches from `Stdio::inherit()` to `Stdio::piped()` and reads each
  stream on its own thread, emitting one `Stdio` event per line. A
  `Script` event fires before spawn, `Exit` fires after wait — same
  ordering as `runLifecycleHook.ts:102/165`.
- `BuildModules::run::<R>` collects sorted (peer-stripped) keys of
  packages that hit the "not in allowBuilds" branch and returns them
  as `Vec<String>`. Explicit `false` is silently skipped, matching
  upstream's switch in `building/during-install/src/index.ts:88-101`.
- `InstallFrozenLockfile::run` emits one `pnpm:ignored-scripts` event
  with the returned list (always, even when empty) — mirrors the
  unconditional emit at `installing/deps-installer/src/install/index.ts:414`.

Tests:
- Wire-shape tests for both new variants pin the JSON output.
- Recording-fake tests for `run_postinstall_hooks` cover Script→Stdio→Exit
  ordering and non-zero exit propagation.
- Recording-fake tests for `BuildModules::run` cover the ignored-builds
  return value (sorted, peer-stripped, excludes explicit-deny).
- Updated `install_emits_pnpm_event_sequence` to expect the new
  `IgnoredScripts` event between `Stats` and `ImportingDone`.

Addresses items pnpm#6 and pnpm#8 from pnpm#397.

Upstream refs at `pnpm/pnpm@80037699fb`:
- core/core-loggers/src/lifecycleLogger.ts
- core/core-loggers/src/ignoredScriptsLogger.ts
- exec/lifecycle/src/runLifecycleHook.ts
- building/during-install/src/index.ts
- installing/deps-installer/src/install/index.ts
zkochan added a commit to Saturate/pacquet that referenced this pull request May 7, 2026
Match upstream's NDJSON wire format for the build phase so
@pnpm/cli.default-reporter parses pacquet's lifecycle output the same
way it parses pnpm's.

- Add `LogEvent::Lifecycle(LifecycleLog)` with the three upstream
  message shapes (Script, Stdio, Exit) as a `#[serde(untagged)]`
  union, mirroring `core/core-loggers/src/lifecycleLogger.ts`.
- Add `LogEvent::IgnoredScripts(IgnoredScriptsLog)` carrying
  `packageNames` (camelCase), mirroring `ignoredScriptsLogger.ts`.
- `pacquet-executor` depends on `pacquet-reporter`. `run_postinstall_hooks`
  / `run_lifecycle_hook` are now generic over `R: Reporter`. The hook
  switches from `Stdio::inherit()` to `Stdio::piped()` and reads each
  stream on its own thread, emitting one `Stdio` event per line. A
  `Script` event fires before spawn, `Exit` fires after wait — same
  ordering as `runLifecycleHook.ts:102/165`.
- `BuildModules::run::<R>` collects sorted (peer-stripped) keys of
  packages that hit the "not in allowBuilds" branch and returns them
  as `Vec<String>`. Explicit `false` is silently skipped, matching
  upstream's switch in `building/during-install/src/index.ts:88-101`.
- `InstallFrozenLockfile::run` emits one `pnpm:ignored-scripts` event
  with the returned list (always, even when empty) — mirrors the
  unconditional emit at `installing/deps-installer/src/install/index.ts:414`.

Tests:
- Wire-shape tests for both new variants pin the JSON output.
- Recording-fake tests for `run_postinstall_hooks` cover Script→Stdio→Exit
  ordering and non-zero exit propagation.
- Recording-fake tests for `BuildModules::run` cover the ignored-builds
  return value (sorted, peer-stripped, excludes explicit-deny).
- Updated `install_emits_pnpm_event_sequence` to expect the new
  `IgnoredScripts` event between `Stats` and `ImportingDone`.

Addresses items pnpm#6 and pnpm#8 from pnpm#397.

Upstream refs at `pnpm/pnpm@80037699fb`:
- core/core-loggers/src/lifecycleLogger.ts
- core/core-loggers/src/ignoredScriptsLogger.ts
- exec/lifecycle/src/runLifecycleHook.ts
- building/during-install/src/index.ts
- installing/deps-installer/src/install/index.ts
zkochan added a commit to Saturate/pacquet that referenced this pull request May 9, 2026
Match upstream's NDJSON wire format for the build phase so
@pnpm/cli.default-reporter parses pacquet's lifecycle output the same
way it parses pnpm's.

- Add `LogEvent::Lifecycle(LifecycleLog)` with the three upstream
  message shapes (Script, Stdio, Exit) as a `#[serde(untagged)]`
  union, mirroring `core/core-loggers/src/lifecycleLogger.ts`.
- Add `LogEvent::IgnoredScripts(IgnoredScriptsLog)` carrying
  `packageNames` (camelCase), mirroring `ignoredScriptsLogger.ts`.
- `pacquet-executor` depends on `pacquet-reporter`. `run_postinstall_hooks`
  / `run_lifecycle_hook` are now generic over `R: Reporter`. The hook
  switches from `Stdio::inherit()` to `Stdio::piped()` and reads each
  stream on its own thread, emitting one `Stdio` event per line. A
  `Script` event fires before spawn, `Exit` fires after wait — same
  ordering as `runLifecycleHook.ts:102/165`.
- `BuildModules::run::<R>` collects sorted (peer-stripped) keys of
  packages that hit the "not in allowBuilds" branch and returns them
  as `Vec<String>`. Explicit `false` is silently skipped, matching
  upstream's switch in `building/during-install/src/index.ts:88-101`.
- `InstallFrozenLockfile::run` emits one `pnpm:ignored-scripts` event
  with the returned list (always, even when empty) — mirrors the
  unconditional emit at `installing/deps-installer/src/install/index.ts:414`.

Tests:
- Wire-shape tests for both new variants pin the JSON output.
- Recording-fake tests for `run_postinstall_hooks` cover Script→Stdio→Exit
  ordering and non-zero exit propagation.
- Recording-fake tests for `BuildModules::run` cover the ignored-builds
  return value (sorted, peer-stripped, excludes explicit-deny).
- Updated `install_emits_pnpm_event_sequence` to expect the new
  `IgnoredScripts` event between `Stats` and `ImportingDone`.

Addresses items pnpm#6 and pnpm#8 from pnpm#397.

Upstream refs at `pnpm/pnpm@80037699fb`:
- core/core-loggers/src/lifecycleLogger.ts
- core/core-loggers/src/ignoredScriptsLogger.ts
- exec/lifecycle/src/runLifecycleHook.ts
- building/during-install/src/index.ts
- installing/deps-installer/src/install/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant