cursedbelt 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursedbelt",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Shared Bun + React framework",
|
|
@@ -459,7 +459,13 @@
|
|
|
459
459
|
"source": "./src/server/storage/index.ts",
|
|
460
460
|
"import": "./dist/server/storage/index.js"
|
|
461
461
|
},
|
|
462
|
-
"./server/
|
|
462
|
+
"./server/item-crypto": {
|
|
463
|
+
"types": "./dist/server/auth/vault.d.ts",
|
|
464
|
+
"bun": "./src/server/auth/vault.ts",
|
|
465
|
+
"source": "./src/server/auth/vault.ts",
|
|
466
|
+
"import": "./dist/server/auth/vault.js"
|
|
467
|
+
},
|
|
468
|
+
"./server/storage/types": {
|
|
463
469
|
"types": "./dist/server/storage/types.d.ts",
|
|
464
470
|
"bun": "./src/server/storage/types.ts",
|
|
465
471
|
"source": "./src/server/storage/types.ts",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
import { readdirSync, rmSync, statSync } from 'node:fs';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import pkg from '../package.json';
|
|
4
5
|
|
|
@@ -134,10 +135,65 @@ const sourceOf = (subpath: string): string => {
|
|
|
134
135
|
return bun.replace(/^\.\//, '');
|
|
135
136
|
};
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* 🔴 The fixture must sit OUTSIDE this repo, and where it lands is not a detail.
|
|
140
|
+
*
|
|
141
|
+
* `scripts/testTmpRoot.ts` redirects `$TMPDIR` per process, and when `$FORGE_STATE`
|
|
142
|
+
* is unset — a bare checkout with no generation around it — its fallback is
|
|
143
|
+
* deliberately repo-local: `<repo>/.agent.noindex/tmp/<pid>`. For every other suite
|
|
144
|
+
* that is exactly right. For this one it is fatal: bun resolves a bare import by
|
|
145
|
+
* walking node_modules UP to the filesystem root, so a fixture under the repo finds
|
|
146
|
+
* `<repo>/node_modules/otplib` and every peer this check exists to prove unreachable
|
|
147
|
+
* becomes reachable.
|
|
148
|
+
*
|
|
149
|
+
* Measured 2026-09-15: with `$FORGE_STATE` set the negative control failed correctly;
|
|
150
|
+
* with it unset the SAME control resolved `otplib` out of this repo's own
|
|
151
|
+
* `node_modules` and the guard fired — *"the fixture resolved 'otplib' … Every
|
|
152
|
+
* assertion below is vacuous until that is fixed"*. So `bun run verify` was green
|
|
153
|
+
* under the runner and red in a plain shell, for a reason that has nothing to do with
|
|
154
|
+
* the code under test. The control did its job; the fixture's address was the bug.
|
|
155
|
+
*
|
|
156
|
+
* Resolution here is therefore explicit rather than inherited. The redirected root is
|
|
157
|
+
* used when it lies outside the repo (the normal case — the runner always sets
|
|
158
|
+
* `$FORGE_STATE`, and the preload's sweep then cleans up after a killed run). When it
|
|
159
|
+
* does not, this hops to `$HOME`, which `resolveTestTmpRoot` refuses for the general
|
|
160
|
+
* default and which this check genuinely requires: an isolated root is the whole
|
|
161
|
+
* measurement. Stale siblings are swept by mtime, the same way the preload does it,
|
|
162
|
+
* so the hop cannot accumulate.
|
|
163
|
+
*/
|
|
164
|
+
const REPO_PREFIX = `${REPO.replace(/\/$/, '')}/`;
|
|
165
|
+
|
|
166
|
+
const fixtureRoot = (): string => {
|
|
167
|
+
const redirected = process.env.TMPDIR;
|
|
168
|
+
if (redirected !== undefined && !`${redirected}/`.startsWith(REPO_PREFIX)) {
|
|
169
|
+
return `${redirected}/leaf-subpath-fixture`;
|
|
170
|
+
}
|
|
171
|
+
const home = process.env.HOME?.trim();
|
|
172
|
+
if (home === undefined || home === '') {
|
|
173
|
+
throw new Error(
|
|
174
|
+
'no isolated root available for the leaf fixture ($TMPDIR is inside this repo and $HOME is unset) — ' +
|
|
175
|
+
'a check that cannot isolate itself is not a passing check',
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
const outside = `${home}/.cursedbelt-leaf-fixture.noindex`;
|
|
179
|
+
try {
|
|
180
|
+
const cutoff = Date.now() - 6 * 60 * 60 * 1000;
|
|
181
|
+
for (const entry of readdirSync(outside)) {
|
|
182
|
+
const path = `${outside}/${entry}`;
|
|
183
|
+
try {
|
|
184
|
+
if (statSync(path).mtimeMs < cutoff) rmSync(path, { recursive: true, force: true });
|
|
185
|
+
} catch {
|
|
186
|
+
// racing another run's sweep is fine — whoever wins, it goes
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
190
|
+
// no root yet: Bun.write creates it below
|
|
191
|
+
}
|
|
192
|
+
return `${outside}/${process.pid}/leaf-subpath-fixture`;
|
|
193
|
+
};
|
|
194
|
+
|
|
137
195
|
const run = async (): Promise<Record<string, Outcome>> => {
|
|
138
|
-
|
|
139
|
-
// the preload's sweep is what cleans up after a killed run.
|
|
140
|
-
const root = `${process.env.TMPDIR ?? '/tmp'}/leaf-subpath-fixture`;
|
|
196
|
+
const root = fixtureRoot();
|
|
141
197
|
const pkgDir = `${root}/node_modules/cursedbelt`;
|
|
142
198
|
|
|
143
199
|
// The second lock against bun's auto-install (see the header). The negative control is the
|