fix(speckl): error on unrecognized lines in service blocks (D3, cycle 73)

Previously, a typo like rc_purchase_ticket (missing p in rpc) was silently
swallowed — 13 RPCs in source, 12 in AST, no error. Now throws a parse
error with the unrecognized line and expected format.
This commit is contained in:
Scott Scoble 2026-06-29 14:01:58 -07:00
parent 5ae89e943c
commit 121ac7de33
3 changed files with 22 additions and 1 deletions

View file

@ -1143,6 +1143,16 @@ function parseServiceBlockMultiline(lines, startIndex, startBraceCount) {
serverStreaming: serverStream,
});
}
else {
// Cycle 73: error on unrecognized lines inside service blocks.
// Previously, a typo like `rc_purchase_ticket(...)` (missing the `p`
// in `rpc`) was silently swallowed — the line didn't match the
// rpc regex, so it was skipped without error. Silent data loss in
// a spec compiler is unacceptable; the whole point is that the
// spec is the source of truth.
throw new Error(`Parse error in service block: unrecognized line "${line}". ` +
`Expected: rpc MethodName(RequestType) returns (ResponseType);`);
}
}
return { type: 'service', name, rpcs };
}

File diff suppressed because one or more lines are too long

View file

@ -1491,6 +1491,17 @@ function parseServiceBlockMultiline(lines: string[], startIndex: number, startBr
clientStreaming: clientStream,
serverStreaming: serverStream,
});
} else {
// Cycle 73: error on unrecognized lines inside service blocks.
// Previously, a typo like `rc_purchase_ticket(...)` (missing the `p`
// in `rpc`) was silently swallowed — the line didn't match the
// rpc regex, so it was skipped without error. Silent data loss in
// a spec compiler is unacceptable; the whole point is that the
// spec is the source of truth.
throw new Error(
`Parse error in service block: unrecognized line "${line}". ` +
`Expected: rpc MethodName(RequestType) returns (ResponseType);`
);
}
}