Skip to main content

Module fixes

Module fixes 

Source
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 / execute request as the caller gave it: select and expect only when present (the reference’s FixRequest).

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 (here the 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’s ambiguousFix).
append_after
blocks_append on a leaf (block_not_container): append means into — the blocks_insert that 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_append into 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, plan and execute only; every other tool’s error passes through, and so does one that already carries a fix (the selector’s, the compile’s). allocated(i) plans the effects before i and counts their symbols (read only for a missing $new.n).
bounded
expect.max missing on a one-shot apply { 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.n no earlier effect created (plain requests): the next create moved before the effect that uses it, the symbol renamed to the one that create will allocate — $new.<count>, count the symbols allocated so far.
fix_request
The fix for a request to the SAME tool: the corrected arguments as canonical JSON (fixRequest).
fix_tool
The fix naming another tool: <tool> <canonical args> (fixTool).
literal_slot
A -> leader in a member that takes no expression (here the 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): i is the failing effect’s index in the concrete list, origins the hits’ origins under a selector (None for a plain request), allocated the symbols the effects before i allocate (read only when a $new.n is missing). Returns the error, with data.fix when the table covers it and none was set.
replan
A plan that cannot be executed as it stands (stale_plan at execute, plan_mismatch of the plan form): re-plan and commit in one call — apply over the plan’s selector form when it has one (expect as 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 — links becomes blocks (a link lives in a block), any other source docs — spliced over the source’s code-point span of the written query (the reference’s rootFix).
root_of_id
The root a row id belongs to, by its prefix (rootOfId).
stale_revision
stale_plan at plan time (an expect.revision that no longer holds): the same request with the current revision in that guard — effect t (the template under a selector).