@remnic/bench 9.36.0 → 9.38.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.
Files changed (2) hide show
  1. package/dist/index.js +46 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -47136,10 +47136,10 @@ function validateScheduleOptions(options) {
47136
47136
  throw new Error("drift-gen driftingRatio + contradictedRatio must not exceed 1");
47137
47137
  }
47138
47138
  const pairCapacity = (CONTACTS_PER_USER + 1) * ATTRIBUTE_SPECS.length;
47139
- const worstCaseFresh = options.epochs * options.factsPerEpoch;
47140
- if (worstCaseFresh > pairCapacity) {
47139
+ const maxActivePairs = options.contradictedRatio === 1 ? options.factsPerEpoch : options.epochs * options.factsPerEpoch;
47140
+ if (maxActivePairs > pairCapacity) {
47141
47141
  throw new Error(
47142
- `drift-gen cannot allocate ${worstCaseFresh} facts per user: only ${pairCapacity} unique subject/attribute pairs exist. Lower epochs or factsPerEpoch.`
47142
+ `drift-gen cannot allocate ${maxActivePairs} active facts per user: only ${pairCapacity} unique subject/attribute pairs exist.`
47143
47143
  );
47144
47144
  }
47145
47145
  }
@@ -47207,6 +47207,25 @@ function createFreshFact(rng, options, userId, subjects, activeByPair, epoch, or
47207
47207
  probes: []
47208
47208
  };
47209
47209
  }
47210
+ for (const subject of subjects) {
47211
+ for (const spec of ATTRIBUTE_SPECS) {
47212
+ if (activeByPair.has(`${subject}|${spec.attribute}`)) continue;
47213
+ const value = pickOne(rng, spec.values);
47214
+ return {
47215
+ id: `gf-${userId}-${epoch}-${ordinal + 1}`,
47216
+ userId,
47217
+ statement: formatFactStatement(subject, spec.attribute, value),
47218
+ subject,
47219
+ attribute: spec.attribute,
47220
+ value,
47221
+ introducedEpoch: epoch,
47222
+ supersededEpoch: null,
47223
+ supersededBy: null,
47224
+ kind: rollKind(rng, options, epoch),
47225
+ probes: []
47226
+ };
47227
+ }
47228
+ }
47210
47229
  throw new Error(
47211
47230
  "drift-gen exhausted unique subject/attribute pairs; lower factsPerEpoch or epochs"
47212
47231
  );
@@ -47735,6 +47754,26 @@ function expectedProbeAnswer(probe, facts) {
47735
47754
  return facts.map((fact3) => fact3.value).join("; ");
47736
47755
  }
47737
47756
  }
47757
+ function expectedProbeQuestion(probe, facts) {
47758
+ if (probe.category === "aggregation") {
47759
+ const parts = facts.map((fact3) => {
47760
+ const spec2 = ATTRIBUTE_SPECS.find(({ attribute }) => attribute === fact3.attribute);
47761
+ return spec2 ? `what is ${fact3.subject}'s ${spec2.noun}` : null;
47762
+ });
47763
+ return parts.every((part) => part !== null) ? `Answer in order: ${parts.join("; ")}?` : null;
47764
+ }
47765
+ if (facts.length === 0) return null;
47766
+ const spec = ATTRIBUTE_SPECS.find(({ attribute }) => attribute === facts[0].attribute);
47767
+ if (!spec) return null;
47768
+ switch (probe.category) {
47769
+ case "current":
47770
+ return spec.questionCurrent(facts[0].subject);
47771
+ case "historical":
47772
+ return spec.questionHistorical(facts[0].subject);
47773
+ case "transition":
47774
+ return spec.questionTransition(facts[0].subject);
47775
+ }
47776
+ }
47738
47777
  function checkProbeIntegrity(loaded, epochs, errors) {
47739
47778
  const byId = new Map(loaded.facts.map((f) => [f.id, f]));
47740
47779
  const seenProbeIds = /* @__PURE__ */ new Set();
@@ -47779,6 +47818,10 @@ function checkProbeIntegrity(loaded, epochs, errors) {
47779
47818
  if (expectedAnswer !== null && probe.expectedAnswer !== expectedAnswer) {
47780
47819
  errors.push(`${probe.id}: expectedAnswer does not match the referenced facts`);
47781
47820
  }
47821
+ const expectedQuestion = expectedProbeQuestion(probe, requiredFacts);
47822
+ if (expectedQuestion !== null && probe.question !== expectedQuestion) {
47823
+ errors.push(`${probe.id}: question does not match the referenced facts`);
47824
+ }
47782
47825
  if (probe.category === "transition" && requiredFacts.length === 2 && requiredFacts[0].supersededBy !== requiredFacts[1].id) {
47783
47826
  errors.push(`${probe.id}: transition probe facts are not linked by supersession`);
47784
47827
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.36.0",
3
+ "version": "9.38.0",
4
4
  "description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,8 +40,8 @@
40
40
  "hyparquet": "^1.25.7",
41
41
  "yaml": "^2.4.2",
42
42
  "zod": "^3.24.0",
43
- "@remnic/coding-graph": "^9.36.0",
44
- "@remnic/core": "^9.36.0"
43
+ "@remnic/coding-graph": "^9.38.0",
44
+ "@remnic/core": "^9.38.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.5.1",