@ikenga/contract 0.18.0 → 0.18.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/dist/index.d.ts CHANGED
@@ -14,5 +14,5 @@ export * from './host-context.js';
14
14
  export * from './app-bridge.js';
15
15
  export * from './ngwa.js';
16
16
  /** This package's own version. */
17
- export declare const CONTRACT_PACKAGE_VERSION: "0.5.0";
17
+ export declare const CONTRACT_PACKAGE_VERSION: "0.18.0";
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,EAAG,OAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,EAAG,QAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,5 @@ export * from './host-context.js';
14
14
  export * from './app-bridge.js';
15
15
  export * from './ngwa.js';
16
16
  /** This package's own version. */
17
- export const CONTRACT_PACKAGE_VERSION = '0.5.0';
17
+ export const CONTRACT_PACKAGE_VERSION = '0.18.0';
18
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAE1B,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikenga/contract",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Shared contract for the Ikenga pkg system: manifest schema, RPC types, Engine interface, capability scopes.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -15,4 +15,4 @@ export * from './app-bridge.js';
15
15
  export * from './ngwa.js';
16
16
 
17
17
  /** This package's own version. */
18
- export const CONTRACT_PACKAGE_VERSION = '0.5.0' as const;
18
+ export const CONTRACT_PACKAGE_VERSION = '0.18.0' as const;
package/src/ngwa.test.ts CHANGED
@@ -191,8 +191,52 @@ test('Ngwa: every field name in draft §2 is present on a parsed fixture', () =>
191
191
  ]);
192
192
  assert.deepEqual(keys(snap.sources.kernel), ['count', 'error', 'ok']);
193
193
 
194
- // …and nothing anywhere in the parsed snapshot is camelCase.
195
- assertSnakeCaseKeys(snap);
194
+ // …and the SOURCE fixture is snake_case throughout. Asserting this on the
195
+ // PARSED value would be vacuous: Zod strips unknown keys, so a camelCase key
196
+ // could never survive to be seen. Audited and corrected, Round 13.
197
+ assertSnakeCaseKeys(SNAPSHOT);
198
+ });
199
+
200
+ // ── Round 13 — the real drift guard ────────────────────────────────────────
201
+ //
202
+ // The parity assertions above catch a field REMOVED from a schema (the parsed
203
+ // key set shrinks). They cannot catch a field the producer ADDS, because Zod
204
+ // strips unknown keys before any assertion can see them. These two tests cover
205
+ // that direction: the first pins the strip as documented behaviour, the second
206
+ // is the guard WP-14's Rust producer is checked against.
207
+
208
+ test('Ngwa: unknown keys are STRIPPED, not preserved (documents the default)', () => {
209
+ const parsed = NgwaPlacementSchema.parse({
210
+ ...PLACEMENT,
211
+ linkTarget: 'camelCase twin of link_target',
212
+ EXTRA_unknown: 1,
213
+ }) as Record<string, unknown>;
214
+
215
+ assert.equal('linkTarget' in parsed, false);
216
+ assert.equal('EXTRA_unknown' in parsed, false);
217
+ assert.equal(parsed.link_target, PLACEMENT.link_target);
218
+ });
219
+
220
+ test('Ngwa: a .strict() variant REJECTS an unknown key (the producer-drift guard)', () => {
221
+ // DEC-26: the shipped schemas stay permissive so a snapshot never fails to
222
+ // parse in the field. Drift is caught here, and in WP-14's own parity test
223
+ // against a real `ngwa_snapshot` payload.
224
+ assert.equal(NgwaPlacementSchema.strict().safeParse(PLACEMENT).success, true);
225
+
226
+ for (const stray of ['linkTarget', 'inStore', 'managedBy', 'whatever']) {
227
+ const res = NgwaPlacementSchema.strict().safeParse({ ...PLACEMENT, [stray]: 'x' });
228
+ assert.equal(res.success, false, `strict parse should reject ${stray}`);
229
+ }
230
+
231
+ assert.equal(NgwaItemSchema.strict().safeParse(ITEM).success, true);
232
+ assert.equal(
233
+ NgwaItemSchema.strict().safeParse({ ...ITEM, displayName: 'camel twin' }).success,
234
+ false,
235
+ );
236
+ assert.equal(
237
+ NgwaOriginSchema.strict().safeParse({ ...ORIGIN, resolvedVersion: '1.0.0' }).success,
238
+ false,
239
+ );
196
240
  });
197
241
 
198
242
  test('Ngwa: the three frozen enum lists match §2 exactly', () => {