From d123ee0aca2e7e5a5233c881bf93476a7cf3a3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E7=82=8E?= <635735027@qq.com> Date: Fri, 17 Apr 2026 12:24:17 +0800 Subject: [PATCH] feat(generator): enhance buildArtifact with determineArtifactStatus integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change function signature to accept destructured object parameter - Integrate determineArtifactStatus for automatic status calculation - Use REPORT_NAME and COLUMNS constants (to be defined in Task 6) - Add proper filtering for partial_reasons (exclude api_/validation_ prefixes) - Add deduplication for reasons array - Update call site in buildBrowserEntrypointResult to use new signature 🤖 Generated with [Qoder][https://qoder.com] --- src/generated_scene/generator.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/generated_scene/generator.rs b/src/generated_scene/generator.rs index 3ddfe21..8eabb88 100644 --- a/src/generated_scene/generator.rs +++ b/src/generated_scene/generator.rs @@ -333,11 +333,11 @@ function determineArtifactStatus({{ blockedReason = '', fatalError = '', reasons return 'ok'; }} -function buildArtifact(args, rows) {{ +function buildArtifact({{ status, blockedReason = '', fatalError = '', reasons = [], rows = [], args }}) {{ return {{ type: 'report-artifact', - report_name: '{scene_id}', - status: rows.length > 0 ? 'ok' : 'empty', + report_name: REPORT_NAME, + status: status || determineArtifactStatus({{ blockedReason, fatalError, reasons, rows }}), period: {{ mode: args.period_mode, mode_code: args.period_mode_code, @@ -346,11 +346,11 @@ function buildArtifact(args, rows) {{ }}, org: {{ label: args.org_label, code: args.org_code }}, column_defs: COLUMN_DEFS, - columns: {columns_json}, + columns: COLUMNS, rows, counts: {{ detail_rows: rows.length }}, - partial_reasons: [], - reasons: [] + partial_reasons: reasons.filter(r => r && !r.startsWith('api_') && !r.startsWith('validation_')), + reasons: Array.from(new Set(reasons.filter(Boolean))) }}; }} @@ -423,7 +423,7 @@ async function buildBrowserEntrypointResult(args, deps = defaultDeps) {{ try {{ const rawData = await (deps.queryData ? deps.queryData(args) : Promise.resolve([])); const rows = normalizeRows(rawData); - return buildArtifact(args, rows); + return buildArtifact({{ args, rows }}); }} catch (error) {{ return {{ type: 'report-artifact',