Expand description
Bringing a project’s local work into the vault it was just linked to
(lean-ctx cloud link --bring-local): its local tasks
(crate::tasks::local) become proposed tasks of the vault, and its
local doc pages (crate::local_docs) pages of the vault, once each.
A local task is brought when it was never shared and is open: Cloud opens
every task an Instance proposes (owner decision 25.10.), so a task that
is only proposed locally stays local until it is accepted, and a claimed
or submitted one stays local so no claim, result or evidence is lost.
Its goal ends with "Local task #<n>" as the reference, and it is marked
shared locally with the vault’s number, so a second run skips it. Before
a task is sent, a local ledger records it; a run interrupted after Cloud
answered (or after the request left) resumes from that ledger instead
of sending it twice (bring_tasks).
A page is brought when it was never shared and the vault has no page with
its slug; /slug links between brought pages point at their new vault
ids, links to pages the vault already holds point at those. After the
events are queued, each brought page is marked shared locally (journaled,
by the person, “cloud link”), so a second run skips it. The events reach
Cloud with the next push; the background sync retries what fails.
Structs§
- Brought
- What
--bring-localbrings (or would bring). - DocItem
- One local page and what the link does with it.
- InFlight
- A task on its way into a vault, recorded before it is sent.
- Ledger
- The tasks of one project on their way into a vault, by local number.
- Task
Item - One local task and what the link does with it.
- Task
Sink - What
bring_taskscalls on the outside world. - Unsettled
- A local task the link would strand: only proposed, claimed or submitted (and not brought yet). Once a project is linked its tasks are Cloud’s, so these are settled locally first.
Constants§
- LEAVE_
UNSETTLED_ FLAG - The flag that links a project although local tasks are unsettled; they
then stay local and are reached with
lean-ctx tasks … --local. - RESEND_
WINDOW_ SECS - Cloud replays a proposal’s first answer for this long after it (its instance idempotency keys live 7 days); a ledger entry older than this is never sent again.
Functions§
- author
- Who a link import is recorded as: the person runs
cloud link. - bring_
tasks - Bring every
proposeitem ofitems(planned fromtasks, proposals fromproposal_of) into the vaultvault_id. Each task is entered inledgerbefore it is sent, gets its number there as soon as Cloud answers, and leaves it once it is marked shared. A task found in the ledger resumes from there: a known number is only marked, never sent again; an unanswered send is repeated with the same key insideRESEND_WINDOW_SECS(Cloud replays its first answer) and after that is reported, never resent, so an interrupted run never makes a second vault task. - doc_
events - The vault events that create every
importitem ofitemsfrom itsrawpage (storage form,cloud:<local id>links), choosing its vault id withnew_idand filling it into the item. - import
- Bring the local tasks, then the local pages, of
rootinto its linked vault (vault=ns/name, idvault_id). Pages need the vault’s replica here; when they cannot go, the tasks that went stay reported as gone anddocs_errorsays why the pages wait (docsis the plan then). - import_
docs - Bring the local pages of
rootinto its linked vaultvault(ns/name). Needs the vault’s replica on this machine (the first sync makes it). - import_
tasks - Bring every open local task of
rootinto the vaultvault_id(vault=ns/name):bring_tasksagainst Cloud, the local task store and the ledger in this Instance’s config. - link_
gate - Every path that links a project asks this first: the unsettled local
tasks of
root, or why the link is refused (leaveis the person’s explicitLEAVE_UNSETTLED_FLAG). - local_
action_ in_ linked - Whether
action(on local tasknumber, when it names one) may act on the local store of the linked projectroot: reads always; a write only on a task that was not brought into a vault; new tasks go to Cloud. - local_
not_ shared - The local tasks of
rootthat are neither brought into a vault nor closed: in a linked project they are “local, not shared” and stay reachable with--local(also when the link came in through git). - not_
shared_ note - One line naming
listfor a linked project’s task list;Nonewhen there are none. - plan_
docs - What to do with each of
pages, given the vault’s slugs (slug → id; empty when the vault is not read, as on a dry run). - plan_
local - The plan for
rootfrom local state only (--dry-run, or before the vault is shared): pages the vault already holds show asimporthere. - plan_
tasks - What to do with each local task.
- refused_
for_ good - A refusal after which no vault task exists and none will: the screen or the request check refused it, or Cloud answered with a 4xx. A lost connection, a 5xx or an unreadable answer may hide a created task.
- task_
proposal - The vault proposal for local task
localof the projectstable. - unsettled
- The unsettled tasks among
tasks. - unsettled_
local - The unsettled local tasks of
root. - unsettled_
message - Why a link that brings local work is refused while
listis unsettled.