Expand description
The corrected example an error teaches with (spec/mutate §8 “fix”,
spec/surface §9; mutate 3.3 / surface 4.4): data.fix is a literal
corrected call — the arguments as canonical JSON (§11.5), prefixed by
the tool’s name and one space only when the corrected call is to another
tool — rebuilt from the request that failed, never a prose template. Both
engines compose the same bytes; the reference is mutate/canonical.ts
(fixRequest, fixTool, narrowedTo) and plan.ts (planningFix,
replanFix).
One function per error; the wording lives here and nowhere else. The
planner’s errors are decorated where the request is at hand: the plain
request’s in the catalog (attach, over every error apply / plan /
execute return), a selector’s in select::plan_selected
(planning_fix with the hits’ origins). The append tools build theirs
at the site (append_after, append_without_section,
append_into_heading). An error the table does not cover, or a request
the rebuild cannot read, passes through untouched — a fix is never
wrong JSON.
Structs§
- Origin
- Where a concrete effect came from under a selector: the hit’s row and the
template (the reference’s
EffectOrigin). - Request
- A
plan/apply/executerequest as the caller gave it:selectandexpectonly when present (the reference’sFixRequest).
Constants§
- LOCATOR
- A
#locator where a target is expected (3.2 “Sugar”): the two reads that yield the id.
Functions§
- ambiguous_
slot ambiguous_target: the slot spelled as the first identity the expression yielded (herethe member’s path,effects[t].…); under a selector the selector narrowed to the row it was read from (expect.max: 1); a plain request keeps its effects with the slot rewritten (the reference’sambiguousFix).- append_
after blocks_appendon a leaf (block_not_container): append means into — theblocks_insertthat places the text right after it, under its parent (the document when the leaf is top-level).- append_
into_ heading docs_append { section }matching several headings (ambiguous_heading):blocks_appendinto the first candidate by id.- append_
without_ section docs_append { section }naming no heading (parent_missing): the same append — the call’s own locator and text — without the section (the document’s end).- attach
- Decorate an effect tool’s error with its corrected call (module docs):
apply,planandexecuteonly; every other tool’s error passes through, and so does one that already carries afix(the selector’s, the compile’s).allocated(i)plans the effects beforeiand counts their symbols (read only for a missing$new.n). - bounded
expect.maxmissing on a one-shotapply { select }: the same call bounded at the selection’s actual size.- conflicting_
effects conflicting_effects { effects: [a, b] }: keep the later effect — the request minus the earlier one. Under a selector a cross-hit collision narrows the selector to the later hit (from <root> where id == …,expect.max: 1) and a same-hit collision drops the earlier template.- create_
first target_missing { symbol }for a$new.nno earlier effect created (plain requests): the nextcreatemoved before the effect that uses it, the symbol renamed to the one that create will allocate —$new.<count>,countthe symbols allocated so far.- fix_
request - The
fixfor a request to the SAME tool: the corrected arguments as canonical JSON (fixRequest). - fix_
tool - The
fixnaming another tool:<tool> <canonical args>(fixTool). - literal_
slot - A
->leader in a member that takes no expression (herethe member’s path,effects[t].…): the same request with the leader dropped there — the string is the literal it reads as. - narrowed_
to - The selector that names exactly one row:
from <root> where id == "<id>"(narrowedTo). - planning_
fix - The planner’s refusals of one request, decorated (the reference’s
planningFix):iis the failing effect’s index in the concrete list,originsthe hits’ origins under a selector (Nonefor a plain request),allocatedthe symbols the effects beforeiallocate (read only when a$new.nis missing). Returns the error, withdata.fixwhen the table covers it and none was set. - replan
- A plan that cannot be executed as it stands (
stale_planat execute,plan_mismatchof the plan form): re-plan and commit in one call —applyover the plan’s selector form when it has one (expectas given, else the selection’s cardinality), else over its concrete effects. - root_
fix - A refused selector source (§11.8 step 1): the same request over an
admitted root —
linksbecomesblocks(a link lives in a block), any other sourcedocs— spliced over the source’s code-point span of the written query (the reference’srootFix). - root_
of_ id - The root a row id belongs to, by its prefix (
rootOfId). - stale_
revision stale_planat plan time (anexpect.revisionthat no longer holds): the same request with the current revision in that guard — effectt(the template under a selector).