@flotrace/runtime-core 2.2.3 → 2.2.4

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.mts CHANGED
@@ -708,15 +708,12 @@ interface ValueTrace {
708
708
  steps: TraceStep[];
709
709
  /** Wall-clock time the resolver completed. */
710
710
  resolvedAtMs: number;
711
- /** True when the 50ms budget tripped and the chain is partial. */
712
- truncated?: boolean;
713
711
  /**
714
712
  * Optional error hint for friendly empty states.
715
713
  * - `value-not-found`: target path doesn't exist on the current fiber.
716
714
  * - `no-fiber`: nodeId no longer present in fiberRefMap (component unmounted).
717
- * - `budget-exceeded`: bailed before finding origin.
718
715
  */
719
- error?: 'value-not-found' | 'no-fiber' | 'budget-exceeded';
716
+ error?: 'value-not-found' | 'no-fiber';
720
717
  }
721
718
  interface RuntimeValueTraceMessage {
722
719
  type: 'runtime:valueTrace';
@@ -898,7 +895,8 @@ declare const DEFAULT_CONFIG: ResolvedFloTraceConfig;
898
895
  * 2. Store match — scan Zustand / Redux / TanStack Query live snapshots
899
896
  * 3. API match — feed matched reference into fetchOriginRegistry WeakMap
900
897
  *
901
- * On-demand only — never runs per-render. Hard 50 ms wall-clock budget.
898
+ * On-demand only — never runs per-render. Bounded by MAX_PROP_CHAIN_DEPTH and
899
+ * SCAN_DEPTH structural limits; no wall-clock budget so every trace runs to origin.
902
900
  * Uses reference identity (`===`) before fingerprinting to keep common cases fast.
903
901
  *
904
902
  * See docs/PRD-VALUE-LINEAGE.md §6 and docs/IMPLEMENTATION-PLAN-VALUE-LINEAGE.md Phase 2.
package/dist/index.d.ts CHANGED
@@ -708,15 +708,12 @@ interface ValueTrace {
708
708
  steps: TraceStep[];
709
709
  /** Wall-clock time the resolver completed. */
710
710
  resolvedAtMs: number;
711
- /** True when the 50ms budget tripped and the chain is partial. */
712
- truncated?: boolean;
713
711
  /**
714
712
  * Optional error hint for friendly empty states.
715
713
  * - `value-not-found`: target path doesn't exist on the current fiber.
716
714
  * - `no-fiber`: nodeId no longer present in fiberRefMap (component unmounted).
717
- * - `budget-exceeded`: bailed before finding origin.
718
715
  */
719
- error?: 'value-not-found' | 'no-fiber' | 'budget-exceeded';
716
+ error?: 'value-not-found' | 'no-fiber';
720
717
  }
721
718
  interface RuntimeValueTraceMessage {
722
719
  type: 'runtime:valueTrace';
@@ -898,7 +895,8 @@ declare const DEFAULT_CONFIG: ResolvedFloTraceConfig;
898
895
  * 2. Store match — scan Zustand / Redux / TanStack Query live snapshots
899
896
  * 3. API match — feed matched reference into fetchOriginRegistry WeakMap
900
897
  *
901
- * On-demand only — never runs per-render. Hard 50 ms wall-clock budget.
898
+ * On-demand only — never runs per-render. Bounded by MAX_PROP_CHAIN_DEPTH and
899
+ * SCAN_DEPTH structural limits; no wall-clock budget so every trace runs to origin.
902
900
  * Uses reference identity (`===`) before fingerprinting to keep common cases fast.
903
901
  *
904
902
  * See docs/PRD-VALUE-LINEAGE.md §6 and docs/IMPLEMENTATION-PLAN-VALUE-LINEAGE.md Phase 2.
package/dist/index.js CHANGED
@@ -3730,7 +3730,6 @@ function safeCall(fn, fallback) {
3730
3730
 
3731
3731
  // src/valueTraceResolver.ts
3732
3732
  var FIBER_TAG_CONTEXT_PROVIDER = 10;
3733
- var BUDGET_MS = 100;
3734
3733
  var SCAN_DEPTH = 3;
3735
3734
  var MAX_PROP_CHAIN_DEPTH = 30;
3736
3735
  function now() {
@@ -3777,8 +3776,7 @@ function findReferenceMatchAtTopLevel(target, container) {
3777
3776
  }
3778
3777
  return null;
3779
3778
  }
3780
- function findMatchingPathInObject(target, targetFp, container, currentPath, depth, deadline, cache) {
3781
- if (now() > deadline) return null;
3779
+ function findMatchingPathInObject(target, targetFp, container, currentPath, depth, cache) {
3782
3780
  if (depth > SCAN_DEPTH) return null;
3783
3781
  if (container === null || typeof container !== "object") return null;
3784
3782
  const selfMatch = valuesMatch(target, targetFp, container, cache);
@@ -3788,7 +3786,7 @@ function findMatchingPathInObject(target, targetFp, container, currentPath, dept
3788
3786
  const child = container[i];
3789
3787
  const directMatch = valuesMatch(target, targetFp, child, cache);
3790
3788
  if (directMatch) return { path: [...currentPath, String(i)], confidence: directMatch };
3791
- const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, String(i)], depth + 1, deadline, cache);
3789
+ const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, String(i)], depth + 1, cache);
3792
3790
  if (nested) return nested;
3793
3791
  }
3794
3792
  } else {
@@ -3796,7 +3794,7 @@ function findMatchingPathInObject(target, targetFp, container, currentPath, dept
3796
3794
  const child = container[key];
3797
3795
  const directMatch = valuesMatch(target, targetFp, child, cache);
3798
3796
  if (directMatch) return { path: [...currentPath, key], confidence: directMatch };
3799
- const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, key], depth + 1, deadline, cache);
3797
+ const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, key], depth + 1, cache);
3800
3798
  if (nested) return nested;
3801
3799
  }
3802
3800
  }
@@ -3863,8 +3861,6 @@ function resolveOriginViaTagOrKeyPath(matchedValue, stateRoot, keyPath) {
3863
3861
  return findFetchOrigin(matchedValue, { ignoreTTL: true }) ?? findFetchOriginUpKeyPath(stateRoot, keyPath);
3864
3862
  }
3865
3863
  function resolveValueTrace(input) {
3866
- const startedAt = now();
3867
- const deadline = startedAt + BUDGET_MS;
3868
3864
  const steps = [];
3869
3865
  const base = {
3870
3866
  rootNodeId: input.nodeId,
@@ -3921,7 +3917,6 @@ function resolveValueTrace(input) {
3921
3917
  let current = fiber.return;
3922
3918
  let hops = 0;
3923
3919
  while (current && hops < MAX_PROP_CHAIN_DEPTH) {
3924
- if (now() > deadline) return { ...base, steps, truncated: true, resolvedAtMs: now() };
3925
3920
  if (current.tag !== FIBER_TAG_CONTEXT_PROVIDER) {
3926
3921
  const props = current.memoizedProps;
3927
3922
  if (props) {
@@ -3929,7 +3924,7 @@ function resolveValueTrace(input) {
3929
3924
  let matchPath = refKey !== null ? [refKey] : null;
3930
3925
  let matchConfidence = "exact";
3931
3926
  if (matchPath === null) {
3932
- const match = findMatchingPathInObject(rootValue, rootFp, props, [], 0, deadline, fpCache);
3927
+ const match = findMatchingPathInObject(rootValue, rootFp, props, [], 0, fpCache);
3933
3928
  if (match) {
3934
3929
  matchPath = match.path;
3935
3930
  matchConfidence = match.confidence;
@@ -3993,7 +3988,7 @@ function resolveValueTrace(input) {
3993
3988
  const contextMatch = findContextMatch(fiber, rootValue, rootFp, fiberToNodeId, fpCache);
3994
3989
  if (contextMatch) {
3995
3990
  steps.push(contextMatch.step);
3996
- const providerStoreMatch = findStoreMatch(contextMatch.providerValue, cachedFp(contextMatch.providerValue, fpCache), deadline, fpCache);
3991
+ const providerStoreMatch = findStoreMatch(contextMatch.providerValue, cachedFp(contextMatch.providerValue, fpCache), fpCache);
3997
3992
  if (providerStoreMatch) {
3998
3993
  steps.push({
3999
3994
  kind: "store",
@@ -4018,7 +4013,7 @@ function resolveValueTrace(input) {
4018
4013
  }
4019
4014
  return { ...base, steps, resolvedAtMs: now() };
4020
4015
  }
4021
- const storeMatch = findStoreMatch(rootValue, rootFp, deadline, fpCache);
4016
+ const storeMatch = findStoreMatch(rootValue, rootFp, fpCache);
4022
4017
  if (storeMatch) {
4023
4018
  steps.push({
4024
4019
  kind: "store",
@@ -4123,10 +4118,9 @@ function findNearestProvider(consumer, contextObj) {
4123
4118
  }
4124
4119
  return null;
4125
4120
  }
4126
- function findStoreMatch(target, targetFp, deadline, cache) {
4121
+ function findStoreMatch(target, targetFp, cache) {
4127
4122
  for (const [storeName, state] of getZustandSnapshot()) {
4128
- if (now() > deadline) return null;
4129
- const hit = findMatchingPathInObject(target, targetFp, state, [], 0, deadline, cache);
4123
+ const hit = findMatchingPathInObject(target, targetFp, state, [], 0, cache);
4130
4124
  if (hit) {
4131
4125
  return {
4132
4126
  source: "zustand",
@@ -4140,8 +4134,7 @@ function findStoreMatch(target, targetFp, deadline, cache) {
4140
4134
  }
4141
4135
  const redux = getReduxSnapshot();
4142
4136
  if (redux) {
4143
- if (now() > deadline) return null;
4144
- const hit = findMatchingPathInObject(target, targetFp, redux, [], 0, deadline, cache);
4137
+ const hit = findMatchingPathInObject(target, targetFp, redux, [], 0, cache);
4145
4138
  if (hit) {
4146
4139
  return {
4147
4140
  source: "redux",
@@ -4154,8 +4147,7 @@ function findStoreMatch(target, targetFp, deadline, cache) {
4154
4147
  }
4155
4148
  }
4156
4149
  for (const [queryHash, entry] of getTanstackSnapshot()) {
4157
- if (now() > deadline) return null;
4158
- const hit = findMatchingPathInObject(target, targetFp, entry.data, [], 0, deadline, cache);
4150
+ const hit = findMatchingPathInObject(target, targetFp, entry.data, [], 0, cache);
4159
4151
  if (hit) {
4160
4152
  return {
4161
4153
  source: "tanstack-query",
package/dist/index.mjs CHANGED
@@ -3648,7 +3648,6 @@ function safeCall(fn, fallback) {
3648
3648
 
3649
3649
  // src/valueTraceResolver.ts
3650
3650
  var FIBER_TAG_CONTEXT_PROVIDER = 10;
3651
- var BUDGET_MS = 100;
3652
3651
  var SCAN_DEPTH = 3;
3653
3652
  var MAX_PROP_CHAIN_DEPTH = 30;
3654
3653
  function now() {
@@ -3695,8 +3694,7 @@ function findReferenceMatchAtTopLevel(target, container) {
3695
3694
  }
3696
3695
  return null;
3697
3696
  }
3698
- function findMatchingPathInObject(target, targetFp, container, currentPath, depth, deadline, cache) {
3699
- if (now() > deadline) return null;
3697
+ function findMatchingPathInObject(target, targetFp, container, currentPath, depth, cache) {
3700
3698
  if (depth > SCAN_DEPTH) return null;
3701
3699
  if (container === null || typeof container !== "object") return null;
3702
3700
  const selfMatch = valuesMatch(target, targetFp, container, cache);
@@ -3706,7 +3704,7 @@ function findMatchingPathInObject(target, targetFp, container, currentPath, dept
3706
3704
  const child = container[i];
3707
3705
  const directMatch = valuesMatch(target, targetFp, child, cache);
3708
3706
  if (directMatch) return { path: [...currentPath, String(i)], confidence: directMatch };
3709
- const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, String(i)], depth + 1, deadline, cache);
3707
+ const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, String(i)], depth + 1, cache);
3710
3708
  if (nested) return nested;
3711
3709
  }
3712
3710
  } else {
@@ -3714,7 +3712,7 @@ function findMatchingPathInObject(target, targetFp, container, currentPath, dept
3714
3712
  const child = container[key];
3715
3713
  const directMatch = valuesMatch(target, targetFp, child, cache);
3716
3714
  if (directMatch) return { path: [...currentPath, key], confidence: directMatch };
3717
- const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, key], depth + 1, deadline, cache);
3715
+ const nested = findMatchingPathInObject(target, targetFp, child, [...currentPath, key], depth + 1, cache);
3718
3716
  if (nested) return nested;
3719
3717
  }
3720
3718
  }
@@ -3781,8 +3779,6 @@ function resolveOriginViaTagOrKeyPath(matchedValue, stateRoot, keyPath) {
3781
3779
  return findFetchOrigin(matchedValue, { ignoreTTL: true }) ?? findFetchOriginUpKeyPath(stateRoot, keyPath);
3782
3780
  }
3783
3781
  function resolveValueTrace(input) {
3784
- const startedAt = now();
3785
- const deadline = startedAt + BUDGET_MS;
3786
3782
  const steps = [];
3787
3783
  const base = {
3788
3784
  rootNodeId: input.nodeId,
@@ -3839,7 +3835,6 @@ function resolveValueTrace(input) {
3839
3835
  let current = fiber.return;
3840
3836
  let hops = 0;
3841
3837
  while (current && hops < MAX_PROP_CHAIN_DEPTH) {
3842
- if (now() > deadline) return { ...base, steps, truncated: true, resolvedAtMs: now() };
3843
3838
  if (current.tag !== FIBER_TAG_CONTEXT_PROVIDER) {
3844
3839
  const props = current.memoizedProps;
3845
3840
  if (props) {
@@ -3847,7 +3842,7 @@ function resolveValueTrace(input) {
3847
3842
  let matchPath = refKey !== null ? [refKey] : null;
3848
3843
  let matchConfidence = "exact";
3849
3844
  if (matchPath === null) {
3850
- const match = findMatchingPathInObject(rootValue, rootFp, props, [], 0, deadline, fpCache);
3845
+ const match = findMatchingPathInObject(rootValue, rootFp, props, [], 0, fpCache);
3851
3846
  if (match) {
3852
3847
  matchPath = match.path;
3853
3848
  matchConfidence = match.confidence;
@@ -3911,7 +3906,7 @@ function resolveValueTrace(input) {
3911
3906
  const contextMatch = findContextMatch(fiber, rootValue, rootFp, fiberToNodeId, fpCache);
3912
3907
  if (contextMatch) {
3913
3908
  steps.push(contextMatch.step);
3914
- const providerStoreMatch = findStoreMatch(contextMatch.providerValue, cachedFp(contextMatch.providerValue, fpCache), deadline, fpCache);
3909
+ const providerStoreMatch = findStoreMatch(contextMatch.providerValue, cachedFp(contextMatch.providerValue, fpCache), fpCache);
3915
3910
  if (providerStoreMatch) {
3916
3911
  steps.push({
3917
3912
  kind: "store",
@@ -3936,7 +3931,7 @@ function resolveValueTrace(input) {
3936
3931
  }
3937
3932
  return { ...base, steps, resolvedAtMs: now() };
3938
3933
  }
3939
- const storeMatch = findStoreMatch(rootValue, rootFp, deadline, fpCache);
3934
+ const storeMatch = findStoreMatch(rootValue, rootFp, fpCache);
3940
3935
  if (storeMatch) {
3941
3936
  steps.push({
3942
3937
  kind: "store",
@@ -4041,10 +4036,9 @@ function findNearestProvider(consumer, contextObj) {
4041
4036
  }
4042
4037
  return null;
4043
4038
  }
4044
- function findStoreMatch(target, targetFp, deadline, cache) {
4039
+ function findStoreMatch(target, targetFp, cache) {
4045
4040
  for (const [storeName, state] of getZustandSnapshot()) {
4046
- if (now() > deadline) return null;
4047
- const hit = findMatchingPathInObject(target, targetFp, state, [], 0, deadline, cache);
4041
+ const hit = findMatchingPathInObject(target, targetFp, state, [], 0, cache);
4048
4042
  if (hit) {
4049
4043
  return {
4050
4044
  source: "zustand",
@@ -4058,8 +4052,7 @@ function findStoreMatch(target, targetFp, deadline, cache) {
4058
4052
  }
4059
4053
  const redux = getReduxSnapshot();
4060
4054
  if (redux) {
4061
- if (now() > deadline) return null;
4062
- const hit = findMatchingPathInObject(target, targetFp, redux, [], 0, deadline, cache);
4055
+ const hit = findMatchingPathInObject(target, targetFp, redux, [], 0, cache);
4063
4056
  if (hit) {
4064
4057
  return {
4065
4058
  source: "redux",
@@ -4072,8 +4065,7 @@ function findStoreMatch(target, targetFp, deadline, cache) {
4072
4065
  }
4073
4066
  }
4074
4067
  for (const [queryHash, entry] of getTanstackSnapshot()) {
4075
- if (now() > deadline) return null;
4076
- const hit = findMatchingPathInObject(target, targetFp, entry.data, [], 0, deadline, cache);
4068
+ const hit = findMatchingPathInObject(target, targetFp, entry.data, [], 0, cache);
4077
4069
  if (hit) {
4078
4070
  return {
4079
4071
  source: "tanstack-query",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flotrace/runtime-core",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Platform-agnostic core for FloTrace runtime — fiber walker, analyzers, trackers. Shared by @flotrace/runtime (web) and @flotrace/runtime-native (React Native).",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",