Skip to content

Verify-before-send helper: assert draft shows body once + URL once on own line #130

Description

@Trace824

Summary

Before clicking the post/reply button, automation has no first-class check that the Draft.js compose field contains the intended body exactly once and the URL exactly once on its own line. A small verify helper would catch double/replace/caret bugs before publish.

Repro

  • Context: x.com compose after multi-step type/insert.
  • Steps:
    1. Build draft via body insert + URL append.
    2. Read compose text (execute_js / read helpers).
    3. Click [data-testid=tweetButtonInline] or reply button without structural assert.
  • Observed: doubled or mangled drafts can be published; failures only noticed after the fact.

Code pointers (verified against /workspace/FSB)

  • extension/site-guides/social/twitter.js — tweetButtonInline, tweetTextarea_0, reply button selectors (~L47–143).
  • extension/content/actions.js — draft editable resolve / text read surfaces; likely area to add verify_draft or export a shared assert used by tools.
  • mcp/src/tools/manual.ts — tool registration pattern for a new optional helper.

Proposed fix

Add a lightweight helper (content or MCP-facing) that reads compose text from the resolved editable and asserts: body substring once, URL once, URL preceded by newline (or on last line). Fail closed before click on tweet button.

Acceptance / regression

  • Helper fails on doubled body or mid-line URL; passes on well-formed draft.
  • Integrates with existing selectors in twitter.js site guide.

Owner

extension (helper); mcp-server if exposed as a tool


Priority: P2 · Owner: extension

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions