@yottagraph-app/aether-instructions 1.1.37 → 1.1.38

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/rules/data.mdc +20 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yottagraph-app/aether-instructions",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "Cursor rules, commands, and skills for Aether development",
5
5
  "files": [
6
6
  "rules",
package/rules/data.mdc CHANGED
@@ -142,8 +142,8 @@ Elemental API patterns. **Use these instead of writing from scratch:**
142
142
  ```typescript
143
143
  const { flavors, properties, flavorByName, pidByName, refresh } = useElementalSchema();
144
144
  await refresh(); // fetches once, then cached
145
- const articleFid = flavorByName('article'); // → number | null
146
- const namePid = pidByName('name'); // → typically 8
145
+ const articleFid = flavorByName('article'); // → string | null
146
+ const namePid = pidByName('name'); // → string | null
147
147
  ```
148
148
 
149
149
  Handles the dual response shapes (`res.schema.flavors` vs `res.flavors`)
@@ -297,15 +297,31 @@ Same value, different key. Always use a fallback:
297
297
 
298
298
  ```typescript
299
299
  const articleFlavor = flavors.find(f => f.name === 'article');
300
- const articleFid = articleFlavor?.fid ?? articleFlavor?.findex ?? null;
300
+ // Always use String() safe for small IDs (12) and required for large ones
301
+ const articleFid = String(articleFlavor?.fid ?? articleFlavor?.findex ?? '');
301
302
 
302
303
  // When building a FID lookup map:
303
- const fidMap = new Map(flavors.map(f => [f.fid ?? f.findex, f.name]));
304
+ const fidMap = new Map(flavors.map(f => [String(f.fid ?? f.findex), f.name]));
304
305
  ```
305
306
 
306
307
  The `is_type` expression in `/elemental/find` always uses the `fid` key
307
308
  regardless of which schema endpoint provided the value.
308
309
 
310
+ ### Some FIDs and PIDs are 64-bit -- `JSON.parse` will silently corrupt them
311
+
312
+ FIDs and PIDs are stored as 64-bit signed integers. Many are small
313
+ (e.g. `12`), but others exceed JavaScript's `Number.MAX_SAFE_INTEGER`
314
+ (2^53 - 1) -- for example, `3466547124233281063`. `JSON.parse` silently
315
+ rounds these large values (that example becomes `3466547124233281000`). An `is_type` query with
316
+ the rounded FID returns empty results and no error, making it look like
317
+ the data doesn't exist.
318
+
319
+ **Always treat FIDs and PIDs as strings in TypeScript/JavaScript.**
320
+ Before `JSON.parse`, rewrite large numeric `fid`/`pid` fields to
321
+ quoted strings. Store them as `string`, not `number`. Build expressions
322
+ and `pids` arrays via string interpolation, not `JSON.stringify` of a
323
+ JS number. This is safe for small IDs too.
324
+
309
325
  ### Relationship property values need zero-padding to form valid NEIDs
310
326
 
311
327
  Relationship properties (`data_nindex`) return linked entity IDs as raw