mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-20 20:38:34 +00:00
fix(studio): filter runtime-generated nodes from resolver-shadow telemetry (#1795)
The sdk_resolver_shadow tripwire flagged element_not_found for nodes a composition <script> creates at runtime (caption word/group spans, etc.). These have no static data-hf-id, so the SDK session (a static parse) cannot model them by design; the divergence is noise, not a resolver bug. - Runtime-node filter: suppress element_not_found when the resolved hf-id is absent from the on-disk source. An id PRESENT in source but missing from the session stays flagged (the genuine v0.6.110-class resolver divergence). - Add sessionElementCount to all element_not_found / animation_not_found emits (0 = empty/broken session, >0 = element-specific). - Add sourceHfIdCount to emitted element_not_found: =1 = static node the parse dropped (foreign-content exclusion / sub-comp gap), >1 = duplicate-id resolver ambiguity. Scoped to the DOM-edit path. Telemetry-only; no disk writes, no edit change. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f24a1a9ce7
commit
a4eacaec37
@@ -226,6 +226,53 @@ describe("C. Resolver-parity detection", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("C8 runtime-node filter: hfId absent from source → suppressed (not a resolver bug)", () => {
|
||||
// The studio resolved a live-DOM element to an hf-id that the SDK session
|
||||
// doesn't contain AND that never appears in the on-disk source — it's a
|
||||
// node a composition <script> created at runtime (e.g. caption spans). Not
|
||||
// a resolver divergence; suppress.
|
||||
const session = { getElement: () => null, getElements: () => [] } as unknown as Parameters<
|
||||
typeof sdkResolverShadowCheck
|
||||
>[0];
|
||||
const source = `<div data-hf-id="hf-static">no runtime id here</div>`;
|
||||
const mismatches = sdkResolverShadowCheck(
|
||||
session,
|
||||
"hf-runtimeonly",
|
||||
[{ type: "inline-style", property: "color", value: "red" }],
|
||||
source,
|
||||
);
|
||||
expect(mismatches).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("C8 runtime-node filter: hfId PRESENT in source but missing from session → still flagged (real bug)", () => {
|
||||
const session = { getElement: () => null, getElements: () => [] } as unknown as Parameters<
|
||||
typeof sdkResolverShadowCheck
|
||||
>[0];
|
||||
const source = `<div data-hf-id="hf-realbug">in source, not in SDK session</div>`;
|
||||
const mismatches = sdkResolverShadowCheck(
|
||||
session,
|
||||
"hf-realbug",
|
||||
[{ type: "inline-style", property: "color", value: "red" }],
|
||||
source,
|
||||
);
|
||||
expect(mismatches).toHaveLength(1);
|
||||
expect(mismatches[0]?.kind).toBe("element_not_found");
|
||||
});
|
||||
|
||||
it("C8 sourceHfIdCount: emitted element_not_found carries source occurrence count", async () => {
|
||||
mockFlags.STUDIO_SDK_RESOLVER_SHADOW_ENABLED = true;
|
||||
const session = { getElement: () => null, getElements: () => [] } as unknown as Composition;
|
||||
// id present twice in source (duplicate-id ambiguity) but absent from session
|
||||
const source = `<div data-hf-id="hf-dup">a</div><div data-hf-id="hf-dup">b</div>`;
|
||||
runResolverShadow(
|
||||
session,
|
||||
"hf-dup",
|
||||
[{ type: "inline-style", property: "color", value: "red" }],
|
||||
source,
|
||||
);
|
||||
expect(lastShadow()?.sourceHfIdCount).toBe(2);
|
||||
});
|
||||
|
||||
it("C10: unmappable op type produces no mismatch (excluded, not flagged)", async () => {
|
||||
const session = await openComposition(BASE_HTML);
|
||||
// "unknown-op" is not in MAPPED_OP_TYPES, so it must be silently excluded.
|
||||
|
||||
Reference in New Issue
Block a user