feat: storage/270、889、990 落地為 MinIO file-server 來源(#/minio 真樹 + #/a1 檔案庫選擇器) - #204
Conversation
… client + #/minio·#/a1 UI + E2E) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Task 5 #/a1 硬 gate 從 getByText(評估構件/score) 改為 getByTestId(a1-rulerun-scoreboard):
原斷言被 A1 workbench L210-216 與 artifact baseline L582-588 兩個恆顯記分板滿足(假綠),
且同名文字多重命中觸發 Playwright strict-mode。Task 4 加一步替 {run && ...} live 區塊
包 data-testid=a1-rulerun-scoreboard,E2E 只斷言該 testid + succeeded,證明 rule-run 真跑過。
- Task 5 所有 getByText 補 .first()/section/main .ec-tree 收斂(270//889//990//local file-server/
ver 竣工.ifc/執行規則檢核 button 皆會多重命中;執行規則檢核在 #/a1 同時命中 workbench 導頁鈕 L225
與 rule-center 觸發鈕 L522),對齊既有 product-console-integration.spec.ts L43-46 模式。
- Task 5 前置補 (A) npm run build:ui→dist-ui (B) governance-service+root (C) CONSOLE_DIST_DIR
重指+重啟 coordinator:/ui 服務預建靜態 dist(app.ts L1937 express.static(consoleDist)),
漏 build:ui 會打到陳舊 console 使新 UI 元素 FAIL(本專案 #1 陷阱)。npm run build≠build:ui。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GET /api/files/tree 掃 BIM_FILE_LIBRARY_ROOT(預設 storage/)兩層
{projectId}/{modelId}/*.ifc,回 project→model→version 樹。只收 .ifc
(大小寫不敏感)、防 path traversal(realpath 仍在 root 內)、root
不存在/空回 200 空樹、ver 竣工.ifc 固定排最後。source_kind=local_fs
誠實標記未來改 s3。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ction 退路) reviewer IMPORTANT:test_symlink_escape_excluded 原以 @skipif(os.name=='nt' and not CI) 在本機 Windows 跳過,而 CI 又從未跑 governance pytest(唯一 workflow 是 GitNexus analyze,非 pytest)。淨效果是 spec §4.1/§6 明列的「防 path traversal / symlink 逃逸」 安全控制在此 code 實際運行的環境裡零自動化覆蓋。 改法:移除 skip,新增 _make_dir_link helper——先試 os.symlink(POSIX 或 Windows Developer Mode/admin),失敗退回 Windows directory junction(mklink /J,免特權), 兩者皆不可行才 skip。os.path.realpath 對 symlink 與 junction 都會解析到 root 外目標, 足以驅動 _is_within 逃逸防線。 驗證:governance-service file_library 由 4 passed/1 skipped 變 5 passed/0 skipped; 另以 neutered _is_within 反向確認此測試非空跑(guard 壞掉時 999 會洩漏、assertion 會擋)。 僅改動 tests/test_file_library.py,未碰 production symbol(detect_changes staged: changed_symbols=0、risk low)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
_DEFAULT_ROOT 原用 _SERVICE_ROOT(=governance-service/) 組 storage/,實際指向
service 層 governance-service/storage/(只有 governance.db / federated/),
違反 spec §4.1 line 75「未設 env 時預設 repo storage/」。真實三專案 270/889/990
×(機電/水電/消防)只在 repo 根 storage/,且全 repo 無任何 committed 設定會設
BIM_FILE_LIBRARY_ROOT,故生產走預設會掃到空目錄回 {projects:[]},使 spec §2.2/§2.4
的 #/minio·#/a1 E2E 在無臨時 env 下無法成立(假綠風險)。
改為由 _SERVICE_ROOT 父層(=repo 根)組 storage/,單行可逆。實測(未設 env,
reload api.py):_library_root() 指向 repo 根 storage;將預設指到主 worktree
repo storage 後 files_tree() 在無 env 覆寫下回 270/889/990 三層樹、ver 竣工.ifc
排最後。既有 5 個 pytest 全綠(host Python312)。不動其他 router 的 service 層
storage 慣例(其 db 檔本就在 service 層,屬正確)。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GET /api/governance/files/tree → 透傳 governance-service GET /api/files/tree (既有 forward helper 模式;governance 不可達回 502,不偽造資料)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e 型別 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MinioDataPage 載入時呼叫 governanceClient.filesTree() 顯示真實 project/model/version 樹(loading/error/empty 三態),原 bucket layout 縮為 prov=demo 規約示意 Panel,model.usdc 仍標 p1。IssuesRuleCenterPage 新增『從檔案庫選擇』三層 select(project→model→version), 選定版本填入既有 ifcPath,手動輸入保留;檔案庫不可用時 graceful degrade。live-run 記分板 加 data-testid=a1-rulerun-scoreboard 供 E2E 分辨真 run 結果 vs baked baseline。前端 render 測試加 MinioData / A1 選擇器兩個 case。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nder 驗收(spec §7.3) finding important#1:原兩個新 vitest case 只用 renderToString,永遠停在 loading 首幀, 未覆蓋 MinioData populated 真樹、error 態,以及 A1『選定版本後填入 ifcPath』這條 spec §7.3 明文 data-binding 行為(load-bearing handler pages.tsx onChange→setIfcPath)。 比照 sibling IntakeSelectPage.test.tsx 的 createRoot + react act + vi.spyOn 模式補三個 client-render case: - MinioData filesTree() 回真樹(270/機電/ver 竣工.ifc)→ 斷言 project/model/version 節點 與 source_kind=local_fs / root 出現,已離開 loading 殼。 - MinioData filesTree() reject → 斷言誠實『未連線後端』錯誤文案,不吞錯、不渲染假樹。 - A1 選 project→model→version → 斷言 ifcPath input value 變成 version.path(spec §7.3)。 已驗該 data-binding 斷言為 load-bearing:暫時拿掉 onChange 的 setIfcPath → 此 case 轉紅 (input 停在預設 fixture 路徑),復原後 30 passed;原 renderToString 路徑無法捕捉此回歸。 驗證:npx vitest run src/console/console.test.tsx → 30 passed(27→30);eslint 0 warn; tsc --noEmit 對 console.test.tsx 0 error(既有 indexHtml.test.ts node-types 錯誤與本次無關)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…→rule-run) 驗 vertical slice:#/minio 真樹可見 270/889/990;#/a1 由選擇器選 270/機電/ver 竣工.ifc → 跑 rule-run → live 記分板(a1-rulerun-scoreboard,僅真 run 後渲染)+ succeeded 出現。 前置未備妥時 conditional skip(誠實,不假綠)。本機以隔離 stack(gov:49102 指主 worktree storage + 第二 coordinator:8014 指 fresh dist-ui)實跑 2 passed,截圖落 artifacts/e2e。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
對抗複驗的兩項 important:硬 gate 實際打到 coordinator 已 build 的 dist-ui,
而非 playwright.config.ts 在 :5180 起的 fresh viewer;且 beforeEach 只驗 backend API
不驗服務這頁的 console 是否本 branch 碼,導致 dist-ui 陳舊時走 locator timeout 而非 skip。
- beforeEach 加守門(2):導 #/a1 探本 branch 才有的 a1-fs-project 三層選擇器
(main 無此 testid);15s 內看不到即 test.skip("coordinator dist-ui 非本 branch"),
讓環境沒對齊走誠實 skip 而非誤導的 toBeVisible 逾時。
- 檔頭前置紀律明文化:服務本 spec 的是 coordinator dist-ui(build:ui → dist-ui),
與 :5180 fresh viewer 無關;乾淨環境須先 npm run build:ui 並重啟 :8004 coordinator
指本 branch storage,docker 佔 :8004 時須重建/重啟(已知 build:ui 不換容器內 dist-ui 的 gotcha)。
驗證:npx tsc --noEmit 與 baseline 一致(僅既有 indexHtml.test.ts 3 errors,本 spec 0 error);
npx playwright test --list 成功編譯並列出本 spec 兩個 test。未跑 live E2E(需 build:ui+重啟
coordinator,且本環境 curl/pwsh 探測被擋;前次 _gov.log 已存在端到端成功證據)。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
beforeEach 兩道守門是 conditional skip,前置缺失即 test.skip 計為 pass。 補上限制說明:此 spec 只有在『外部已確保前置滿足、且缺失時讓 build 失敗』 的前提下才提供真正的 P4 硬 gate 效力;丟進不保證前置的 CI job 會靜默全 skip 仍綠燈(假信心)。並記錄本 repo 現況(.github/workflows 僅 pr-review-agent.yml、 無 Playwright/e2e job,故不 false-green 任何既有自動化 gate)與日後升級成 CI 硬 gate 的條件(workflow 需加『前置必備、缺失即 fail』的 setup step)。 純註解變更,無 production code 改動。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
對抗複驗 findings 閉合:
- [c3] file_library 排除保留目錄(ifc-cache / coordinator):storage/ifc-cache/
ifcready_*/source.ifc 雖符兩層 {dir}/{dir}/*.ifc 規則卻是 coordinator 下載暫存,
原會生 ~60 個假專案污染 #/minio 樹與 A1 專案下拉。新增 _RESERVED_PROJECT_DIRS
常數集合於 router 排除,加 pytest test_reserved_dirs_excluded_from_projects 驗證。
- [c4] 補 console.test.tsx 兩個 client-render case:MinioData empty 態(『檔案庫為空』)
與 A1 fsErr graceful-degradation(『檔案庫不可用…可改用下方手動輸入』),SSR smoke
到不了的分支。
- [q2] tracked docs/evidence/minio-fileserver-source/{summary.json,minio-tree.png,
a1-rulerun.png}(原 untracked,誠實鐵律要求隨 PR 可審)。
- [c1] summary.json traces 路徑經查證已正確(minio-fileserver-source-trace/ 實存,
_output/Mi-08e35 不存在);補 traces_note 與 reserved_dir/states 覆蓋說明。
驗證:governance-service pytest 90 passed;web-viewer-sample vitest 192 passed;
web-viewer-sample npm run build 綠。post-fix 真 storage 重探 project_ids=[270,889,990]。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 13 minutes and 51 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR implements a complete "MinIO file-server source" feature that exposes a read-only file-library browsing API across the backend, coordinator, and frontend UI, enabling users to discover and select IFC files from a local directory structure with three-level selection (project→model→version) in the rule center. ChangesFile Library Browsing and Selection
Sequence Diagram(s)sequenceDiagram
participant User as User/Browser
participant UI as MinIO/<br/>A1 Page
participant Coord as Coordinator<br/>Proxy
participant Gov as Governance<br/>Service
participant FS as Local FS<br/>storage/
User->>UI: Visit `#/minio` or `#/a1`
UI->>Coord: GET /api/governance/files/tree
Coord->>Gov: GET /api/files/tree
Gov->>FS: realpath, scandir projects
FS-->>Gov: {270,889,990}/...
Gov->>FS: scandir models, .ifc files
FS-->>Gov: model dirs + ver files
Gov-->>Coord: 200 FilesTreeResponse<br/>(source_kind:local_fs, projects[])
Coord-->>UI: 200 JSON tree
UI->>UI: Render projects/models/versions<br/>or populate A1 selector
User->>UI: Select 270/機電/ver 竣工.ifc
UI->>UI: Set ifcPath input
User->>UI: Click 執行規則檢核
UI->>Coord: POST rule-run with ifcPath
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43c0507e6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ### New Capabilities | ||
|
|
||
| - `minio-fileserver-source`: 以本機 `storage/` 為 MinIO `bim-control` 規約的唯讀 file-server 來源,前端可瀏覽專案/模型/版本並把選定 IFC 作為 A1 檢核來源。 |
There was a problem hiding this comment.
Add the missing OpenSpec spec delta
This declares minio-fileserver-source as a new capability, but the change directory only adds proposal.md and tasks.md; there is no openspec/changes/minio-fileserver-source/specs/.../spec.md with Requirements/Scenarios. Under openspec/AGENTS.md, active changes are expected to validate strictly and new capabilities need at least one Requirement + Scenario, so this change cannot be validated/archived as an OpenSpec change even though the PR advertises it as one.
Useful? React with 👍 / 👎.
| value="" | ||
| onChange={(e) => { if (e.target.value) setIfcPath(e.target.value); }} |
There was a problem hiding this comment.
Persist the selected version value
When a user selects any version, this controlled <select> is immediately forced back to the placeholder because value is always "". In the A1 selector flow this makes the chosen version disappear, and after changing the project/model the form can still submit the previously populated ifcPath unless the user notices the text box; keep a selected-version state and clear it/path when parent selections change so the selector and submitted source stay in sync.
Useful? React with 👍 / 👎.
| # 預設 root = repo 根 storage/(spec §4.1):真實三專案 270/889/990 放在 repo 根層, | ||
| # 非 service 層 governance-service/storage/(後者只放 governance.db / federated/)。 | ||
| # 故由 _SERVICE_ROOT(=governance-service/) 的父層(=repo 根)組 storage/。 | ||
| _DEFAULT_ROOT = os.path.join(os.path.dirname(_SERVICE_ROOT), "storage") |
There was a problem hiding this comment.
Use the configured runtime storage root
In the rebuilt deployment/worktree path, the real IFC library is not committed into that checkout, while the deploy scripts only populate RUNTIME_STORAGE_ROOT and never set BIM_FILE_LIBRARY_ROOT (checked scripts/ and compose files). Because the API falls back to checkout-local storage/, /api/files/tree will return an empty tree after the canonical deploy rebuild even though the runtime storage root is configured; fall back to RUNTIME_STORAGE_ROOT or wire BIM_FILE_LIBRARY_ROOT in the deploy/start path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR implements a read-only file-library browse feature that surfaces the local storage/{270,889,990} IFC files (3 projects × 3 disciplines × 4 versions = 36 IFCs) as a browseable tree through the full stack: governance-service API → coordinator proxy → EdgeConsole UI. It replaces the static demo content on #/minio with a real file tree and adds a 3-tier selector on #/a1 for choosing IFC files to run governance checks against.
Changes:
- Backend
GET /api/files/treeAPI in governance-service with path traversal protection, reserved directory exclusion, and natural sort order (竣工 last) - Coordinator proxy whitelist addition + frontend
governanceClient.filesTree()client method with TypeScript types #/minionow displays the real file tree (loading/error/empty states) and#/a1gains a project→model→version selector that populates the existingifc_source_pathinput
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
governance-service/file_library/__init__.py |
New package init for file_library router module |
governance-service/file_library/api.py |
Read-only GET /api/files/tree endpoint: scans BIM_FILE_LIBRARY_ROOT for two-level {project}/{model}/*.ifc structure with realpath traversal guard, reserved-dir exclusion, and 竣工-last sort |
governance-service/app.py |
Registers new file_library_router following existing include_router pattern |
governance-service/tests/test_file_library.py |
6 pytest cases: tree shape, loose file exclusion, reserved dirs, sort order, missing root (200 empty), and symlink escape (with Windows junction fallback) |
bim-review-coordinator/src/routes/governanceProxy.ts |
Adds GET /api/governance/files/tree whitelist entry forwarding to governance-service |
bim-review-coordinator/tests/governance-files-tree.test.ts |
2 vitest cases: successful proxy passthrough and 502 on governance unreachable |
web-viewer-sample/src/console/governanceClient.ts |
New filesTree() method + FilesTreeResponse/FileProjectRow/FileModelRow/FileVersionRow type exports |
web-viewer-sample/src/console/governanceClient.test.ts |
2 vitest cases: successful fetch + error propagation |
web-viewer-sample/src/console/pages.tsx |
MinioDataPage rewritten to fetch real tree (3 UI states); IssuesRuleCenterPage gains 3-tier selector + data-testid="a1-rulerun-scoreboard" for E2E gating |
web-viewer-sample/src/console/console.test.tsx |
SSR smoke tests + client-render tests (populated/error/empty states, selector data-binding, graceful degradation) |
web-viewer-sample/e2e/minio-fileserver-source.spec.ts |
Playwright E2E: #/minio tree visibility + #/a1 selector→rule-run→scoreboard, with 2-phase conditional skip |
docs/superpowers/specs/2026-06-10-minio-fileserver-source-design.md |
Feature design spec |
docs/superpowers/plans/2026-06-10-minio-fileserver-source.md |
Detailed implementation plan with TDD steps |
openspec/changes/minio-fileserver-source/proposal.md |
OpenSpec change proposal |
openspec/changes/minio-fileserver-source/tasks.md |
Task checklist with commit references |
docs/evidence/minio-fileserver-source/summary.json |
E2E evidence summary with runtime topology and rule-run results |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
docs/superpowers/plans/2026-06-10-minio-fileserver-source.md (1)
1-6: ⚡ Quick winAdd explicit document nature marker.
Per coding guidelines, files in
docs/**/*.mdmust explicitly mark document nature (agent boundary / contract / wiki / runbook / spec design / working note). While the title includes "Plan", consider adding a structured marker at the top for clarity and tooling compatibility.📋 Suggested addition
# MinIO File-Server Source Implementation Plan +**Document nature:** implementation plan (runbook) + **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/plans/2026-06-10-minio-fileserver-source.md` around lines 1 - 6, This doc lacks an explicit document-nature marker; update the "MinIO File-Server Source Implementation Plan" file to add a clear, structured marker at the top (e.g., YAML/frontmatter or a bolded "Document Nature: Plan" line) indicating its nature (Plan/spec/design/agent boundary/etc.) so tooling and readers can unambiguously recognize it; ensure the marker appears immediately after the title and follows the project's docs format conventions used elsewhere.Source: Coding guidelines
docs/superpowers/specs/2026-06-10-minio-fileserver-source-design.md (1)
1-7: ⚡ Quick winAdd explicit document nature marker and source-of-truth disclaimer.
Per coding guidelines,
docs/**/*.mdfiles must:
- Mark document nature (agent boundary / contract / wiki / runbook / spec design / working note)
- Align with source of truth order (code > contracts > AGENTS > wiki)
This design spec should explicitly state it is a "spec design" document and clarify that the implementation code is authoritative when conflicts arise.
📋 Suggested addition
# MinIO File-Server 來源落地(storage/270、889、990)設計 +**Document nature:** spec design +**Source of truth:** Implementation code is authoritative; this spec is descriptive, not prescriptive. + - 日期:2026-06-10🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/specs/2026-06-10-minio-fileserver-source-design.md` around lines 1 - 7, Add an explicit document nature marker and a source-of-truth disclaimer at the top of the "MinIO File-Server 來源落地(storage/270、889、990)設計" spec: insert a one-line tag such as "Document type: spec design" under the title and add a brief disclaimer stating the authoritative order (code > contracts > AGENTS > wiki) and that implementation code is authoritative if conflicts arise; update the header block near the existing Phase/A1 lines so readers immediately see the document nature and source-of-truth rules.Source: Coding guidelines
web-viewer-sample/src/console/governanceClient.test.ts (1)
10-35: 💤 Low valueConsider aligning mock path with mock root for clarity.
The mock
rootis"C:/Repos/active/iot/AI-BIM-governance/storage"but theversions[0].pathis"C:/x/ver 竣工.ifc", which doesn't logically match. While this doesn't affect test validity (it's mock data), aligning them improves maintainability.♻️ Suggested alignment
{ model_id: "機電", versions: [{ name: "ver 竣工.ifc", path: "C:/x/ver 竣工.ifc", size_bytes: 22618, mtime: "2026-06-10T17:17:00+08:00" }] }, +{ model_id: "機電", versions: [{ name: "ver 竣工.ifc", path: "C:/Repos/active/iot/AI-BIM-governance/storage/270/機電/ver 竣工.ifc", size_bytes: 22618, mtime: "2026-06-10T17:17:00+08:00" }] },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web-viewer-sample/src/console/governanceClient.test.ts` around lines 10 - 35, The mock tree's root and file path are inconsistent; update the mocked data in the test (the tree object used in governanceClient.test.ts) so versions[0].path is under the same root (e.g., change "C:/x/ver 竣工.ifc" to a path within "C:/Repos/active/iot/AI-BIM-governance/storage", keeping the existing version name), so the mocked tree returned by the fetch spy and the asserted values from governanceClient.filesTree() are logically aligned.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@governance-service/file_library/api.py`:
- Around line 60-76: The directory scan in _list_versions currently assumes
os.scandir, entry.stat(), and _iso_mtime will always succeed and will let
transient OSError/IOError raise and abort the whole response; wrap the per-entry
operations in a try/except (catching OSError/IOError/Exception) so that if
os.scandir iteration, entry.stat(), or _iso_mtime fails for a single entry you
log/debug the failure (or silently skip) and continue to the next entry, only
appending fully-read entries to versions; apply the same defensive try/except
pattern to the analogous code that lists files in the other function/block (the
one using entry.stat() and _iso_mtime at the later block) to avoid endpoint-wide
500s.
In `@web-viewer-sample/src/console/pages.tsx`:
- Around line 380-403: The files-tree fetch in the useEffect
(governanceClient.filesTree -> setTree/setLoading/setErr) lacks a user-triggered
retry flow; update the component (e.g., MinioDataPage / the file-library
selector) to add explicit failure UI with a Retry button that calls a new
fetchFilesTree function (encapsulating the current governanceClient.filesTree
logic), track a retrying/loading state, reset setErr on retry, and re-run the
fetch; ensure the UI shows loading/success/failure/retry states and expose an
observable ID/route and test hook as required by the guidelines.
---
Nitpick comments:
In `@docs/superpowers/plans/2026-06-10-minio-fileserver-source.md`:
- Around line 1-6: This doc lacks an explicit document-nature marker; update the
"MinIO File-Server Source Implementation Plan" file to add a clear, structured
marker at the top (e.g., YAML/frontmatter or a bolded "Document Nature: Plan"
line) indicating its nature (Plan/spec/design/agent boundary/etc.) so tooling
and readers can unambiguously recognize it; ensure the marker appears
immediately after the title and follows the project's docs format conventions
used elsewhere.
In `@docs/superpowers/specs/2026-06-10-minio-fileserver-source-design.md`:
- Around line 1-7: Add an explicit document nature marker and a source-of-truth
disclaimer at the top of the "MinIO File-Server 來源落地(storage/270、889、990)設計"
spec: insert a one-line tag such as "Document type: spec design" under the title
and add a brief disclaimer stating the authoritative order (code > contracts >
AGENTS > wiki) and that implementation code is authoritative if conflicts arise;
update the header block near the existing Phase/A1 lines so readers immediately
see the document nature and source-of-truth rules.
In `@web-viewer-sample/src/console/governanceClient.test.ts`:
- Around line 10-35: The mock tree's root and file path are inconsistent; update
the mocked data in the test (the tree object used in governanceClient.test.ts)
so versions[0].path is under the same root (e.g., change "C:/x/ver 竣工.ifc" to a
path within "C:/Repos/active/iot/AI-BIM-governance/storage", keeping the
existing version name), so the mocked tree returned by the fetch spy and the
asserted values from governanceClient.filesTree() are logically aligned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f64fb6cb-2729-4d8a-95ee-46f7a309e063
⛔ Files ignored due to path filters (2)
docs/evidence/minio-fileserver-source/a1-rulerun.pngis excluded by!**/*.pngdocs/evidence/minio-fileserver-source/minio-tree.pngis excluded by!**/*.png
📒 Files selected for processing (16)
bim-review-coordinator/src/routes/governanceProxy.tsbim-review-coordinator/tests/governance-files-tree.test.tsdocs/evidence/minio-fileserver-source/summary.jsondocs/superpowers/plans/2026-06-10-minio-fileserver-source.mddocs/superpowers/specs/2026-06-10-minio-fileserver-source-design.mdgovernance-service/app.pygovernance-service/file_library/__init__.pygovernance-service/file_library/api.pygovernance-service/tests/test_file_library.pyopenspec/changes/minio-fileserver-source/proposal.mdopenspec/changes/minio-fileserver-source/tasks.mdweb-viewer-sample/e2e/minio-fileserver-source.spec.tsweb-viewer-sample/src/console/console.test.tsxweb-viewer-sample/src/console/governanceClient.test.tsweb-viewer-sample/src/console/governanceClient.tsweb-viewer-sample/src/console/pages.tsx
PR Review Agent Summary
Blockers
Warnings
Validation Commands
Checks
Human Review Notes
|
…SError 防護 + A1 選擇器持值/清理 + 檔案庫重試 對應 reviewer 發現(Codex 3×P2 + CodeRabbit 2×Major + pr-review-agent blocker): - openspec:補 minio-fileserver-source spec delta(Requirement+Scenario), 修 CI `openspec validate` high blocker;--strict 本機已綠。 - governance file_library:library root 解析鏈改 BIM_FILE_LIBRARY_ROOT → RUNTIME_STORAGE_ROOT → checkout storage/ (部署區 checkout 不含真 IFC,跟著 deploy .env 的 runtime 資料根走); 掃描逐 entry OSError 防護(單檔中途被刪/鎖只跳過,不再端點整體 500)。 - A1 選擇器:version select 改持值受控(不再被 value="" 打回 placeholder); 換 project/model 重置 version 並清空「由選擇器填入的」ifcPath(手動輸入保留)。 - #/minio 與 A1 檔案庫 error 態加「重試」(重打同一條真實 fetch,不必整頁 reload)。 - 測試:pytest +3(runtime root fallback / 優先序 / OSError 不 500)→ 93 passed; vitest +3(持值與換層清理 / minio 重試 / a1 重試)→ 195 passed; governanceClient.test.ts mock path 與 root 對齊(nit)。 - docs:plan / spec design 補文件性質標記與權威序聲明(nit)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reviewer 修復輪(commit 25b3218)
驗證:governance-service pytest 93 passed(+3);web-viewer-sample |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25b3218a2b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| className="ec-btn" | ||
| disabled={!selModel} | ||
| value={selVersion} | ||
| onChange={(e) => { setSelVersion(e.target.value); if (e.target.value) setIfcPath(e.target.value); }} |
There was a problem hiding this comment.
Clear the selector path when version is cleared
If a user selects a version and then chooses the placeholder option again, this handler only resets selVersion; the ifcPath input keeps the previously selected absolute path, so clicking “執行規則檢核” still submits a file even though the version selector now shows no selection. Clear ifcPath when the new value is empty and the current path still matches the prior selector value, mirroring the project/model reset behavior.
Useful? React with 👍 / 👎.
PR Review Agent Summary
Blockers
Warnings
Validation Commands
Checks
Human Review Notes
|
選定 version 後將 select 清回 placeholder 時,原 handler 只 reset selVersion, ifc_source_path 殘留舊選擇路徑可能被誤送出檢核。改為復用 resetVersionPick(): 清 selVersion 並清空「由選擇器填入的」路徑;手動輸入值不受波及。 - vitest +1(清 placeholder 清 selector 值 / 手動值保留)→ 196 passed - openspec spec delta 同步補對應 Scenario;--strict 仍 valid Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Review Agent Summary
Blockers
Warnings
Validation Commands
Checks
Human Review Notes
|
#229) 把 13 個產品碼已 merge 進 main 的 active change 歸檔為不可變快照, 並將其 spec delta 併入 canonical specs。對齊 #197 收斂規約。 歸檔(archive/<merge-date>-<id>,git 偵測為 R100 純改名、零內容漂移): a1-m1-closeout(#213) a2-version-diff-selector(#207) conv-coverage-report(#218/#220) conv-prioritize-retry(#221) conv-watch-toggle(#225) conversion-artifact-id-sanitize(#206) governance-service-deploy(#215) minio-fileserver-source(#204) minio-watch-auto-intake(#210) raise-claude-md-line-budget(#199) sessions-terminate(#226) stop-all-single-pid-cleanup(#217) test-deploy-rebuild-workflow(#198) canonical 併入: - 9 個新 capability(純 ADDED → 新建 spec):a1-m1-closeout、a2-version-diff-selector、 conv-coverage-report、conv-prioritize-retry、conversion-control、conversion-artifact-id-sanitize、 minio-fileserver-source、minio-watch-auto-intake、test-deploy-rebuild-workflow。 - review-session-request-lifecycle:append sessions-terminate 的 ADDED requirement 「Operator 結束 session controlled action」(5 scenario),既有 7 requirement 不動。 - one-click-deploy-hybrid:併入 governance-service-deploy 與 stop-all-single-pid-cleanup 兩 delta,採「合併不取代」保全既有更豐富內容。依 deploy.ps1 現況權威 (4a=governance/4b=conversion/4c=Kit/4d=docker)調和 Phase 4 編號,並修正 canonical 其他兩處陳舊的舊 3 段編號(Mode C 入口 scenario、退出碼 stage 清單補 4d)。 - agent-doc-context-budget:raise-claude-md-line-budget 的 130 行預算已於 #199 併入, 本次為 archive-only。 驗證: - 結構檢查無殘留 ## ADDED/MODIFIED header、每 requirement 皆有 scenario、 43 archive 檔全 R100、git diff --cached --check 無 whitespace。 - 雙 agent 對抗驗證:完整性 PASS(無規範遺失);一致性初判 FAIL 抓到 2 處 Phase 4 編號矛盾,已修正後複驗。 - 本機 openspec CLI 不可用(結構驗證代替);openspec validate --strict 由 CI pr-review-agent 執行。 Claude-Session: https://claude.ai/code/session_01JEyNWhEmb3x8oinY3B2v9V Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Why
docs/plans/v3 規約第 7 條要求資料路徑比照真實 MinIObim-control/{projectId}/{modelId}/model.ifc…,但#/minio整頁是寫死示意(prov="demo")、#/a1檢核來源只有手填路徑文字框。本 PR 把本機storage/270、889、990(3 專案 × 機電/水電/消防 × 4 版本,共 36 個 IFC)落地為唯讀 file-server 來源:對應 M0-R2 殼層真資料化 + M1-R6 端到端驗收的資料地基。Spec:
docs/superpowers/specs/2026-06-10-minio-fileserver-source-design.md(隨本 PR 入庫)Plan:
docs/superpowers/plans/2026-06-10-minio-fileserver-source.mdOpenSpec change:
openspec/changes/minio-fileserver-source/What Changes
file_libraryrouter —GET /api/files/tree唯讀列出BIM_FILE_LIBRARY_ROOT(預設 repostorage/)下兩層{projectId}/{modelId}/*.ifc;realpath防 traversal;保留目錄(ifc-cache、coordinator)排除;ver 竣工.ifc排版本序最後;root 缺失回 200 空樹。governanceProxy白名單新增GET /api/governance/files/tree透傳一條。governanceClient.filesTree()+FilesTreeResponse型別;#/minio接真檔案庫樹(loading/error/empty 三態 +source_kind=local_fs誠實文案);#/a1新增專案→模型→版本三層選擇器(手動輸入保留、檔案庫不可用時 graceful degradation)。e2e/minio-fileserver-source.spec.ts;抽樣證據 tracked 於docs/evidence/minio-fileserver-source/。model.usdc仍標p1(轉檔產物待建,未因本 PR 翻綠);Bucket layout 規約示意 Panel 維持prov="demo"。Frontend Verification Table(product-operability §4)
/ui/#/minio、/ui/#/a1a1-fs-project(270) →a1-fs-model(機電) →a1-fs-version(ver 竣工.ifc);「執行規則檢核」storage/270/機電/ver 竣工.ifc(22,618 bytes,經 UI 選擇器選定,非手貼路徑)GET /api/governance/files/tree(200,source_kind=local_fs,projects=[270,889,990]);POST /api/governance/rule-runs(202 → succeeded)rr_a76e2680c771(瀏覽器內觸發)+rr_6c678a264a28(API 驗證)皆 succeeded#/minio真樹 270/889/990 可見;#/a1記分板 total=14 / passed=14 / failed=0 / score=100E2E_COORDINATOR_BASE_URL=http://127.0.0.1:8014 npx playwright test e2e/minio-fileserver-source.spec.ts --reporter=list(引擎:Playwright;exit 0,2 passed 0 skipped)docs/evidence/minio-fileserver-source/{minio-tree,a1-rulerun}.png+summary.json;local full trace:artifacts/e2e/minio-fileserver-source-trace/*/trace.zip(依「evidence 只存抽樣」慣例不入庫)BIM_FILE_LIBRARY_ROOT指 storage)+ coordinator(build:ui後)→ 開/ui/#/minio看真樹 →/ui/#/a1三層選擇器選檔 → 執行規則檢核 → 記分板出現Deploy Path Verification Table(product-operability §7)
BIM_FILE_LIBRARY_ROOT預設 repo storage/,不動 ports/Kit)scripts/deploy.ps1既有路徑即涵蓋:coordinator web-plane DockerfileRUN npm run build:ui會烘入新 dist 與 proxy)-DryRun;merge 後走.\scripts\dev\rebuild-test-deploy.ps1 -Build).\scripts\dev\rebuild-test-deploy.ps1 -Build(本 PR 驗證採 branch 隔離 stack,因部署區只能跑 main 的 code)http://127.0.0.1:8014/ui/#/minio、/ui/#/a1(branch 隔離 stack;:8004 待 merge 後重建驗證)docs/evidence/minio-fileserver-source/(tracked)+artifacts/e2e/minio-fileserver-source-*(local)Impact / Review 揭露
governanceClient(file-level impact 8 symbols,貫穿 viewer 前端入口鏈)— 補強:本 PR 僅「新增」filesTree()方法與型別,零修改既有方法簽名;vitest 全綠 + Playwright 真跑佐證無 regression。其餘 symbol(registerGovernanceProxy、MinioDataPage、IssuesRuleCenterPage)LOW。git diff --name-only --cached自查(僅預期 4 檔);其餘 task 與 fix cycle 均 pass。85c936a修 4 項(證據入庫、traces 路徑、ifc-cache 保留目錄排除 + pytest、empty/fsErr vitest 補強含突變驗證 load-bearing);r2 = 4/4 truly_closed、new_issues=0、critic overall_safe=true。rr_6c678a264a28的 DB artifact 為 transient(驗證者重跑同 IFC 得逐字相同 summary,可重現性推定);fsErr vitest 末段受控輸入斷言證明力弱於註解宣稱(主斷言均有效);22KB fixture 對 default-governance 規則集鑑別力低(DOOR/WALL 0 targets vacuous pass 為 main 既有 A1-RE-01 設計,target_summary 誠實揭露)— 負例 fixture 屬 follow-up。🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes