Add adaptive browser state graph exploration - #2030
Merged
Merged
Conversation
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wp-codebox/browser-adaptive-exploration/v1contract and deterministic planner for bounded state, transition, action, revisit, descriptor, stabilization, error, duration, and artifact budgetsArchitecture and layer ownership
runtime-coreowns the backend-neutral adaptive contract, action planning, digests, graph/replay DTOs, and exact campaign fingerprint semantics.runtime-playgroundowns Playwright DOM discovery, frame inspection, bounded mutation/stabilization polling, action execution, and browser artifact capture. The merged #2027 selector strategy was extracted unchanged into a shared playground discovery module used by both one-shot and adaptive modes.This is a standalone additive
adaptive-exploration-jsonmode onwordpress.browser-actions; it does not add another browser DSL, campaign runner, checkpoint abstraction, or artifact system.State digest and stabilization
States hash bounded semantic DOM structure, visible text, input/checked state, title, URL/frame identity, loading observations, history state, and the unique descriptor digest. Absolute history length is recorded as transition evidence but excluded from state identity so start-URL replay remains reproducible.
Each state-changing action installs bounded mutation counters, polls the current document and supported same-origin frames until the DOM digest is quiet and loading indicators clear, or stops at the explicit stabilization deadline. Cross-origin frames/links and observed shadow roots produce honest bounded diagnostics rather than claimed coverage.
Budgets and safety
Exploration deterministically deduplicates states and actions while bounding actions (including reset/minimization replay), states, transitions, visits, descriptors, frames, mutation records, diagnostics, errors, duration, and graph bytes. It never uses
.first(), force clicks, or ambiguous selectors. Selectors are rechecked for exactly one match immediately before execution; invalidation is recorded as a harness diagnostic, not misclassified as an application finding. Cancellation stops scheduling, awaits the active sequential operation, and retains bounded incomplete evidence for established teardown.Same-origin click/fill/select/submit/keyboard/back/reload/repeat/double-submit transitions are planned where supported. Cross-origin link actions are rejected before entering the frontier.
Checkpoints, minimization, and replay
The adaptive recipe example composes the #2026 adversarial recipe lifecycle and
checkpoint-per-casereset policy. Existing campaign execution restores the declared baseline before original and minimization candidates. Campaign fingerprints now includestateDigest; minimized candidates must reproduce the exact oracle/status/diagnostic/matrix/state fingerprint, and replay envelopes record and verify both expected fingerprint and expected state.Compatibility
Authored
steps-jsonand one-shotaction-corpus-jsonpaths are unchanged. Adaptive mode is explicitly standalone to prevent altering authored action ordering or one-shot corpus semantics. Existing public/package export contracts and recipe validation are updated without version or changelog edits.Tests and results
npm run buildnpm run test:adversarial-runtime: 14 passedfiles/browser/adaptive-exploration.jsonthrough the normal artifact manifestnpm run checkindependently reached the pre-existing #1745 command-registry smoke assertion:wordpress.collect-workload-result outputShape should mention outputSchema id. No unrelated command-registry code was changed to work around it.Residual limitations
Fixes #2025