Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions crates/nub-cli/tests/info_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ fn outdated_reports_registry_drift_and_exits_one() {
///
/// The report used to offer an upgrade the resolver would then refuse, so it
/// exited 1 forever and no `nub update` could clear it. The columns now agree
/// with the resolver, the refused version is disclosed rather than dropped,
/// and a project with no installable upgrade exits 0.
/// with the resolver, and the window is honored SILENTLY — the same way
/// `install` and `update` honor it — so a project with no installable upgrade
/// reports nothing and exits 0.
///
/// This lives here rather than beside the implementation because it drives the
/// `nub` binary end to end, which the unit tests beside `collect_rows` cannot.
Expand All @@ -492,7 +493,7 @@ fn outdated_reports_registry_drift_and_exits_one() {
/// tests, not CI as a whole.)
#[test]
#[ignore = "network: fetches the is-positive packument from the npm registry"]
fn outdated_discloses_a_release_age_hold_and_exits_zero() {
fn outdated_honors_the_release_age_window_silently_and_exits_zero() {
if !registry_reachable() {
eprintln!("skipping: registry.npmjs.org unreachable");
return;
Expand All @@ -516,16 +517,12 @@ fn outdated_discloses_a_release_age_hold_and_exits_zero() {
stdout: {stdout}\nstderr: {stderr}"
);
assert!(
stdout.contains("is-positive"),
"the row must survive so the hold can be explained, not vanish: {stdout}"
!stdout.contains("3.1.0"),
"3.1.0 is inside the window, so the report must not offer it: {stdout}"
);
assert!(
stdout.contains('*') && stdout.contains("minimumReleaseAge"),
"the held version must be marked and the reason named: {stdout}"
);
assert!(
stdout.contains("3.1.0"),
"the note must name the version being held back: {stdout}"
!stdout.contains("minimumReleaseAge") && !stdout.contains('*'),
"the window is the project's own policy and is honored without remark: {stdout}"
);
assert_no_engine_branding(&[("stdout", &stdout), ("stderr", &stderr)]);
}
Expand Down
22 changes: 14 additions & 8 deletions site/content/docs/install/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,11 @@ $ nub add some-tool

The fallback stops at whatever the publisher currently tags `latest`. A higher version that was published and then untagged is a release they withdrew, so Nub never falls back to one. A prerelease `latest` fails outright for the same reason — the stable release below it belongs to a line the publisher has moved off.

The report follows the same rule. Both version columns of `nub outdated` name what an install would land on, and a version the window holds back is marked rather than offered:
The report follows the same rule, and just as quietly. Both version columns of `nub outdated` name what an install would land on, so a version inside the window is never offered:
Comment thread
pullfrog[bot] marked this conversation as resolved.
Resolved

```console
$ nub outdated
Package Current Wanted Latest
some-tool 2.3.0 2.3.0 * 2.3.0 *

Note: * marks a version held back by minimumReleaseAge.
some-tool@2.4.0 becomes installable in about 5h
All dependencies up to date.
```

A project whose only pending upgrade sits inside the window has nothing to act on, so the command exits 0 and a CI check that runs it passes.
Expand All @@ -519,7 +515,7 @@ $ nub add some-tool --minimum-release-age=2h # or just shorten
$ nub add some-tool --minimum-release-age-exclude=some-tool # exempt one package
```

The duration takes a unit — `s`, `m`, `h`, `d`, or `w` — and a bare number means minutes, matching pnpm. Both flags work on every command that resolves from the registry, including the remote bin runner.
The duration takes a unit — `s`, `m`, `h`, `d`, or `w` — and a bare number means minutes, matching pnpm. Both flags work on every command that installs, including the remote bin runner.

The exclude flag *replaces* the configured `minimumReleaseAgeExclude` for that run rather than adding to it, matching pnpm — so name every package you still need:

Expand All @@ -540,7 +536,17 @@ Publish dates come from the registry's `time` metadata, so the gate is only as s
| No per-version dates, document older than the window | Allowed — the document's own timestamp bounds every version in it |
| No per-version dates, document newer than the window | Blocked |

Registries that publish no dates at all — some private mirrors, older Verdaccio — hit the last row. The refusal is its own error, `ERR_NUB_RELEASE_AGE_MISSING_TIME`, rather than the too-new one. Two ways through:
Registries that publish no dates at all — some private mirrors, older Verdaccio — hit the last row. The refusal is its own error, `ERR_NUB_RELEASE_AGE_MISSING_TIME`, rather than the too-new one.

This is the one case where the report cannot stay quiet. Staying silent would leave `nub outdated` reporting no work to do on a project where every install refuses, so it names the package on stderr and leaves stdout as data:

```console
$ nub outdated
warn: internal-pkg has no registry publish times, so minimumReleaseAge cannot admit any version; `nub update` will fail for it
All dependencies up to date.
```

Two ways through:

```ini title=".npmrc"
minimumReleaseAgeExclude=internal-pkg # exempt one package (comma-separated)
Expand Down
4 changes: 3 additions & 1 deletion vendor/aube/crates/aube-resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub use trust::{
pub use trust::{PackageVersionPolicy, TrustEvidence, TrustExcludeParseError, TrustExcludeRules};
pub use types::{
DependencyPolicy, MinimumReleaseAge, PackageExtension, ReadPackageHook, ResolutionMode,
ResolvedPackage, TrustPolicy, format_iso8601_utc,
ResolvedPackage, TrustPolicy,
};

pub const YARN_EXEC_WRAPPER: &str = r#"
Expand Down Expand Up @@ -87,6 +87,8 @@ use peer_context::{
};
#[cfg(test)]
use semver_util::{pick_version, strip_alias_prefix};
#[cfg(test)]
use types::format_iso8601_utc;

use aube_lockfile::DepType;
use aube_registry::Packument;
Expand Down
2 changes: 1 addition & 1 deletion vendor/aube/crates/aube-resolver/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl MinimumReleaseAge {
/// (`...:00Z`) since SBOM consumers don't expect millis. Don't merge
/// without checking which format each caller needs — the npm registry
/// `time` map always uses `.000Z`, lex compare relies on it.
pub fn format_iso8601_utc(epoch_secs: u64) -> String {
pub(crate) fn format_iso8601_utc(epoch_secs: u64) -> String {
let days = (epoch_secs / 86_400) as i64;
let secs_of_day = epoch_secs % 86_400;
let h = secs_of_day / 3600;
Expand Down
Loading
Loading