1
0
Fork 0

docs(npc-dialogue): sync the contract with the start-node exception

Three one-line corrections after the last review, all in text this range
introduced:

- the AI Drafting tab no longer claims the preview is the literal prompt,
  which the shared footer now qualifies;
- the return table and the area guide record that a choice marked as the
  start gets no return, since nothing may point at the start;
- the fragment note names the start rule for a start choice instead of
  claiming the step had nothing after it. A start dialogue with no
  successor still reports the missing successor, which is the actionable
  reason there.
This commit is contained in:
Jason Fraley 2026-11-24 15:05:19 -05:00
parent 5ccb25e643
commit b2588f26bc
5 changed files with 14 additions and 5 deletions

View file

@ -55,7 +55,7 @@ the branch's open end a way onward, and where it goes depends on the caller:
| Caller | The open end continues to |
|---|---|
| A choice node | Back to that node, re-presenting its other buttons (a side question returns to the menu) |
| A choice node | Back to that node, re-presenting its other buttons (a side question returns to the menu). The exception is a choice marked as the start: nothing may point at the start, so it gets no return |
| A dialogue, event or delay node that already led somewhere | **The step it used to lead to.** Attaching replaced that hop, so this is what keeps the rest of the conversation reachable |
| A node with nothing after it, or a condition | Nowhere: the branch stays open for the author to wire. Rejoining a condition would re-evaluate the same flags and take the same branch forever |

View file

@ -112,7 +112,7 @@ export const NpcDialogues: CollectionConfig = {
{
label: "AI Drafting",
description:
"How the drafting tools should sound for this conversation. The preview shows the exact instruction the model receives.",
"How the drafting tools should sound for this conversation. The preview shows the assembled instruction for a whole-conversation draft.",
fields: [
{
name: "voiceOverride",

View file

@ -150,8 +150,10 @@ The return hop is not "back to the caller" for every caller. Attaching to a
single-continuation node **overwrites its `next`**, so `returnTargetOf` sends the
branch's open end to the successor that hop used to point at; returning to the
caller itself would loop. A choice caller is the one case where coming back to the
caller is right (its buttons are still there). A condition gets no return at all:
re-entering re-evaluates the same flags and retakes the same branch. Return
caller is right (its buttons are still there), except a choice marked as the start:
a hop into the start is refused everywhere else, so it gets no return either. A
condition gets no return at all: re-entering re-evaluates the same flags and
retakes the same branch. Return
candidates are restricted to node types that actually read `next`, since writing
`next` on a choice or condition is a hop no walker follows.

View file

@ -309,9 +309,14 @@ export function insertGeneratedFragment(
if (options.returnToCaller && options.attachment) {
if (!returnTarget) {
errors.push(
// Name the rule that actually fired, so the note is actionable. A start
// dialogue with no successor has two reasons and the useful one is the
// missing successor; only a start *choice* is refused for being the start.
attachmentNode?.type === "condition"
? "This attaches under a condition, which cannot be re-entered without taking the same branch again, so the branch's open end stays free."
: "The step it attaches to had nothing after it, so there is nowhere to return to and the branch's open end stays free.",
: attachmentNode?.type === "choice" && attachmentNode.data.isStart
? "This attaches under the start node, which nothing may point at, so the branch's open end stays free."
: "The step it attaches to had nothing after it, so there is nowhere to return to and the branch's open end stays free.",
);
} else {
const insertedIds = new Set(placed.map((node) => node.id));

View file

@ -200,6 +200,8 @@ describe("insertGeneratedFragment", () => {
expect(result.returnedFrom).toBeNull();
expect(result.returnKind).toBeNull();
// The note names the start rule, not "nothing came after it".
expect(result.errors.join(" ")).toMatch(/start node/i);
// Only the inserted nodes matter: the existing start legitimately leads to it.
const insertedPointsAtStart = result.nodes
.filter((n) => n.id === "a1" || n.id === "a2")