Skip to content

fix(browser): keep duplicated scenario step ids from being classified as absent - #7439

Closed
kittimzhe wants to merge 1 commit into
morluto:mainfrom
kittimzhe:fix/compare-captures-duplicate-absence
Closed

kittimzhe wants to merge 1 commit into
morluto:mainfrom
kittimzhe:fix/compare-captures-duplicate-absence

Conversation

@kittimzhe

@kittimzhe kittimzhe commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

compare-web-captures classified a step_id duplicated in one capture as also missing from that capture: alignment keeps only unique step ids per side, so the same id arriving uniquely on the other side landed in before_only/after_only and produced a missing_before_step/missing_after_step failure beside the correct duplicate failure — a definite absence claim for a step the capture retains. Alignment now keeps a duplicated id out of the absence lists on both sides; the id stays unaligned with its duplicate failure, and genuinely missing ids keep their missing_* classification. Fixes #7415.

Problem and expected behavior

Smallest trigger: compare a before capture retaining save twice against an after capture retaining it once (the reduced CLI fixtures from #7415). The alignment reported duplicate_before_step_id and missing_before_step for the same id, plus after_only: ["save"]. Reversing the captures produced the symmetric missing_after_step.

Violated invariant: docs/browser-scenario-contract.md — duplicate ids make alignment fail — and AGENTS.md: "Unresolved identity or applicability must remain unknown rather than be treated as absent". The duplicated identity is ambiguous, which must keep it unaligned, not turn its presence into an absence claim.

Expected: the duplicate failure alone; no missing_* and no absence-list entry for the duplicated id on either side; a genuinely absent id keeps its missing_* classification and absence entry.

Change and scope

  • src/domain/browserScenarioDiff.ts (alignScenarioSteps): beforeOnly/afterOnly additionally exclude ids duplicate-classified on the other side. Duplicate failures, aligned-step ordering, and true-absence classification are unchanged.
  • src/domain/browserScenarioDiff.test.ts: two regressions covering both duplicate directions, next to the existing missing-step coverage.
  • Not included: no change to how duplicates are detected or reported, and no change to overall_status.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the scenario comparison alignment (alignScenarioSteps), the single producer of before_only/after_only and alignment failures; no consumer reinterprets them. No superseded path.
  • Contribution scope fit and linked maintainer decision: ordinary fix within the existing comparison boundary — not applicable.
  • CLI and MCP/tool-catalog contract: alignment.before_only/after_only no longer contain ids duplicated on the other side, and alignment.failures no longer carries a missing_* entry for them. duplicate_*_step_id failures, alignment.status and overall_status are unchanged for these inputs (partial/unknown). No schema or tool-catalog change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: retained captures are read unchanged; only the derived alignment projection changes.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: two cases in src/domain/browserScenarioDiff.test.ts (duplicate in the before capture, duplicate in the after capture), each asserting empty absence lists and the duplicate failure alone.
  • Base reproduction or other evidence: executed. [Bug] compare-web-captures classifies an ambiguous retained step ID as absent #7415's reduced CLI fixtures on a freshly built base reproduced the false missing_before_step with after_only: ["save"]. After the change, the same fixtures were run through the real CLI in five comparisons: duplicate-before, duplicate-after, unique self-comparison (unchanged), genuinely missing (both missing_* retained), and duplicate on both sides (duplicate failures only).
  • User-visible CLI/MCP output (if applicable): duplicate-before after the change — before_only: [], after_only: [], failures [duplicate_before_step_id], overall_status: unknown.
  • Remaining proof gaps: no real browser capture; the fixtures are synthetic retained captures, and comparison never accesses the recorded origin.

Boundary regressions covered: duplicate-identity and missing-identity alignment for the comparison projection. Lifecycle regressions: not applicable (no resources).

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:local -- src/domain/browserScenarioDiff.test.ts — 34 passed, including the two new regressions.
  • npm run test:focused -- tests/boundary/cli/browserCompareJsonFiles.test.ts tests/boundary/mcp/browserComparisonInput.test.ts — 5 passed.
  • npm run check:fast — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none — synthetic retained captures only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @kittimzhe

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

… as absent

Comparing retained scenario captures flattened each side's unique step
map, so a step_id duplicated on one side vanished from that side's map;
the same id arriving uniquely on the other side then landed in
before_only/after_only and produced a missing_before_step or
missing_after_step failure for a step the duplicate side still retains.
The comparison reported both the duplicate and a definite absence for
the same id, a stronger claim than the ambiguity supports.

Alignment now keeps a duplicated id out of the absence lists on both
sides: the id stays unaligned with its duplicate failure, but no capture
is described as missing a step it retains. Genuinely missing ids keep
their missing_* classification and absence lists.

Fixes morluto#7415
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes false absence reports for duplicated scenario step IDs at their source, alignScenarioSteps.

  • Repeated step IDs stay ambiguous instead of appearing absent.

No actionable correctness, security, or repository-rule issues were found. Tests were inspected, not executed. Supersession could not be checked because GitHub authentication was unavailable.

Reviews (1) · Last reviewed commit: "fix(browser): keep duplicated scenario s..." · Reviewed by Greptile

@kittimzhe
kittimzhe marked this pull request as ready for review October 28, 2026 03:13
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T03:13:36.678070Z
We couldn’t complete this review. Comment @codex review to try again.
f08494e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran src/domain/browserScenarioDiff.test.ts on head f08494e on three Node versions, and all 34 tests passed each time. With src/domain/browserScenarioDiff.ts swapped back to the merge base c79bd41, 2 tests failed on all three. So both tests fail without the fix and pass with it, but I did not try a real browser capture.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head f08494e pass: 1 file, 34 tests passed pass: 1 file, 34 tests passed pass: 1 file, 34 tests passed
Red run (browserScenarioDiff.ts from c79bd41) fail: 2 failed, 32 passed fail: 2 failed, 32 passed fail: 2 failed, 32 passed

In the Node 24.22.1 red log, the two failures are keeps a duplicated step id unaligned without classifying it as absent and mirrors the duplicate classification when the later capture repeats the id.

CI on f08494e:

  • CI and PR title are waiting for a maintainer to approve them (action_required).
  • Greptile Review passed.
  • Validate author declaration has 4 successful check runs and 1 cancelled run.
  • PR readiness has 4 successful and 2 cancelled runs, and its commit status is success.

The head is 830 commits behind main b81da90. GitHub says the PR is mergeable, and its merge state is blocked.

Not run

  • A real browser scenario capture with a repeated step id.
  • A merge with current main, b81da90.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: f08494e / c79bd41 (merge base with main)
  • Red run: f08494e with src/domain/browserScenarioDiff.ts from c79bd41
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1, exit 0, for both trees
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/browserScenarioDiff.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thanks! This landed on main in #10490 as its own commit, cherry-picked with your authorship kept (rebase merge). Closing in favor of that merge.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] compare-web-captures classifies an ambiguous retained step ID as absent

4 participants