mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 11:37:09 +00:00
merge origin/master into llm-recording-and-analysis
both sides independently fixed the same three bugs, so each one had to pick a winner rather than keep both implementations. extractor encoding: master's recordableValue in worker.go wins over ours in marshal.go, since master's is pinned by extractor_encoding_test.go and ours had no tests. our error semantics stay: encodeExtractorValue still returns an error instead of nil, so an extractor cannot vanish from the trace silently. apply errors: only the residual generic branch takes master's unconfirmed copy, where the device may have committed the action before the call failed. the finer branches that know nothing was dispatched keep lastAction = nil, and our actionSkipReason taxonomy stays alongside master's held/skippedVerification. selector matching: our matchAttr with matchSelectorKind wins over master's match, since ours also handles idPrefix. matchSelector now calls it, which git did not flag as a conflict and left calling a function our side had deleted. the ltl doc comment takes master's correction: an unbounded eventually that never fires IS violated at run end.
This commit is contained in:
commit
6e85cac8b3
130 files changed
+12772
-1617
No files matched your search
@@ -306,13 +306,18 @@ function selectorFromString(selector: string): { css?: string; xpath?: string }
|
||||
// (Compose for Web mounts its canvas and its whole accessibility tree inside a
|
||||
// shadow root on the mount element) keeps its entire UI on the far side of one:
|
||||
// without this a spec sees four nodes and can neither enumerate a target nor
|
||||
// resolve a testTag. Light-DOM matches come first, then shadow content in walk
|
||||
// order. XPath has no equivalent, so `text:` selectors stop at the boundary.
|
||||
// resolve a testTag. Matches come back in the order expandShadowContent walks
|
||||
// and buildTree (internal/driver/chrome/driver.go) emits: a host, then that
|
||||
// host's shadow content, then the host's light children. Sweeping the light DOM
|
||||
// first and descending afterwards put a shadow-hosted match behind a later
|
||||
// light-DOM one, so find() answered with a different element on each host.
|
||||
// XPath has no equivalent, so `text:` selectors stop at the boundary.
|
||||
function deepQueryAll(selector: string, root: ParentNode): Element[] {
|
||||
const found: Element[] = [];
|
||||
const visit = (scope: ParentNode): void => {
|
||||
for (const element of Array.from(scope.querySelectorAll(selector))) found.push(element);
|
||||
const matched = new Set<Element>(Array.from(scope.querySelectorAll(selector)));
|
||||
for (const element of Array.from(scope.querySelectorAll<HTMLElement>("*"))) {
|
||||
if (matched.has(element)) found.push(element);
|
||||
if (element.shadowRoot) visit(element.shadowRoot);
|
||||
}
|
||||
};
|
||||
@@ -615,6 +620,15 @@ if (typeof globalThis.addEventListener === "function") {
|
||||
// that reads state.lastAction vacuously true on web.
|
||||
let lastAction: unknown = null;
|
||||
|
||||
// logs is what the driver captured between the previous step and this one,
|
||||
// pushed in by the Go runner (via __sanderlingSetLogs__) before each extractor
|
||||
// evaluation, in the shape internal/verifier/marshal.go builds for goja. The
|
||||
// page cannot derive it: console output reaches the runner over CDP and nothing
|
||||
// in the page reads it back. Hardcoding [] here, as this file used to, makes
|
||||
// every spec property that reads state.logs vacuously true on web, the default
|
||||
// noLogcatErrors included, because the page's reading is the one that wins.
|
||||
let logs: unknown[] = [];
|
||||
|
||||
function buildState(): unknown {
|
||||
return {
|
||||
snapshots: {},
|
||||
@@ -623,7 +637,7 @@ function buildState(): unknown {
|
||||
window,
|
||||
lastAction,
|
||||
time: 0,
|
||||
logs: [],
|
||||
logs,
|
||||
exceptions: capturedExceptions.slice(),
|
||||
};
|
||||
}
|
||||
@@ -672,6 +686,11 @@ defineLockedGlobal("__sanderlingSetLastAction__", (value: unknown) => {
|
||||
lastAction = value ?? null;
|
||||
});
|
||||
|
||||
// The host calls this once per step too, alongside __sanderlingSetLastAction__.
|
||||
defineLockedGlobal("__sanderlingSetLogs__", (value: unknown) => {
|
||||
logs = Array.isArray(value) ? value : [];
|
||||
});
|
||||
|
||||
// The host reads the same buffer buildState puts behind state.exceptions, so
|
||||
// the goja-side state.exceptions is the page's list rather than the empty one
|
||||
// it held before, and the trace records an error surface an offline oracle can
|
||||
|
||||
Reference in new issue
Block a user