refactor: simplify ActionResult loading and Diff API (plan 015)#87
Open
DavertMik wants to merge 1 commit into
Open
refactor: simplify ActionResult loading and Diff API (plan 015)#87DavertMik wants to merge 1 commit into
DavertMik wants to merge 1 commit into
Conversation
- One shared private `loadStateFile()`; the four state-file loaders become thin wrappers on it (screenshot keeps its own Buffer body). - Diff gets a `static async create()` that constructs + calculates; ActionResult.diff() returns it, so no consumer calls `diff.calculate()` separately (navigator, deep-analysis ×3, toToolResult, and the diff tests updated). Store only `_isSameUrl` (`urlHasChanged` = `!_isSameUrl`); drop the `ariaDiff` getter (alias of `ariaChanged`), keep `htmlDiff` (tests use it). - Shared `countAriaChanges()` + `LARGE_ARIA_CHANGE_THRESHOLD` in utils/aria.ts; the inline block in action-result and the local copy in tools.ts now call it. - Small cleanups: `this.url && this.url !== ''` → truthiness; `notes: any` → `string[]`; `getStateHash` heading loop → direct pushes. - New test: `ActionResult.diff()` is pre-calculated (hasChanges truthful without a manual calculate()). Deviations from the plan (post-014 drift): Step 2 (lazy fromState) skipped — html loads at construction for headings anyway, and there is no lazy browser-logs getter post-014 (pilot reads browserLogs off a fromState result), so lazying it would change behavior. The cosmetic method-reordering and `_browserLogs` consolidation were left to avoid touching that eager browser-logs path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Explorbot Self-RegressionCommit
Attempt details
Session analysis — basic (native): Session AnalysisExplored the Issues list page and its core functionality: creating issues, filtering by status/labels, text search, and viewing issue details. All five core flows completed successfully, with the app responding correctly. Automation required multiple recovery attempts for some interactions. Coverage
What works
Execution Issues
|
This was referenced Jul 13, 2026
DenysKuchma
approved these changes
Jul 13, 2026
DenysKuchma
left a comment
Collaborator
There was a problem hiding this comment.
Merge only after plan 014
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.
Implements plan 015 — a behavior-preserving cleanup of the core
ActionResult/Diff. Independent PR offmain(depends only on 014's already-merged Step 1). Fable-reviewed APPROVE; existingaction-result-diff/action-result-memosuites + integration are the net.Changes
loadStateFile(file): string|null; the four state-file loaders become thin wrappers (screenshot keeps its ownBufferbody). OnereadFileSyncpath for state files.Diff.create— the footgun fix.static async create()constructs and awaitscalculate();ActionResult.diff()returns it. No consumer callsdiff.calculate()separately anymore (navigator, deep-analysis ×3,toToolResult, and the diff tests updated)..calculate()now appears only insideDiff.create. Store only_isSameUrl(urlHasChanged() = !_isSameUrl); drop theariaDiffgetter (alias ofariaChanged), keephtmlDiff.countAriaChanges()+LARGE_ARIA_CHANGE_THRESHOLD = 50inutils/aria.ts; the inline block inaction-resultand the local copy intools.tsnow call it.this.url && this.url !== ''→ truthiness;notes: any→string[];getStateHashheading loop → direct pushes; removed the write-only_browserLogsfield (orphaned when 014 removedbrowserLogsContent).ActionResult.diff()is pre-calculated —hasChanges()is truthful without a manualcalculate().Deviation (post-014 drift)
Step 2 (lazy
fromState) skipped.htmlloads at construction for headings anyway, and post-014 there is no lazy browser-logs getter (browserLogsis a plain field pilot reads off afromStateresult) — lazying it would change behavior. The eager browser-logs path is deliberately left intact.Verification
bun run lintexit 0;bunx tsc --noEmit→ 728 = baseline;bun test tests/unit→ 765/0;bun test tests/integration→ 63/0. Fable-reviewed:loadStateFileedge paths identical, all 5Diff.createconsumers read only post-calculation,countAriaChangesbyte-identical, cleanups hash-identical.🤖 Generated with Claude Code