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:
parent
5ae89e943c
commit
121ac7de33
3 changed files with 22 additions and 1 deletions
10
compiler/dist/parser.js
vendored
10
compiler/dist/parser.js
vendored
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
2
compiler/dist/parser.js.map
vendored
2
compiler/dist/parser.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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);`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue