Skip to main content

Module push

Module push 

Source
Expand description

P7 — the push orchestration: publish the org body’s projection to its linked Google Doc and write machine state back into the file.

This is the imperative shell (EI-4). It delegates every decision to the pure cores — CUSTOM_IDs (crate::custom_id), projection (crate::project), sync state (crate::syncstate), comments (crate::comments_meta), region writeback (crate::orgfile) — and only sequences the effects (network, then file content) between them.

Guarantees:

  • DI-2 — the body is reproduced byte-for-byte except the sanctioned :CUSTOM_ID: insertions (and the tool-owned #+GDOC_* header keywords).
  • DI-9 (refined) — when the body does change, the push fully replaces it (clear then re-insert, never diffed). But a push whose projection fingerprint (crate::project::Projection::fingerprint) matches the one recorded in ** Sync State skips the body write entirely — a full-replace deletes the text existing Google comments anchor to, orphaning them (“original content deleted”), so re-pushing unchanged content (e.g. just to post a reply or resolve a comment) must not touch the body. Operator-approved relaxation.
  • DI-3 — all state is read from and written to the file content; no sidecar.

IO (reading the file, writing it back, the clock) stays at the binary edge; push takes the file content and the timestamp and returns the new content.

Structs§

PushOutcome
The result of a push: the document reference, what changed, and the new file content the caller must persist.

Functions§

envelope
Build the success envelope for a completed push (A5).
push
Publish content’s projection to its linked doc, returning the rewritten file.