[GH-ISSUE #3258] docs: docs/MACROS.md is out of date - missing persona-field macros, else-if/operators, and a wrong random-var note #1753

Closed
opened 2026-10-21 05:42:19 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3258

Originally assigned to: @SpicyMarinara on GitHub.

docs/MACROS.md has drifted from the shipped app. Found in a full docs-vs-code audit against v2.1.0. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file.

3 items found.


1. ## Identity table, docs/MACROS.md lines 15-24

(missing)

The five persona field macros shipped in v2.0.7 - {{personaDescription}}, {{personaPersonality}}, {{personaBackstory}}, {{personaAppearance}}, {{personaScenario}} - are missing from the Identity table. The in-app /macros reference is generated from SUPPORTED_MACROS and lists all five, so MACROS.md contradicts the product's own macro list; readers only learn about the all-fields {{persona}} blob and won't know individual persona fields are addressable (including as {{#if}} operands).

Suggested fix: Add five rows to the Identity table: {{personaDescription}}, {{personaPersonality}}, {{personaBackstory}}, {{personaAppearance}}, {{personaScenario}} - each resolving to the corresponding active persona card field (nested macros inside the field are resolved; empty when no persona is active). Optionally note they also work as {{#if}} condition operands, e.g. {{#if personaScenario contains "night"}}.


2. ## Formatting table, conditional-block row, docs/MACROS.md line 135

(missing)

The doc's only conditional syntax is {{#if char == "Name"}}...{{else}}...{{/if}}. The engine also supports {{else if}} chains and a full operator set: ==/=/is, !=/is not, >, <, >=, <= (numeric when both sides are numbers), contains/includes, not contains/not includes, bare-truthy {{#if name}}, and var:name operands. Multi-branch conditionals and numeric comparisons were fixed in v2.0.7, after this doc's last update, so users writing conditionals from this page will nest ifs unnecessarily and never discover the operators.

Suggested fix: Extend the conditional row or add a short Conditionals subsection documenting: {{else if condition}} chains (first matching branch wins); operators ==/=/is, !=/is not, >, <, >=, <= (numeric when both sides are numbers), contains/includes, not contains/not includes; bare {{#if name}} truthiness (true when non-empty and not false/0/no/off/null/undefined); operands can be identity/character-field keywords (char, user, persona, description, ...), quoted literals, variable names, var:name, or macros.


3. ## Random section, docs/MACROS.md line 109 ("The selected option is resolved after it is picked, so only macros in the chosen branch run.")

(inaccurate)

False for variable-operation macros. {{setvar}}, {{addvar}}, {{incvar}}, {{decvar}}, and {{getvar}} inside random options are executed in a pre-pass across ALL options before the random choice is made, so a write in a branch that can never be selected still mutates the variable. Only dice, nested random, and other text macros are branch-local as documented. The doc's own nested-macro example directly above (line 82) uses {{getvar}} inside a random option, inviting exactly the pattern that silently corrupts variable state.

Suggested fix: Qualify the sentence, e.g.: "After an option is picked, its remaining macros (dice, nested random, text macros) are resolved - dice and random macros in unchosen options never run. Exception: variable operations ({{getvar}}, {{setvar}}, {{addvar}}, {{incvar}}, {{decvar}}) are processed in every option before the choice is made, so avoid variable writes inside random options." Alternatively, if eager cross-branch execution is judged an engine bug, fix the engine instead - but as shipped today the doc misstates behavior.

Originally created by @kolacheee on GitHub (Jul 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3258 Originally assigned to: @SpicyMarinara on GitHub. `docs/MACROS.md` has drifted from the shipped app. Found in a full docs-vs-code audit against **v2.1.0**. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file. **3 items found.** --- ### 1. ## Identity table, docs/MACROS.md lines 15-24 *(missing)* The five persona field macros shipped in v2.0.7 - {{personaDescription}}, {{personaPersonality}}, {{personaBackstory}}, {{personaAppearance}}, {{personaScenario}} - are missing from the Identity table. The in-app /macros reference is generated from SUPPORTED_MACROS and lists all five, so MACROS.md contradicts the product's own macro list; readers only learn about the all-fields {{persona}} blob and won't know individual persona fields are addressable (including as {{#if}} operands). **Suggested fix:** Add five rows to the Identity table: {{personaDescription}}, {{personaPersonality}}, {{personaBackstory}}, {{personaAppearance}}, {{personaScenario}} - each resolving to the corresponding active persona card field (nested macros inside the field are resolved; empty when no persona is active). Optionally note they also work as {{#if}} condition operands, e.g. {{#if personaScenario contains "night"}}. --- ### 2. ## Formatting table, conditional-block row, docs/MACROS.md line 135 *(missing)* The doc's only conditional syntax is {{#if char == "Name"}}...{{else}}...{{/if}}. The engine also supports {{else if}} chains and a full operator set: ==/=/is, !=/is not, >, <, >=, <= (numeric when both sides are numbers), contains/includes, not contains/not includes, bare-truthy {{#if name}}, and var:name operands. Multi-branch conditionals and numeric comparisons were fixed in v2.0.7, after this doc's last update, so users writing conditionals from this page will nest ifs unnecessarily and never discover the operators. **Suggested fix:** Extend the conditional row or add a short Conditionals subsection documenting: {{else if condition}} chains (first matching branch wins); operators ==/=/is, !=/is not, >, <, >=, <= (numeric when both sides are numbers), contains/includes, not contains/not includes; bare {{#if name}} truthiness (true when non-empty and not false/0/no/off/null/undefined); operands can be identity/character-field keywords (char, user, persona, description, ...), quoted literals, variable names, var:name, or macros. --- ### 3. ## Random section, docs/MACROS.md line 109 ("The selected option is resolved after it is picked, so only macros in the chosen branch run.") *(inaccurate)* False for variable-operation macros. {{setvar}}, {{addvar}}, {{incvar}}, {{decvar}}, and {{getvar}} inside random options are executed in a pre-pass across ALL options before the random choice is made, so a write in a branch that can never be selected still mutates the variable. Only dice, nested random, and other text macros are branch-local as documented. The doc's own nested-macro example directly above (line 82) uses {{getvar}} inside a random option, inviting exactly the pattern that silently corrupts variable state. **Suggested fix:** Qualify the sentence, e.g.: "After an option is picked, its remaining macros (dice, nested random, text macros) are resolved - dice and random macros in unchosen options never run. Exception: variable operations ({{getvar}}, {{setvar}}, {{addvar}}, {{incvar}}, {{decvar}}) are processed in every option before the choice is made, so avoid variable writes inside random options." Alternatively, if eager cross-branch execution is judged an engine bug, fix the engine instead - but as shipped today the doc misstates behavior.
bsakaguchi 2026-10-21 05:42:19 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 5, 2026):

Addressed in #3289.

<!-- gh-comment-id:4887420752 --> @SpicyMarinara commented on GitHub (Jul 5, 2026): Addressed in #3289.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1753
No description provided.