fix(review): the engine of a payload is read from an own property
Review finding 3799ea6c; the same lookup in engine-findings.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
48b57284fe
commit
d492abb5e9
3 changed files with 32 additions and 2 deletions
|
|
@ -224,7 +224,7 @@ export function ingest(reviewerPayloads) {
|
|||
// field a reviewer wrote on its own finding (decision 13, operator 12.10):
|
||||
// an engine payload's findings get `engine` from its `reviewer`, every other
|
||||
// payload's findings lose any `engine` they carry.
|
||||
const eng = ENGINE_OF_PAYLOAD[payload.reviewer];
|
||||
const eng = Object.hasOwn(ENGINE_OF_PAYLOAD, payload.reviewer) ? ENGINE_OF_PAYLOAD[payload.reviewer] : null;
|
||||
for (const f of payload.findings) {
|
||||
const { engine: _claimed, ...rest } = f;
|
||||
findings.push({
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export const IMPROVEMENT_CATEGORIES = Object.freeze(new Set(['simplification', '
|
|||
*/
|
||||
export function toReviewerPayload(input, opts = {}) {
|
||||
const errors = [];
|
||||
const spec = ENGINES[input?.engine];
|
||||
const spec = Object.hasOwn(ENGINES, String(input?.engine ?? '')) ? ENGINES[input.engine] : null;
|
||||
if (!spec) return { ok: false, errors: [`engine must be one of ${Object.keys(ENGINES).join('|')}, got ${JSON.stringify(input?.engine)}`] };
|
||||
if (!Array.isArray(input.findings)) return { ok: false, errors: ['findings must be an array'] };
|
||||
if (opts.scopeFiles && opts.scopeFiles.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue