Skip to content

feat(coordinator): auto-ingest 把 quality_metrics_summary forward 進 stream-config - #115

Merged
monkey1sai merged 1 commit into
mainfrom
codex/openspec/coordinator-forward-quality-metrics-summary
May 26, 2026
Merged

monkey1sai merged 1 commit into
mainfrom
codex/openspec/coordinator-forward-quality-metrics-summary

Conversation

@monkey1sai

Copy link
Copy Markdown
Owner

C1 / C2 / C3 archive 後 fast MVP closed loop 的最後一段。coordinator 自動 ingest streaming conversion 結果建立 review session 時,從 result 萃取 quality_metrics 寫進 session,viewer / /ui 後續從 stream-config 拿到後三段 ready 的 Semantic 才能真正算 yes。

Why

Changes

  • types.ts ConversionQualityMetricsSummary 加 C1 三欄位(optional + nullable,strictly additive)
  • app.ts qualityMetricsSummarySchema zod 加同三欄位
  • streamingConversionClient.ts 新增 buildQualityMetricsSummary helper(萃取 result.raw.quality_metrics 全欄位 + phase_timings.conversion_total.duration_seconds)
  • ingestStreamingConversionResult / ingestConversionReport / autoCreateOrActivateSession 加 qualitySummary arg,寫進 store.create

Scope guard

  • 不改 streaming-server / viewer / callback outbox 邊界
  • 不引入新 dependency
  • backward compatible:無 quality_metrics 時 summary=null,viewer 對 null 仍按 C2 規則計算 Semantic=no
  • 既有 explicit POST /api/review-sessions caller path 不變(qualitySummary arg 有 default null)

Test plan

  • npm test → 13 test files / 187 tests passed(原 184 + 3 新)
  • npm run build 通過
  • npm run verify 通過
  • openspec validate coordinator-forward-quality-metrics-summary --strict → valid
  • openspec validate --specs --strict → 26 passed
  • git diff --cached --check clean

Archive gate(post-merge)

Re-run Chrome MCP viewer evidence 對 ready session 應觀察:

  • tri-ready-semantic: Semantic: no → Semantic: yes(若 C1 fallback 三欄位都 truthy)
  • 存至 docs/evidence/2026-05-25-fast-mvp-edge-bim-server-console/c2-viewer-semantic-yes-after-forward.md

🤖 Generated with Claude Code

…ream-config (coordinator-forward-quality-metrics-summary)

C1 / C2 / C3 archive 後 fast MVP closed loop 的最後一段:coordinator 自動
ingest streaming conversion 結果建立 review session 時,從 result 萃取
quality_metrics 寫進 session,viewer / /ui 後續從 stream-config 拿到後
三段 ready 的 Semantic 才能真正算 yes(C1 fallback 已產資料、C2 viewer
已正確讀,但 coordinator 中段沒 forward → 永遠 null → Semantic=no)。

變更:
- types.ts ConversionQualityMetricsSummary 加 C1 三欄位
  (semantic_mapping_fidelity / mapping_has_ifc_type / mapping_has_ifc_name),
  全 optional/nullable,backward compatible
- app.ts qualityMetricsSummarySchema zod 加同三欄位
- streamingConversionClient.ts 新增 buildQualityMetricsSummary helper
  從 result.raw.quality_metrics 萃取所有欄位,best-effort 對齊
  dev-console.html 既有 mapping 風格
- ingestStreamingConversionResult / ingestConversionReport /
  autoCreateOrActivateSession 加 qualitySummary arg,寫進 store.create

新增 3 個 vitest:
- semantic 三欄位 + 既有欄位 + phase_timings 全 forward
- 部分 quality_metrics → 缺欄位顯式 null(schema stable)
- 無 quality_metrics → summary=null(backward compat)

不改 streaming-server / viewer / callback outbox 邊界;不引入 new dep。

OpenSpec change:coordinator-forward-quality-metrics-summary
Copilot AI review requested due to automatic review settings May 26, 2026 02:23
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@monkey1sai, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 52 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4be3dc92-260e-4306-9143-d455cfae0be2

📥 Commits

Reviewing files that changed from the base of the PR and between 575e297 and db05b57.

📒 Files selected for processing (8)
  • bim-review-coordinator/src/app.ts
  • bim-review-coordinator/src/services/streamingConversionClient.ts
  • bim-review-coordinator/src/types.ts
  • bim-review-coordinator/tests/host-native-conversion-ingest.test.ts
  • openspec/changes/coordinator-forward-quality-metrics-summary/design.md
  • openspec/changes/coordinator-forward-quality-metrics-summary/proposal.md
  • openspec/changes/coordinator-forward-quality-metrics-summary/specs/conversion-webhook-lifecycle/spec.md
  • openspec/changes/coordinator-forward-quality-metrics-summary/tasks.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/openspec/coordinator-forward-quality-metrics-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@monkey1sai
monkey1sai merged commit 2764790 into main May 26, 2026
1 of 2 checks passed
@monkey1sai
monkey1sai deleted the codex/openspec/coordinator-forward-quality-metrics-summary branch May 26, 2026 02:23
monkey1sai added a commit that referenced this pull request May 26, 2026
… chrome evidence (#116)

PR #115 已 merged,完成 OpenSpec sync/archive:
- openspec/changes/archive/2026-05-26-coordinator-forward-quality-metrics-summary/
- openspec/specs/conversion-webhook-lifecycle/spec.md(+1 requirement ADD)
- openspec/specs/ 仍 26 capability,openspec validate --specs --strict 26/0

Chrome MCP archive-closeout evidence(docs/evidence/.../c2-viewer-semantic-yes-after-forward.md):

forward 機制 100% 驗證:
- coordinator stream-config response.quality_metrics_summary 帶 source_ifc_entity_count=10872、
  materialization_strategy=usd_stage_enumeration、coverage_status=warn 等(過去全 null)
- 三個 C1 semantic 欄位明示 null,schema stable
- viewer triReady: File=yes / Runtime=yes / Semantic=no(預期)
- TopBar 全綠;stage-truth-panel--matched

剩餘 gap 暴露:conversion 走 usd_stage_enumeration path(HOOPS 處理 89MB IFC 成功),
非 C1 fallback;該 path 沒寫 semantic_mapping_fidelity / mapping_has_ifc_type /
mapping_has_ifc_name。建議下一個 OpenSpec change:
streaming-server-enumeration-semantic-mapping 接力。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates bim-review-coordinator’s auto-ingest flow so that streaming conversion quality_metrics are extracted into quality_metrics_summary and forwarded through GET /api/review-sessions/:id/stream-config, enabling viewer and /ui to compute Semantic readiness using the C1 fallback fields.

Changes:

  • Extend ConversionQualityMetricsSummary (+ zod schema) with the three C1 semantic fields (semantic_mapping_fidelity, mapping_has_ifc_type, mapping_has_ifc_name).
  • Add buildQualityMetricsSummary() to extract a best-effort summary from streaming conversion results and plumb it through ingest → session creation.
  • Add vitest coverage for auto-ingest forwarding behavior (full/partial/no quality_metrics).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
openspec/changes/coordinator-forward-quality-metrics-summary/tasks.md Adds the change task checklist for this OpenSpec change.
openspec/changes/coordinator-forward-quality-metrics-summary/specs/conversion-webhook-lifecycle/spec.md Spec delta requiring coordinator to forward streaming quality_metrics into quality_metrics_summary for stream-config consumers.
openspec/changes/coordinator-forward-quality-metrics-summary/proposal.md Motivation and scope/compat notes for forwarding semantic readiness metrics.
openspec/changes/coordinator-forward-quality-metrics-summary/design.md Design for additive type/schema extension and best-effort extraction helper.
bim-review-coordinator/tests/host-native-conversion-ingest.test.ts Adds tests asserting ingest forwards quality_metrics_summary into stream-config (including null-vs-undefined expectations).
bim-review-coordinator/src/types.ts Extends ConversionQualityMetricsSummary with three new C1 semantic fields (additive).
bim-review-coordinator/src/services/streamingConversionClient.ts Introduces buildQualityMetricsSummary() helper to extract a summary from result.raw.quality_metrics.
bim-review-coordinator/src/app.ts Wires the extracted quality summary through ingest and into auto-created sessions’ quality_metrics_summary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +350 to +353
const fixtureName =
typeof raw.original_filename === "string" ? (raw.original_filename as string) : null;
const artifactGroupId =
typeof raw.artifact_group_id === "string" ? (raw.artifact_group_id as string) : null;
Comment on lines +10 to +37
## 1. Failing tests first

- [ ] 1.1 新增 `tests/quality-metrics-summary-forward.test.ts`(vitest):
Scenario A(C1 三欄位 + 既有欄位 → stream-config 帶全)、Scenario B
(phase_timings.conversion_total.duration_seconds → conversion_duration_seconds)、
Scenario C(無 quality_metrics → summary=null,viewer Semantic 仍 no)。
- [ ] 1.2 跑 `npm test` → 三個新 test FAIL。

## 2. Implementation

- [ ] 2.1 修改 `src/types.ts`:`ConversionQualityMetricsSummary` 加
`semantic_mapping_fidelity?` / `mapping_has_ifc_type?` / `mapping_has_ifc_name?`。
- [ ] 2.2 修改 `src/app.ts:88-94` `qualityMetricsSummarySchema` zod schema 加同欄位。
- [ ] 2.3 `src/services/streamingConversionClient.ts` 新增
`buildQualityMetricsSummary(result): ConversionQualityMetricsSummary | null`。
- [ ] 2.4 修改 `src/app.ts` `createReviewSessionFromIngest`:把
`quality_metrics_summary: null` 改成
`quality_metrics_summary: buildQualityMetricsSummary(result)`。
- [ ] 2.5 `npm run build` 通過。

## 3. Verify

- [ ] 3.1 `npm test` 全綠(三新 + 既有)。
- [ ] 3.2 `npm run build` 通過。
- [ ] 3.3 `npm run verify` 通過。
- [ ] 3.4 `openspec validate coordinator-forward-quality-metrics-summary --strict`。
- [ ] 3.5 `openspec validate --specs --strict`。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants