Capture authenticated page DOM on browser-post failure - #68
Merged
Merged
Conversation
The remaining browser-post failures (Facebook/Reddit/Instagram/Threads) are logged-in but hit stale composer selectors, which can't be fixed without the real authenticated DOM. On any selector failure the worker now captures the page URL + trimmed HTML into sp_post.debug_url/debug_html so the actual DOM can be inspected and selectors fixed against ground truth. Implemented with zero change to the per-platform posting logic: page is hoisted out of the try and a catch wraps every flow, throwing a BrowserPostError that carries the URL + HTML; browserPost persists them in fail(). Success paths are untouched. Migration adds nullable debug_url / debug_html (overwritten each attempt). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
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.
Per the plan: the remaining browser-post failures (Facebook/Reddit/Instagram/Threads) are logged in but hit stale composer selectors — unfixable without the real authenticated DOM. This captures it.
What
On any selector failure, the worker captures the page it was looking at — URL + trimmed HTML — into
sp_post.debug_url/sp_post.debug_html. That authenticated DOM can then be inspected (via Supabase) and the selectors fixed against ground truth instead of guessed.How (zero change to posting logic)
pageis hoisted out of each flow'stry, and a singlecatchwraps every platform flow, throwing aBrowserPostErrorcarryingpageUrl+pageHtml(capped at 600 KB).browserPost.fail()persists them. Success paths are byte-for-byte unchanged — only the failure path gains capture. Applied to all 7 browser platforms via two global edits.Migration adds nullable
debug_url/debug_html(overwritten each attempt). Already applied to the project (additive, safe pre-deploy).Next
After deploy, retry the 4 failing platforms once → the worker stores each real compose DOM → I read them via Supabase and fix Facebook/Reddit/Instagram/Threads selectors precisely.
Verification
tsc --noEmitclean;tests/sp/*35/35🤖 Generated with Claude Code