toiljs 0.0.137 → 0.0.138

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.0.138] - 2026-10-28
4
+
5
+ - Erase historical two-factor settings and replay counters during account deletion, with bounded retryable cleanup, raw-byte release of old schemas, and generation fences that preserve session revocation across account recreation.
6
+ - Add `server.authRoutes.deleteAccount`; disabling factor setup still allows proof-backed removal of an existing factor.
7
+ - Build cold artifacts with the minimal collector and collect between resident calls on updated Node/native hosts, preserving daemon state without incremental barriers.
8
+ - Add exact `RateLimit.TrailingWindow` on Node and native hosts. Require ToilScript 0.1.67; deploy toil-backend 0.1.1 before using the new strategy or minimal cold runtime.
9
+ - Sort build-cache library listings and expose per-tier miss reasons with `TOILJS_BUILD_CACHE_DEBUG=1`.
10
+ - Correct auth/config and derive permission documentation; document native gas prices, measurement, routing, byte/write accounting, continuation polling and fresh Scylla keyspace readiness.
11
+
12
+ Validation: 808 framework tests pass with normal and strict database limits, alongside browser auth checks, both example builds/typechecks/lints, and a clean starter installation from a cached older CLI. See [the release audit](docs/release-audit-2026-10-28.md) for all sixteen report items, additional regression fixes, and verification limits.
13
+
3
14
  ## [v0.0.137] - 2026-10-27
4
15
 
5
16
  - Compile request, stream, and daemon tiers in bounded parallel processes, dividing Binaryen's CPU budget among active jobs while preserving configured optimization levels and assertions.
@@ -4156,7 +4156,7 @@ function scaffold(name, template, features, aiTools, images) {
4156
4156
  oxlint: "^1.89.0",
4157
4157
  "oxlint-tsgolint": "^7.0.2004",
4158
4158
  prettier: "^3.9.10",
4159
- toilscript: ">=0.1.66",
4159
+ toilscript: ">=0.1.67",
4160
4160
  typescript: "^7.0.2"
4161
4161
  };
4162
4162
  for (const dep of requiredPackages(features).sort()) {
@@ -5136,7 +5136,7 @@ function checkWasmBuilt(exists) {
5136
5136
  fix: "Run your server build (toilscript) before toiljs start."
5137
5137
  };
5138
5138
  }
5139
- var RPC_TOILSCRIPT_MIN = "0.1.66";
5139
+ var RPC_TOILSCRIPT_MIN = "0.1.67";
5140
5140
  function checkRpcWiring(f) {
5141
5141
  const missing = [];
5142
5142
  if (!f.toilscriptOk) missing.push(`toilscript >=${RPC_TOILSCRIPT_MIN}`);
@@ -3,7 +3,7 @@ import fs from 'node:fs';
3
3
  import { availableParallelism } from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { compilerFingerprint, digest, fileDigest, inputsCurrent, outputsCurrent, readCompilerManifest, standardCompilerConfig, } from './compiler-cache.js';
6
+ import { compilerFingerprint, compilerCacheMiss, digest, fileDigest, inputsCurrent, outputsCurrent, readCompilerManifest, standardCompilerConfig, } from './compiler-cache.js';
7
7
  function runProcess(root, args, name, signal, cores) {
8
8
  return new Promise((resolve, reject) => {
9
9
  let failure;
@@ -80,7 +80,10 @@ export async function runCompilerPasses(root, bin, passes, finalize, options = {
80
80
  const cache = path.join(home, `${pass.name}.json`);
81
81
  const key = digest(JSON.stringify({ version: 1, root, fingerprint, args: pass.args }));
82
82
  const saved = cacheable ? readCompilerManifest(cache) : null;
83
- const cached = saved?.key === key && inputsCurrent(saved) && outputsCurrent(saved) ? saved : null;
83
+ const miss = compilerCacheMiss(saved, key);
84
+ const cached = cacheable && miss === null ? saved : null;
85
+ if (process.env.TOILJS_BUILD_CACHE_DEBUG === '1')
86
+ process.stdout.write(` server cache ${pass.name}: ${cached ? 'hit' : !cacheable ? 'disabled' : miss}\n`);
84
87
  return { pass, cache, key, cached };
85
88
  });
86
89
  const concurrency = Math.max(1, Math.min(plans.filter((plan) => !plan.cached).length, 3, cpus, jobs));
@@ -22,6 +22,7 @@ export declare function digest(value: string | Uint8Array): string;
22
22
  export declare function fileDigest(file: string): string | null;
23
23
  export declare function libraryEntries(dir: string): string[] | null;
24
24
  export declare function inputsCurrent(manifest: CompilerManifest): boolean;
25
+ export declare function compilerCacheMiss(manifest: CompilerManifest | null, key: string): string | null;
25
26
  export declare function outputsCurrent(manifest: CompilerManifest): boolean;
26
27
  export declare function readCompilerManifest(file: string): CompilerManifest | null;
27
28
  export declare function standardCompilerConfig(root: string): boolean;
@@ -16,7 +16,8 @@ export function libraryEntries(dir) {
16
16
  try {
17
17
  return fs
18
18
  .readdirSync(dir)
19
- .filter((name) => name.endsWith('.ts') && !name.endsWith('.d.ts'));
19
+ .filter((name) => name.endsWith('.ts') && !name.endsWith('.d.ts'))
20
+ .sort();
20
21
  }
21
22
  catch {
22
23
  return null;
@@ -27,6 +28,26 @@ export function inputsCurrent(manifest) {
27
28
  manifest.inputs.every((input) => fileDigest(input.path) === input.hash) &&
28
29
  manifest.directories.every((dir) => JSON.stringify(libraryEntries(dir.path)) === JSON.stringify(dir.entries)));
29
30
  }
31
+ export function compilerCacheMiss(manifest, key) {
32
+ if (!manifest)
33
+ return 'manifest missing or invalid';
34
+ if (manifest.key !== key)
35
+ return 'compiler, options, or build environment changed';
36
+ if (!manifest.stable)
37
+ return 'inputs changed while the previous compiler was reading them';
38
+ for (const input of manifest.inputs)
39
+ if (fileDigest(input.path) !== input.hash)
40
+ return `input changed: ${input.path}`;
41
+ for (const dir of manifest.directories)
42
+ if (JSON.stringify(libraryEntries(dir.path)) !== JSON.stringify(dir.entries))
43
+ return `library entries changed: ${dir.path}`;
44
+ if (manifest.outputs.length === 0)
45
+ return 'no recorded outputs';
46
+ for (const output of manifest.outputs)
47
+ if (fileDigest(output.path) !== output.hash)
48
+ return `output changed or missing: ${output.path}`;
49
+ return null;
50
+ }
30
51
  export function outputsCurrent(manifest) {
31
52
  return (manifest.outputs.length > 0 &&
32
53
  manifest.outputs.every((output) => fileDigest(output.path) === output.hash));
@@ -46,6 +46,7 @@ export interface DaemonConfig {
46
46
  export interface AuthRoutesConfig {
47
47
  readonly google?: boolean;
48
48
  readonly twoFactorSetup?: boolean;
49
+ readonly deleteAccount?: boolean;
49
50
  }
50
51
  export interface ServerConfig {
51
52
  readonly logging?: boolean;
@@ -41,9 +41,9 @@ export async function loadConfig(opts = {}) {
41
41
  if (typeof authRoutes !== 'object' || Array.isArray(authRoutes))
42
42
  throw new Error('server.authRoutes must be an object');
43
43
  for (const key of Object.keys(authRoutes)) {
44
- if (!['google', 'twoFactorSetup'].includes(key) ||
44
+ if (!['google', 'twoFactorSetup', 'deleteAccount'].includes(key) ||
45
45
  typeof authRoutes[key] !== 'boolean')
46
- throw new Error('server.authRoutes accepts only boolean google and twoFactorSetup settings');
46
+ throw new Error('server.authRoutes accepts only boolean google, twoFactorSetup and deleteAccount settings');
47
47
  }
48
48
  if (client.coop !== undefined &&
49
49
  !['same-origin', 'same-origin-allow-popups'].includes(client.coop))
@@ -160,7 +160,8 @@ async function buildServerLocked(root, auth, authRoutes, logging) {
160
160
  fs.mkdirSync(authLib, { recursive: true });
161
161
  fs.writeFileSync(path.join(authLib, '_auth_routes.ts'), `// Generated by toiljs. Rebuild to change auth route policy.\n` +
162
162
  `@inline export function __toilAuthGoogleEnabled(): bool { return ${authRoutes.google !== false}; }\n` +
163
- `@inline export function __toilAuthTwoFactorSetupEnabled(): bool { return ${authRoutes.twoFactorSetup !== false}; }\n`);
163
+ `@inline export function __toilAuthTwoFactorSetupEnabled(): bool { return ${authRoutes.twoFactorSetup !== false}; }\n` +
164
+ `@inline export function __toilAuthDeleteAccountEnabled(): bool { return ${authRoutes.deleteAccount !== false}; }\n`);
164
165
  const appHasUser = serverDeclaresUser(root, files);
165
166
  const authFiles = authEntryFiles(root, appHasUser);
166
167
  const authSet = new Set(authFiles);
@@ -419,7 +420,7 @@ function toilscriptPass(root, files, opts) {
419
420
  if (opts.mode !== null)
420
421
  args.push('--targetMode', opts.mode);
421
422
  if (opts.mode === 'cold')
422
- args.push('--runtime', 'incremental');
423
+ args.push('--runtime', 'minimal', '--exportRuntime');
423
424
  if (opts.outFile !== null)
424
425
  args.push('--outFile', opts.outFile);
425
426
  if (opts.withRpc)