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:
Kjell Tore Guttormsen 2026-10-13 14:17:07 +02:00
commit d492abb5e9
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
3 changed files with 32 additions and 2 deletions

View file

@ -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({

View file

@ -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) {