Files
msd-core/tests/helpers/context-monitor-fixed-now-preload.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

25 lines
1.1 KiB
JavaScript

'use strict';
/**
* Preload fixture for #3808 — pin the SPAWNED context-monitor hook's
* `Date.now()` to `MSD_TEST_NOW_MS`, so any wall-clock boundary can be driven
* at exactly limit-1 / limit / limit+1. Added for STALE_SECONDS (review round 3,
* Major 2); now also drives AC2, AC3, the COMPACT_GRACE_SECONDS trio and the
* WATERMARK_SKEW_SECONDS trio, which is what lets those rows use the real
* writer's timestamp shape instead of a future stamp (round 4, Major 1).
*
* Without this, the age of a bridge written by the parent drifts by however
* long the child takes to start: a fixture built at age 60 can be read at 61
* and flip the row's verdict — the boundary is REAL wall-clock. Pinning the
* child's clock makes the arithmetic exact. Same `--require` seam as the
* EPERM preload; one-shot subprocess, no restoration needed. Only Date.now is
* patched — `new Date()` stays real, which is fine: the hook uses it only to
* render a date string inside the breadcrumb text, never for comparisons.
*/
const fixed = Number(process.env.MSD_TEST_NOW_MS || '');
if (Number.isFinite(fixed) && fixed > 0) {
Date.now = () => fixed;
}