# State Separation, Fenced Leases, and Verifiable Publishing Receipts

Canonical URL: https://copystage.com/method/verification-and-receipts/
Author: CopyStage Engineering | Published: 2026-11-22

> Browser automation and multi-profile queues demand strict engineering invariants so network drops never cause duplicate tweets, stale approval edits never publish, and unconfirmed submissions stay transparently flagged as ambiguous.

*Diagram: CopyStage dispatch state machine: monotonic lease fencing, @handle verification, and ambiguous state pause eliminate duplicate sends and silent failures.*

        

## 1. Four Strictly Separated Domain Entities

        Legacy social schedulers collapse draft text, channel formatting, queue attempts, and platform results into a single mutable row, hiding retries and making platform failures impossible to reconcile. CopyStage models four distinct domain entities with explicit ownership:

        
          - **Editorial Drafts (Source Content & Review State):** Tracks `studio_draft`, `inbox`, `approved`, and `rejected` lifecycle states, cited facts, and Quality Gate reports.

          - **Channel Variants (Platform Representation):** Stores platform-specific segments, weighted character metrics, and the authoritative `content_fingerprint` hash.

          - **Dispatch Tasks (Account Execution Task):** Holds target account binding, IANA `scheduled_for` timestamp, `authorized_fingerprint`, delivery strategy, and active lease state.

          - **Publishing Receipts (Platform Proof):** Records immutable publication proof governed by a database check constraint requiring either a verified `tweet_url` or a non-empty `scheduled_readback` confirmation string.

        

        

## 2. Content Fingerprint & Approval Lock

        When a draft is approved and scheduled, the Dispatch Task snapshots the exact text and media IDs alongside `authorized_fingerprint`. Any subsequent edit in AI Studio recalculates `content_fingerprint` on the Channel Variant; when a node attempts to claim a task whose variant fingerprint drifted without re-confirmation, dispatch cleanly skips or invalidates the stale snapshot.

        

## 3. Fenced Leases & 30-Minute Stale Catch-Up Guard

        Node polling and window wakeups operate concurrently across browser profiles. CopyStage protects queue integrity with three mechanisms enforced inside the Dispatch Coordinator and Timezone Slot Planner:

        
          - **Monotonic `lease_generation` Fencing:** Claiming a queued task atomically transitions status to `leased`, increments `lease_generation`, sets a 60-second lease window, and writes an idempotent attempt record. All subsequent runner callbacks (`sending`: 90s lease, `awaiting-confirm`: 15m lease, `receipt`, `fail`) require matching `nodeId` and `leaseGeneration`.

          - **Pre-Fill `@handle` Verification:** The runner checks the logged-in X handle in the active tab before filling any field. Mismatches fail safely with `identity_mismatch` and never inject copy into an unintended account.

          - **30-Minute Stale Catch-Up Guard:** When a desktop browser wakes up after hours offline, tasks older than 30 minutes past their scheduled slot wait for explicit human reschedule, reflow, or skip choices so offline nodes never burst stale backlogs.

        

        

## 4. Honest `sending -> ambiguous` Recovery

        The hardest failure in social publishing occurs right after clicking Publish or Schedule: if the browser tab closes, the network drops, or the 90-second `sending` lease expires before a GraphQL response completes, a blind retry risks double-posting the exact same thread.

        
          **Zero silent retries after send:** Once a task enters `sending`, any timeout (`sending_lease_timeout`), tab closure, or uncertain runner error transitions the task to `ambiguous`. The task stays paused until an operator verifies the live X account and submits a `human_reconciled_tweet` receipt or explicitly cancels/reschedules.

        

        

## 5. Ephemeral MAIN-World Receipt Verification

        To keep page scripts completely isolated during idle browsing and editing, the Chrome MV3 extension executes copy/image injection inside the `ISOLATED` world with zero `web_accessible_resources`. Strictly for the brief submission window, `chrome.scripting.executeScript({ world: 'MAIN' })` attaches a nonce-verified interceptor listening for X GraphQL `CreateTweet` and `CreateScheduledTweet` responses, capturing `root_rest_id`, canonical `tweet_url`, native schedule confirmation text, and complete `thread_urls_json` across multi-segment threads.

        

```
queued
  ├─[node claims with lease_generation++]──────────> leased (60s window)
  │    ├─[@handle mismatch / guard / pre-send err]─> failed
  │    ├─[semi_auto ready for human click]─────────> awaiting_human_confirm (15m window)
  │    └─[submit clicked]──────────────────────────> sending (90s window)
  │         ├─[GraphQL CreateScheduledTweet]───────> native_scheduled (+ receipt row)
  │         ├─[GraphQL CreateTweet + threadUrls]───> published (+ receipt row)
  │         └─[tab closed / timeout / uncertain]───> ambiguous -> human_reconciled_tweet
```

## Key Takeaways
- CopyStage separates drafts, channel variants (content_fingerprint), dispatch tasks (lease_generation), and publish receipts.
- Publishing receipts enforce non-empty tweet_url or scheduled_readback via database evidence constraints.
- Once a task enters sending, uncertain disconnects transition to ambiguous and require explicit human reconciliation.
- A 30-minute stale catch-up guard stops waking browser profiles from bursting missed slots automatically.

## Questions & Answers
### Why does CopyStage transition interrupted sends to ambiguous?
Once the runner clicks Publish or Schedule, a network drop or tab closure leaves live platform state uncertain. Marking the task ambiguous halts automated retries so an operator can confirm whether the post landed on X before taking any follow-up action.

### What does lease_generation prevent during extension execution?
Each task lease increments lease_generation atomically in PostgreSQL. If a stale or timed-out extension worker attempts to report progress or a receipt using an older generation number, the server rejects the callback with HTTP 409.

### How does CopyStage prevent stale backlog bursts when a computer wakes up?
The Timezone Slot Planner enforces a 30-minute stale catch-up window. Tasks whose scheduled_for timestamp is more than 30 minutes past wait safely for human reschedule, queue reflow, or skip actions.

### Can a task be marked published without a URL or confirmation string?
Database constraints on Publishing Receipts require either a non-empty tweet_url or scheduled_readback string before recording a confirmed receipt.

## Public Status
CopyStage is in pre-launch validation. This public site documents the 2026-11-22 five-module specification snapshot. The internal workbench and browser runner are being validated on X. Additional publishers, official OAuth delivery, and commercial availability remain later milestones.

Content updated: 2026-11-29. Specification snapshot: 2026-11-22.
