@wildshard/shard-format 0.72.0 → 0.73.0

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": "@wildshard/shard-format",
3
- "version": "0.72.0",
3
+ "version": "0.73.0",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -402,6 +402,7 @@
402
402
  "./ui": "./src/format/ui.ts",
403
403
  "./uiStrings": "./src/format/uiStrings.ts",
404
404
  "./uniformRows": "./src/format/uniformRows.ts",
405
+ "./uploadCaps": "./src/format/upload-caps.ts",
405
406
  "./uploadWire": "./src/format/upload-wire.ts",
406
407
  "./validationReceipt": "./src/format/validationReceipt.ts",
407
408
  "./version": "./src/format/version.ts",
@@ -11,6 +11,8 @@ import {
11
11
  string,
12
12
  } from 'valibot'
13
13
 
14
+ import { MAX_SHARDFILE_BYTES } from './upload-caps.ts'
15
+
14
16
  import type { GenericSchema } from 'valibot'
15
17
 
16
18
  // AUDIO AU5: a dated waiver for a shard over the audio budget's red line. It
@@ -35,7 +37,6 @@ const NONE = 0
35
37
  const ONE_CHAR = 1
36
38
  const REASON_LIMIT = 240
37
39
  const SLUG_LIMIT = 64
38
- const MAX_WAIVER_BYTES = 450_000_000
39
40
 
40
41
  const AudioWaiverSchema: GenericSchema<AudioWaiver, AudioWaiver> = strictObject(
41
42
  {
@@ -45,7 +46,7 @@ const AudioWaiverSchema: GenericSchema<AudioWaiver, AudioWaiver> = strictObject(
45
46
  number(),
46
47
  safeInteger(),
47
48
  minValue(NONE),
48
- maxValue(MAX_WAIVER_BYTES),
49
+ maxValue(MAX_SHARDFILE_BYTES),
49
50
  ),
50
51
  reason: pipe(string(), minLength(ONE_CHAR), maxLength(REASON_LIMIT)),
51
52
  },
@@ -3,6 +3,7 @@
3
3
  * both validators warn on it and the corpus counts its kept users (`shard-format corpus`). A path with a migration is
4
4
  * mended by the chain; one without is deleted once no kept file uses it. */
5
5
  import { COOK_DEPRECATIONS } from './cook-deprecations.ts'
6
+ import { MANIFEST_MOVED_DEPRECATIONS } from './manifest-deprecations.ts'
6
7
  import { SAVE_REVISION_DEPRECATION } from './save-revision.ts'
7
8
  import { SCHEMA_SOURCE_DEPRECATION } from './schema-source.ts'
8
9
  import {
@@ -155,6 +156,7 @@ const RULES: readonly DeprecationRule[] = [
155
156
  'gridShardfile',
156
157
  ) !== undefined,
157
158
  },
159
+ ...MANIFEST_MOVED_DEPRECATIONS,
158
160
  {
159
161
  id: 'runtime.trust',
160
162
  path: 'shard.json runtime.trust',
@@ -0,0 +1,57 @@
1
+ /** ONE-FORMAT OF9b5 under J486: the level manifest's moved words. SDK 0.4.25 builds write none of them (OF9b3b moved
2
+ * the page-start words to their sections, OF9b4 the herd fields to declared rows), but every product built before it
3
+ * still carries some in `ui/level`. FE7 counts each one's kept users; OF9b5a deletes the field from
4
+ * `ManifestMetadataSchema` at zero users. No data migration exists: the start words have a lift at the door
5
+ * (`level-start.ts`), and the herd fields became declared rows in the build, which a copy of the file can't redo. */
6
+
7
+ /** The registry's row shape (`deprecations.ts`). */
8
+ interface ManifestDeprecation {
9
+ readonly id: string
10
+ readonly path: string
11
+ readonly since: string
12
+ readonly replacement: string
13
+ readonly migration: undefined
14
+ readonly uses: (
15
+ shard: Readonly<{ sections: ReadonlyMap<string, unknown> }>,
16
+ ) => boolean
17
+ }
18
+
19
+ /** Each moved word and where it lives now. */
20
+ const MOVED: readonly (readonly [string, string])[] = [
21
+ ['spawn', 'world/spawn (OF9b3)'],
22
+ ['loadout', "combat/items' loadout.level (OF9b3)"],
23
+ ['audio', "audio/audio's level (OF9b3)"],
24
+ ['weapon', 'nothing: combat/items arms the player (OF9b3)'],
25
+ ['species', 'declared species rows, actors/species (OF9b4)'],
26
+ ['spawns', 'declared spawn rows (OF9b4)'],
27
+ ['faunaTuning', "declared species rows' tuning (OF9b4)"],
28
+ ]
29
+
30
+ function manifestOf(sections: ReadonlyMap<string, unknown>): unknown {
31
+ const level = sections.get('ui/level')
32
+ return typeof level === 'object' && level !== null && !Array.isArray(level)
33
+ ? Reflect.get(level, 'manifest')
34
+ : undefined
35
+ }
36
+
37
+ const MANIFEST_MOVED_DEPRECATIONS: readonly ManifestDeprecation[] = MOVED.map(
38
+ ([word, replacement]: readonly [string, string]): ManifestDeprecation => ({
39
+ id: `manifest.${word}`,
40
+ path: `sections/ui/level manifest.${word} (ONE-FORMAT OF9b5)`,
41
+ since: '0.1.0.4',
42
+ replacement,
43
+ migration: undefined,
44
+ uses: (
45
+ shard: Readonly<{ sections: ReadonlyMap<string, unknown> }>,
46
+ ): boolean => {
47
+ const manifest = manifestOf(shard.sections)
48
+ return (
49
+ typeof manifest === 'object' &&
50
+ manifest !== null &&
51
+ Object.hasOwn(manifest, word)
52
+ )
53
+ },
54
+ }),
55
+ )
56
+
57
+ export { MANIFEST_MOVED_DEPRECATIONS }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The upload caps every host shares (EG-8, D31, J137). api-server refuses a
3
+ * bigger upload and the cook refuses a bigger read; both import this one
4
+ * number, so they cannot drift apart again (BUG-3: the cook refused Pine's
5
+ * 300 MB head while the API took 450 MB).
6
+ */
7
+
8
+ /**
9
+ * The largest shardfile tarball, stored or once decoded. The API commit
10
+ * streams through its `/tmp` (500 MB), which bounds it; Pine Hollow is the
11
+ * largest at 372 MB.
12
+ */
13
+ export const MAX_SHARDFILE_BYTES = 450_000_000