@ai-matrx/records 0.83.0 → 0.83.2

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 — @ai-matrx/records
2
2
 
3
+ ## 0.83.2
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records/v0.83.1..npm/records/v0.83.2 -- apps/shared/records`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.83.1
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records/v0.83.0..npm/records/v0.83.1 -- apps/shared/records`).
13
+ No source changes intended and no consumer action required.
3
14
 
4
15
  ## 0.83.0 — the gate parses with the one formula language
5
16
 
@@ -15,7 +26,7 @@ Consumer action: `parseFormula` / `FORMULA_FUNCTIONS` from `@ai-matrx/records`
15
26
  ## 0.82.1
16
27
  ### lane DESCRIBE-BENCH2 (sweep): the mechanical wrong shapes are read, not refused
17
28
 
18
- - `autofixDescribeSpec` also rewrites, each with an auto-fix note and only when unambiguous: view `filters` written as a list of `{field, op, value}` (→ the store's map; several values → `anyOf`; a condition the store cannot express is dropped and SAID), `sort`/`orderBy` → `sorts`, `group_by`/`date_field`/… → `groupBy`/`dateField`/…, an exact duplicate view dropped; a field typed with `kind`/`type` (or by a plain label) → `parityType`; a formula over bare field names → `{Label}`; a relationship `inverseKey` that is already a field of the target (the store then read the rollup's link as a plain formula) renamed; a rollup named for a status with no filter → the filter when exactly one far-side choice/tick box is that word; a real-looking phone → a fictional one; a copy of the shared team_member block → an ordinary table (name, role, notes).
29
+ - `autofixDescribeSpec` also rewrites, each with an auto-fix note and only when unambiguous: view `filters` written as a list of `{field, op, value}` (→ the store's map; several values → `anyOf`; a condition the store cannot express is dropped and SAID), `sort`/`orderBy` → `sorts`, `group_by`/`date_field`/… → `groupBy`/`dateField`/…, an exact duplicate view dropped; a field typed with `kind`/`type` (or by a plain label) → `parityType`; a formula over bare field names → `{Label}`; a relationship `inverseKey` that is already a field of the target (the store then read the rollup's link as a plain formula) renamed; a rollup named for a status with no filter → the filter when exactly one far-side choice/tick box is that word; a real-looking phone → a fictional one; a copy of the shared team_member block → an ordinary table (name, role, notes) — never a table whose fields are exactly one the person already has (a link-only reuse is not changed, and `describeCheck` no longer calls it a copy of the shared block).
19
30
  - `describeVocabulary()` gains `view_filters_shape`, `field_shape`, `formula_shape`, `relationship_shape`, `phone_rule`, `team_rule`.
20
31
 
21
32
  ## Earlier in this release — a rollup or lookup in the wrong shape is read, not refused
@@ -7178,13 +7178,15 @@ function fixFictionalPhones(spec, fixes) {
7178
7178
  Object.assign(spec, next);
7179
7179
  fixes.push(`phones: ${n} number(s) that could reach a real phone replaced with fictional ones (555-0100\u20260199, UK Ofcom drama range)`);
7180
7180
  }
7181
- function fixTeamBlockCopy(spec, fixes) {
7181
+ function fixTeamBlockCopy(spec, fixes, existing = []) {
7182
7182
  const block = SHARED_BLOCKS.team_member;
7183
7183
  const used = /* @__PURE__ */ new Set();
7184
7184
  for (const v of spec.views ?? []) for (const k of ["groupBy", "dateField", "startField", "endField", "coverField", "swimlaneBy", "measure"]) if (v.table && v[k]) used.add(`${v.table}.${v[k]}`);
7185
7185
  for (const fm of spec.forms ?? []) for (const q2 of fm.fields ?? []) used.add(`${fm.table}.${q2.fieldKey}`);
7186
7186
  for (const e of spec.extras ?? []) for (const q2 of e.questions ?? []) used.add(`${e.table}.${q2.fieldKey}`);
7187
7187
  for (const t of spec.tables) {
7188
+ const keys = t.fields.map((f) => f.key).sort().join("|");
7189
+ if (existing.some((e) => e.fields.map((f) => f.key).sort().join("|") === keys)) continue;
7188
7190
  const meaning = (f) => block.fields.find((bf) => bf.parityType === f.parityType && bf.sameAs.some((w) => same3(w, f.label) || same3(w, f.key)));
7189
7191
  const hits = t.fields.map((f) => ({ f, bf: meaning(f) })).filter((x) => x.bf);
7190
7192
  if (hits.length < block.copyThreshold) continue;
@@ -7538,7 +7540,7 @@ function autofixDescribeSpec(input, ctx = {}) {
7538
7540
  dropDuplicateViews(spec, autoFixes);
7539
7541
  fixInverseKeys(spec, autoFixes);
7540
7542
  fixRollupFilters(spec, autoFixes);
7541
- fixTeamBlockCopy(spec, autoFixes);
7543
+ fixTeamBlockCopy(spec, autoFixes, ctx.existingTables ?? []);
7542
7544
  fixFictionalPhones(spec, autoFixes);
7543
7545
  fixMissingQuestionFields(spec, autoFixes);
7544
7546
  raiseSensitivity(spec, autoFixes);
@@ -7555,7 +7557,10 @@ function autofixDescribeSpec(input, ctx = {}) {
7555
7557
  function describeCheck(spec, ctx = {}) {
7556
7558
  const fixed = autofixDescribeSpec(spec, ctx);
7557
7559
  const v = validateTemplate(fixed.spec, { profile: "describe" });
7558
- return { ...fixed, problems: v.problems.map((p) => ({ at: p.at, says: p.says })) };
7560
+ const sameFields = (t) => (ctx.existingTables ?? []).some((e) => e.fields.map((f) => f.key).sort().join("|") === t.fields.map((f) => f.key).sort().join("|"));
7561
+ const reused = new Set(fixed.spec.tables.filter(sameFields).map((t) => t.token));
7562
+ const problems = v.problems.filter((p) => !(/^This table copies the shared /.test(p.says) && reused.has(/\((\w+)\)/.exec(p.at)?.[1] ?? "")));
7563
+ return { ...fixed, problems: problems.map((p) => ({ at: p.at, says: p.says })) };
7559
7564
  }
7560
7565
 
7561
7566
  // src/templates/describe/repair.ts