# TEST INFRASTRUCTURE SPECIFICATION (TEST_INFRA.md)
# 4D BIM Ông Đèn Box Culvert Simulation & Interactive Site Diary

**Author**: `teamwork_preview_test_writer_e2e_1` (Specialist / QA)  
**Workspace**: `c:\Projects\DSCons`  
**Date**: 2026-10-04T03:32:00Z  
**Target Recipient**: Orchestrator (`befbfc73-5853-4a94-b280-61f27b35aa73`)  
**Standard**: 4-Tier Verification Architecture (Coverage, Boundary, Cross-Feature, Real-World)  

---

## 1. Executive Summary & Testing Strategy

This document establishes the end-to-end verification framework for the **4D BIM Cống Hộp Ông Đèn (Xã Kiến Minh)** simulation engine, interactive site diary dock, 3D dimension callouts, and canvas video export pipeline.

### Core Testing Directives
1. **Zero Synthetic Data / 100% Ground Truth**: Every expected test value is derived strictly from:
   - Contract No. `21.9.CHOĐBLKM/2026/HĐXL` (Contract value: 6,482,295,000 VND).
   - Contractor: Công ty TNHH Xây Dựng Định Sơn (MST `0202111150`).
   - Project Executive / Site Manager: Nguyễn Văn Hoạt (CCHN CHT Hạng II, DS-PM-002).
   - 28-sheet drawing book `Kenh_Ong_Den_ban_ve.pdf` (Sheet 03: General Alignment; Sheet 04: Phasing Sequence; Sheets 05-09: Cross-Sections; Sheet 23: Alignment Stations).
2. **Behavioral & Contract-Driven Verification**: Tests inspect real Three.js scene graphs, WebGL buffer states, Canvas MediaRecorder stream callbacks, CSS layout bounding boxes, and FastAPI HTTP responses.
3. **Deterministic Verification Gate**:
   - Zero JavaScript exceptions (`window.onerror`, unhandled promise rejections, Three.js shader compilation errors).
   - Real-time render loop stable $> 30$ FPS (target 50–60 FPS) with zero memory leaks / garbage collection spikes.
   - Zero occlusion between collapsible Site Diary bottom dock and the 390px right sidebar (`enterprise-ui-darkslate` compliance).
   - Hexagonal DDD boundary compliance: `pytest tests/test_architecture_boundary_enforcement.py` passing 100%.

---

## 2. Authoritative Ground Truth Derivation Matrix

| Item | Architectural Ground Truth | Primary Document Reference | Tolerance |
| :--- | :--- | :--- | :--- |
| **Total Alignment Length** | $L_{TOTAL} = 146.46\text{ m}$ (4 parametric segments) | Sheet 03 & Sheet 23 (`build_curved_bim.py`) | $\pm 0.01\text{m}$ |
| **Culvert Cross-Section** | Inner clearance $2.5\text{m} \times 2.5\text{m}$; Thickness $250\text{mm}$; Envelope $3.0\text{m} \times 3.0\text{m}$; Haunches $300\times300\text{mm}$ | Sheets 05, 06, 07 (`index.html:528-547`) | Exact |
| **Foundation & Blinding** | Sand cushion 10cm + Lean concrete M100 10cm; Width $3.4\text{m}$ | Sheet 05 (`index.html:572-581`) | Exact |
| **Shoring & Clearance** | Larsen IV ($7.0\text{m}$), 2 rows at $u = \pm 1.8\text{m}$; Clearance to culvert outer face $= 200\text{mm}$ | Sheet 04 & Sheet 08 (`index.html:584-596`) | Exact |
| **Struts (Văng chống)** | Waler I300 + Tubular struts $\Phi 219$ (span $3.4\text{m}$, elevation $y = 2.9\text{m}$), pitch $s = 6.0\text{m}$ | Sheet 08 (`index.html:597-637`) | Exact |
| **Bamboo Piles** | $L = 2.5\text{m}$, density 25 piles/m² ($1.0\text{m} \times 0.45\text{m}$ grid), total $13,042$ piles | Sheet 05 & HSMT Item 14 (`index.html:639-660`) | Exact |
| **Longitudinal Segments** | Seg 1 ($50.0\text{m}$), Seg 2 ($51.46\text{m}$), Seg 3 ($45.0\text{m}$); 2 joints V250 at $s=50.0\text{m}, 101.46\text{m}$ | Sheet 03 & Sheet 09 (`index.html:560-571`) | Exact |
| **Simulation Timeline** | 90 days across 6 discrete construction phases (Phases 1 to 6) | Sheet 04 Phasing Table & HĐ-2026 Schedule | Exact |
| **Site Diary Layout** | Collapsible bottom dock, $195\text{px}$ expanded, $32\text{px}$ collapsed, `right: 390px` (Zero Occlusion) | `enterprise-ui-darkslate` Directive | $\le 1\text{px}$ |
| **Video Export** | HTML5 Canvas `captureStream(30)` + `MediaRecorder` ($1920 \times 1080$), direct blob download | ORIGINAL_REQUEST §R4 | Size $> 100\text{ KB}$ |

---

## 3. Test Architecture & Environment Specification

- **Runtime Engine**: Playwright for Python (`playwright.async_api`), Headless Chromium.
- **Chromium Launch Flags**:
  - `--disable-background-timer-throttling`: Prevents `requestAnimationFrame` and interval throttling.
  - `--disable-backgrounding-occluded-windows`: Ensures continuous rendering in headless mode.
  - `--disable-renderer-backgrounding`: Prevents frame drops.
  - `--use-gl=angle` / `--use-angle=swiftshader` or default GPU acceleration.
- **Viewport**: Desktop standard $1440 \times 900$ (with responsive check up to $1920 \times 1080$ and mobile test at $390 \times 844$).
- **Test Entry Points**:
  - Standalone verification script: `tools/verification/test_ong_den_4d_bim_and_video_export.py`.
  - Pytest runner: `pytest tools/verification/test_ong_den_4d_bim_and_video_export.py -v`.
  - Backend regression gate: `pytest tests/test_architecture_boundary_enforcement.py -v`.

---

## 4. Tier 1: Feature Coverage (F1 to F12, >=5 Test Cases Each)

### Feature 1 (F1): Clearance & Culvert Cross-Section Dimensions
- **TC-COV-F1-01**: *Internal Clearance Width Callout Verification*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Navigate to `/static/bim/index.html`; activate dimension group (`groupDimensions.visible = true`).
  - *Expected*: Billboard sprite with label text containing `"2.50 m"` or `"2.5m (Thông thủy)"` exists at transverse offset $u \in [-1.25, 1.25]$, elevation $y \approx 1.5\text{m}$.
- **TC-COV-F1-02**: *Internal Clearance Height Callout Verification*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Query dimension group children for vertical clearance measurement.
  - *Expected*: Billboard sprite text containing `"2.50 m"` spans between bottom slab top ($y = 0.25\text{m}$) and top slab bottom ($y = 2.75\text{m}$).
- **TC-COV-F1-03**: *Culvert Wall Thickness Verification (250mm)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect left/right wall dimension callouts at cross-section station ($s = 3.0\text{m}$ or $s = 0.0\text{m}$).
  - *Expected*: Text containing `"250 mm"` or `"0.25 m"` with architectural slash ticks positioned between $u = -1.50\text{m}$ and $u = -1.25\text{m}$.
- **TC-COV-F1-04**: *Bottom and Top Slab Thickness Verification (250mm)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect slab dimension callout objects.
  - *Expected*: Bottom slab callout shows `"250 mm (Bản đáy)"` ($y \in [0.0, 0.25\text{m}]$); Top slab callout shows `"250 mm (Bản nắp)"` ($y \in [2.75, 3.00\text{m}]$).
- **TC-COV-F1-05**: *Outer Envelope Dimensions Verification (3.0m x 3.0m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect outer boundary extension lines and dimension ticks.
  - *Expected*: Horizontal outer dimension callout `"3.00 m (Phủ bì)"` ($u \in [-1.50, +1.50\text{m}]$); Vertical outer dimension callout `"3.00 m (Phủ bì)"` ($y \in [0.0, 3.0\text{m}]$).

### Feature 2 (F2): Foundation & Larsen Shoring Dimensions
- **TC-COV-F2-01**: *Foundation Width Callout (3.40m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect foundation dimension line at $y \approx -0.3\text{m}$ to $-0.5\text{m}$.
  - *Expected*: Dimension line extends from $u = -1.70\text{m}$ to $u = +1.70\text{m}$, total span exactly $3.40\text{m}$ with label `"3.40 m"`.
- **TC-COV-F2-02**: *Culvert-to-Larsen Shoring Clearance Callout (200mm)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect gap dimension between outer culvert edge ($u = 1.50\text{m}$) and foundation/shoring edge ($u = 1.70\text{m}$).
  - *Expected*: Callout sprite label reads `"200 mm"` or `"0.20 m (Khoảng hở mép)"`.
- **TC-COV-F2-03**: *Lean Concrete and Sand Cushion Thickness (200mm total / 10cm + 10cm)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect foundation vertical thickness callout.
  - *Expected*: Callout indicates `"200 mm"` spanning $y \in [-0.20\text{m}, 0.00\text{m}]$.
- **TC-COV-F2-04**: *Larsen IV Depth / Length Annotation (7.0m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 04 & Sheet 08.
  - *Input*: Inspect shoring sheet pile callout at shoring row $u = \pm 1.8\text{m}$.
  - *Expected*: Callout sprite specifies `"Cừ Larsen IV (H = 7.0m)"` or equivalent dimension line spanning $7.0\text{m}$ vertically.
- **TC-COV-F2-05**: *Transverse Shoring Span Callout (3.6m between Larsen rows)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 08.
  - *Input*: Inspect transverse distance between left and right Larsen rows ($u = -1.8\text{m}$ to $+1.8\text{m}$).
  - *Expected*: Dimension line reflects span $3.6\text{m}$ (or waler clear span $3.4\text{m}$) matching strut clear length.

### Feature 3 (F3): Strut Pitch & Bamboo Pile Density Callouts
- **TC-COV-F3-01**: *Strut Pitch Longitudinal Spacing Callout (s = 6.0m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 08 (`index.html:624`).
  - *Input*: Inspect longitudinal dimension line connecting first strut ($s = 4.0\text{m}$) and second strut ($s = 10.0\text{m}$).
  - *Expected*: Dimension line length equals $6.0\text{m}$, sprite label text contains `"Bước dầm văng s = 6.0 m"` or `"6.0m"`.
- **TC-COV-F3-02**: *Strut Clear Span Callout (3.4m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 08.
  - *Input*: Inspect transverse strut bar annotation at $y = 2.9\text{m}$.
  - *Expected*: Callout displays `"Nhịp văng 3.4 m"`.
- **TC-COV-F3-03**: *Bamboo Pile Longitudinal Pitch Callout (1.0m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect pile spacing annotation along station axis.
  - *Expected*: Callout sprite displays `"Bước dọc 1.0 m"` between adjacent pile rings.
- **TC-COV-F3-04**: *Bamboo Pile Transverse Pitch Callout (0.45m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 05.
  - *Input*: Inspect pile grid transverse callout across 7 pile rows ($u \in [-1.4, +1.4\text{m}]$).
  - *Expected*: Callout displays `"Bước ngang 0.45 m"`.
- **TC-COV-F3-05**: *Bamboo Pile Density and Total Count Annotation (25 piles/m², 13,042 piles)*.
  - *Source*: ORIGINAL_REQUEST §R1; HSMT Item 14.
  - *Input*: Inspect foundation bamboo callout annotation card / sprite.
  - *Expected*: Label contains `"25 cọc/m²"` and references `"13,042 cọc"` or `"L = 2.5 m"`.

### Feature 4 (F4): Longitudinal Segments & V250 Joints
- **TC-COV-F4-01**: *Segment 1 Longitudinal Dimension Callout (50.0m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 03.
  - *Input*: Inspect longitudinal segment dimension from $s = 0.0\text{m}$ (Cọc D0) to $s = 50.0\text{m}$ (Khe lún 1).
  - *Expected*: Polyline / dimension line has length $50.0\text{m}$; sprite label reads `"Phân đoạn 1: L = 50.0 m"`.
- **TC-COV-F4-02**: *Expansion Joint 1 Location and Type Callout (s = 50.0m, V250)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 09.
  - *Input*: Inspect joint marker at station $s = 50.0\text{m}$.
  - *Expected*: Sprite label reads `"Khe lún 1 (Băng cản nước V250)"` or `"KL1: s = 50.0m"`.
- **TC-COV-F4-03**: *Segment 2 Curved Longitudinal Dimension Callout (51.46m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 03 (`L2 = 51.46m`).
  - *Input*: Inspect longitudinal segment dimension from $s = 50.0\text{m}$ to $s = 101.46\text{m}$ passing through Cọc 3 bend ($61.1^\circ$) and curve $R=25\text{m}$.
  - *Expected*: Centerline length equals $51.46\text{m}$; sprite label reads `"Phân đoạn 2: L = 51.46 m"`.
- **TC-COV-F4-04**: *Expansion Joint 2 Location and Type Callout (s = 101.46m, V250)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 09.
  - *Input*: Inspect joint marker at station $s = 101.46\text{m}$.
  - *Expected*: Sprite label reads `"Khe lún 2 (Băng cản nước V250)"` or `"KL2: s = 101.46m"`.
- **TC-COV-F4-05**: *Segment 3 and Total Length Callout (45.0m, Total 146.46m)*.
  - *Source*: ORIGINAL_REQUEST §R1; Sheet 03.
  - *Input*: Inspect Segment 3 dimension ($s = 101.46\text{m} \to 146.46\text{m}$) and overall dimension line.
  - *Expected*: Segment 3 label reads `"Phân đoạn 3: L = 45.0 m"`; overall alignment callout reads `"Tổng chiều dài cống L = 146.46 m"`.

### Feature 5 (F5): 3D Dimension Layer Toggle
- **TC-COV-F5-01**: *Sidebar Layer Checkbox Existence (`#chkDimensions`)*.
  - *Source*: ORIGINAL_REQUEST §R1; PROJECT.md §F5.
  - *Input*: Inspect DOM selector `input#chkDimensions` in sidebar.
  - *Expected*: Checkbox element exists, has label `"Đường kích thước & Callouts 3D"` or similar, initially checked (`checked == true`).
- **TC-COV-F5-02**: *Floating Quick-Toggle Button Existence (`#btnDims`)*.
  - *Source*: ORIGINAL_REQUEST §R1; PROJECT.md §F5.
  - *Input*: Inspect DOM element `#btnDims` in floating controls.
  - *Expected*: Button exists with text containing `"Kích thước 3D"`, active CSS class applied.
- **TC-COV-F5-03**: *Toggle Layer Off via Sidebar Checkbox*.
  - *Source*: ORIGINAL_REQUEST §R1.
  - *Input*: Click `#chkDimensions` to uncheck (`checked = false`).
  - *Expected*: In Three.js scene, `groupDimensions.visible` evaluates to `false`; all dimension lines and sprites are hidden from render.
- **TC-COV-F5-04**: *Toggle Layer On via Quick Button*.
  - *Source*: ORIGINAL_REQUEST §R1.
  - *Input*: Click `#btnDims` when dimension group is hidden.
  - *Expected*: `groupDimensions.visible` switches to `true`; `#chkDimensions.checked` updates to `true`.
- **TC-COV-F5-05**: *Toggle Idempotence and Memory Stability*.
  - *Source*: Non-regression stability.
  - *Input*: Rapidly toggle dimension visibility 20 times in 1 second.
  - *Expected*: No JS errors thrown; Three.js draw call overhead drops to 0 when disabled and recovers cleanly without memory leaks.

### Feature 6 (F6): Camera-Aligned Billboard Text Sprites
- **TC-COV-F6-01**: *Three.js Sprite Class Verification*.
  - *Source*: ORIGINAL_REQUEST §R1; PROJECT.md §F6.
  - *Input*: Traverse children of `groupDimensions`.
  - *Expected*: Text annotations are instances of `THREE.Sprite` with `THREE.SpriteMaterial` and `THREE.CanvasTexture`.
- **TC-COV-F6-02**: *Zero Camera Rotation Inversion (Billboard Behavior)*.
  - *Source*: ORIGINAL_REQUEST §R1.
  - *Input*: Rotate Three.js camera by $180^\circ$ and $360^\circ$ (orbit controls).
  - *Expected*: Sprites continuously face camera in GPU vertex shader without upside-down text or backward mirroring.
- **TC-COV-F6-03**: *Canvas Supersampling Resolution ($2\times$)*.
  - *Source*: High-DPI legibility requirement.
  - *Input*: Inspect backing canvas element of `sprite.material.map.image`.
  - *Expected*: Canvas width $\ge 256\text{px}$, height $\ge 64\text{px}$, crisp text rasterization with font `JetBrains Mono` or `Inter`.
- **TC-COV-F6-04**: *Dark Slate Pill Capsule Styling*.
  - *Source*: `enterprise-ui-darkslate` directive.
  - *Input*: Verify 2D canvas drawing commands for sprite background.
  - *Expected*: Background color dark slate `rgba(15, 23, 42, 0.90)`, border accent `#38bdf8` or `#3b82f6`, text color `#f8fafc`.
- **TC-COV-F6-05**: *WebGL Stream Ingestion Compatibility*.
  - *Source*: ORIGINAL_REQUEST §R4.
  - *Input*: Capture frame from WebGL canvas via `captureStream()`.
  - *Expected*: Sprites are rendered into the WebGL drawing buffer (unlike HTML DOM overlays) and visible in captured video frames.

### Feature 7 (F7): 4D BIM Player Controls
- **TC-COV-F7-01**: *Player Control Dock DOM Elements Existence*.
  - *Source*: ORIGINAL_REQUEST §R2; PROJECT.md §F7.
  - *Input*: Query DOM for 4D player container (`.player-4d-dock` or `#player4D`).
  - *Expected*: Elements exist: Play/Pause button (`#btnPlay4D`), speed buttons (`1x`, `2x`, `5x`), timeline slider (`#timelineSlider`), day label (`#dayLabel` or `#currentDay`).
- **TC-COV-F7-02**: *Timeline Slider Range and Step*.
  - *Source*: ORIGINAL_REQUEST §R2.
  - *Input*: Inspect attributes of `#timelineSlider`.
  - *Expected*: `min == "1"`, `max == "90"`, `step == "1"`, initial value `"1"`.
- **TC-COV-F7-03**: *Play/Pause Toggle Functionality*.
  - *Source*: ORIGINAL_REQUEST §R2.
  - *Input*: Click `#btnPlay4D`.
  - *Expected*: Button state changes to "Pause" (icon changes to `⏸`); timeline advances automatically; clicking again stops progression.
- **TC-COV-F7-04**: *Speed Multiplier Toggles (1x, 2x, 5x)*.
  - *Source*: ORIGINAL_REQUEST §R2.
  - *Input*: Click speed buttons `2x` and `5x`.
  - *Expected*: Active class updates; internal playback interval adjusts (1x $\approx 1000\text{ms/day}$, 2x $\approx 500\text{ms/day}$, 5x $\approx 200\text{ms/day}$).
- **TC-COV-F7-05**: *Phase Badge Display*.
  - *Source*: ORIGINAL_REQUEST §R2.
  - *Input*: Move slider to Day 5, Day 20, Day 35, Day 55, Day 75, Day 88.
  - *Expected*: Phase badge updates accurately to Phase 1, Phase 2, Phase 3, Phase 4, Phase 5, Phase 6 respectively.

### Feature 8 (F8): 6-Phase Phasing Simulation
- **TC-COV-F8-01**: *Phase 1 (Days 1–10): Site Prep & Green Cofferdam*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 5 (`setTimelineDay(5)`).
  - *Expected*: Culvert, rebar, foundation, and top slab meshes are hidden (`visible = false`); site layout visible.
- **TC-COV-F8-02**: *Phase 2 (Days 11–25): Shoring & Larsen Driving*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 18 (`setTimelineDay(18)`).
  - *Expected*: Larsen sheet piles visible (`groupLarsen.visible = true`); struts visible by Day 25; culvert body still hidden.
- **TC-COV-F8-03**: *Phase 3 (Days 26–45): Excavation & Bamboo Pile Driving*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 35 (`setTimelineDay(35)`).
  - *Expected*: Foundation lean concrete appears; `bambooInstanced.count` increases proportionally ($0 < \text{count} \le 13,042$); culvert body still hidden.
- **TC-COV-F8-04**: *Phase 4 (Days 46–70): Culvert Base, Walls & Joints (3 Segments)*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 55 (`setTimelineDay(55)`).
  - *Expected*: Culvert base and walls for Segment 1 & Segment 2 visible; waterstops V250 visible; top slab remains hidden to inspect interior haunches.
- **TC-COV-F8-05**: *Phase 5 (Days 71–82): Top Slabs, Manholes & Outlet Wingwall*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 78 (`setTimelineDay(78)`).
  - *Expected*: Top slab meshes become visible (`groupTopSlab.visible = true`); 5 manholes CT-01/02 and wingwall visible.
- **TC-COV-F8-06**: *Phase 6 (Days 83–90): Shoring Removal & Larsen Pulling*.
  - *Source*: ORIGINAL_REQUEST §R2; Sheet 04.
  - *Input*: Set timeline to Day 89 (`setTimelineDay(89)`).
  - *Expected*: Struts removed (`groupStruts.visible = false`); Larsen sheet piles retracted/hidden (`groupLarsen.visible = false` or opacity 0); final culvert complete.

### Feature 9 (F9): Interactive Site Diary Dock
- **TC-COV-F9-01**: *Site Diary Dock DOM Structure & 4-Panel Layout*.
  - *Source*: ORIGINAL_REQUEST §R3; PROJECT.md §F9.
  - *Input*: Inspect DOM element `.site-diary-dock` or `#siteDiaryDock`.
  - *Expected*: Contains 4 panels: Panel 1 (Date/Weather), Panel 2 (Workforce/Machinery), Panel 3 (5D Cumulative Volumes), Panel 4 (Safety/Monitoring).
- **TC-COV-F9-02**: *Zero Occlusion with 390px Right Sidebar*.
  - *Source*: `enterprise-ui-darkslate` directive; PROJECT.md §F9.
  - *Input*: Measure CSS computed bounding rect of `.site-diary-dock` and `.sidebar`.
  - *Expected*: `siteDiaryDock.right <= window.innerWidth - 390px` (or style `right: 390px`); zero horizontal overlap with the sidebar at all times.
- **TC-COV-F9-03**: *Collapsible State Toggle (195px <-> 32px)*.
  - *Source*: ORIGINAL_REQUEST §R3; PROJECT.md §Interface Contracts.
  - *Input*: Click toggle collapse button on site diary dock header.
  - *Expected*: Height transitions between $195\text{px} \pm 5\text{px}$ (expanded) and $32\text{px} \pm 5\text{px}$ (collapsed); no layout breakage.
- **TC-COV-F9-04**: *Dark Slate Visual Density Compliance*.
  - *Source*: `enterprise-ui-darkslate` directive.
  - *Input*: Inspect computed CSS colors and font families.
  - *Expected*: Background color `#0f172a` or `#1e293b`; text high contrast `#f8fafc`; numbers styled with monospace font `JetBrains Mono` or `Courier New`.
- **TC-COV-F9-05**: *Safety & Near-Neighbor Monitoring Panel Content*.
  - *Source*: ORIGINAL_REQUEST §R3; Sheet 04 Chapter VI.
  - *Input*: Inspect safety panel text on Day 35.
  - *Expected*: Mentions monitoring at TC1-Cọc 4 (house of Mr. Nguyễn Văn Quyết), displacement pins M1–M3, or gypsum crack stamps.

### Feature 10 (F10): Real-Time Timeline Synchronization
- **TC-COV-F10-01**: *Instantaneous Synchronous Update on Day Change (< 2ms)*.
  - *Source*: ORIGINAL_REQUEST §R3; Acceptance Criteria.
  - *Input*: Change slider value from Day 1 to Day 45; measure execution duration of `renderSiteDiaryDock(45)`.
  - *Expected*: DOM updates in $< 2\text{ms}$ (well within $< 50\text{ms}$ threshold); UI updates immediately.
- **TC-COV-F10-02**: *Weather & Meteorological Conditions Synchronization*.
  - *Source*: ORIGINAL_REQUEST §R3; `SITE_DIARY_SCHEDULE_90_DAYS`.
  - *Input*: Query weather panel at Day 1 and Day 58.
  - *Expected*: Day 1 displays `"24.5°C"` with pleasant weather; Day 58 displays `"32.0°C"` sunny/hot matching HĐ-2026 realistic log.
- **TC-COV-F10-03**: *Workforce & Active Heavy Machinery Synchronization*.
  - *Source*: ORIGINAL_REQUEST §R3.
  - *Input*: Query workforce panel at Day 15 (cừ Larsen) vs Day 58 (bê tông).
  - *Expected*: Day 15 shows piling crew + vibrating hammer/hydraulic press; Day 58 shows concrete crew (28 workers) + concrete pump truck and transit mixers.
- **TC-COV-F10-04**: *5D Cumulative Volumes Synchronization*.
  - *Source*: ORIGINAL_REQUEST §R3; HSMT Grounding.
  - *Input*: Query cumulative metrics at Day 90.
  - *Expected*: Earthwork $= 1,150\text{ m}^3$, Concrete $= 474.9\text{ m}^3$, Steel $= 57.64\text{ tonnes}$, Bamboo $= 13,042\text{ piles}$.
- **TC-COV-F10-05**: *Site Supervisor & Quality Engineer Grounding Verification*.
  - *Source*: HĐ-2026 Legal Ground Truth (MST 0202111150).
  - *Input*: Inspect site personnel card in Site Diary dock.
  - *Expected*: Displays Site Manager `"Nguyễn Văn Hoạt"` and Chief Supervisor `"Phạm Văn Dự"` (TVGS Cường Đạt).

### Feature 11 (F11): Lifetime Video Export
- **TC-COV-F11-01**: *Export Button Existence and Label*.
  - *Source*: ORIGINAL_REQUEST §R4; PROJECT.md §F11.
  - *Input*: Query DOM for `#btnExportVideo` or button with text `"Quay Video Lifetime"`.
  - *Expected*: Element exists and is clickable in the interface.
- **TC-COV-F11-02**: *Canvas captureStream() Availability and Stream Resolution*.
  - *Source*: ORIGINAL_REQUEST §R4.
  - *Input*: Evaluate `typeof canvas.captureStream === 'function'` in browser context.
  - *Expected*: Returns `true`; capture stream active at 30 FPS.
- **TC-COV-F11-03**: *MediaRecorder MIME Type Prioritization*.
  - *Source*: Browser codec compatibility.
  - *Input*: Evaluate `MediaRecorder.isTypeSupported('video/mp4;codecs=avc1')` and `MediaRecorder.isTypeSupported('video/webm;codecs=vp9')`.
  - *Expected*: At least one modern container format is supported.
- **TC-COV-F11-04**: *Export Trigger & Automated Camera Path Sweep*.
  - *Source*: ORIGINAL_REQUEST §R4.
  - *Input*: Trigger `startVideoExport()`; observe timeline progression and camera position.
  - *Expected*: Camera animates smoothly along alignment waypoints while timeline traverses Day 1 to 90.
- **TC-COV-F11-05**: *Valid Video Blob Creation (> 100 KB) and Magic Header Verification*.
  - *Source*: ORIGINAL_REQUEST §R4; Acceptance Criteria.
  - *Input*: Run video export; intercept download event or evaluate resulting Blob object.
  - *Expected*: Blob size $> 100\text{ KB}$; first 4 bytes match WebM header (`1A 45 DF A3`) or MP4 container (`66 74 79 70` `ftyp`).

### Feature 12 (F12): Browser & Regression QA Gate
- **TC-COV-F12-01**: *Zero JavaScript Errors on BIM Page*.
  - *Source*: ORIGINAL_REQUEST Acceptance Criteria.
  - *Input*: Listen to `page.on("pageerror")` and `page.on("console")` during complete load.
  - *Expected*: 0 uncaught exceptions or error-level console messages.
- **TC-COV-F12-02**: *Render Loop Frame Rate (> 30 FPS)*.
  - *Source*: ORIGINAL_REQUEST Acceptance Criteria.
  - *Input*: Measure frame timestamps over 100 consecutive `requestAnimationFrame` cycles.
  - *Expected*: Average FPS $> 30.0$ (target $\ge 50$ FPS).
- **TC-COV-F12-03**: *Backend Static File HTTP 200 OK Delivery*.
  - *Source*: Architecture requirement.
  - *Input*: Request `GET /static/bim/index.html` via HTTP client.
  - *Expected*: HTTP 200 OK; Content-Type contains `text/html`.
- **TC-COV-F12-04**: *Pytest Architecture Boundary Enforcement Passing 100%*.
  - *Source*: `AGENTS.md` Rule 6.
  - *Input*: Execute `pytest tests/test_architecture_boundary_enforcement.py -v`.
  - *Expected*: 5 passed in $< 3\text{s}$ (100% Passed).
- **TC-COV-F12-05**: *Ground Truth Dataset Integrity Gate*.
  - *Source*: `AGENTS.md` Rule 1.
  - *Input*: Execute `pytest tests/test_ong_den_drawing_and_hsmt_grounding.py -v`.
  - *Expected*: 5 passed in $< 3\text{s}$ (100% Passed).

---

## 5. Tier 2: Boundary & Corner Cases (F1 to F12, >=5 Test Cases Each)

### Feature 1 (F1): Boundary & Corner Cases
- **TC-BND-F1-01**: *Zero Viewport Scaling Distortion*.
  - *Input*: Viewport resized to extreme aspect ratio $3440 \times 600$ (ultra-wide) and $600 \times 1200$ (ultra-narrow).
  - *Expected*: Cross-section dimension sprites maintain constant pixel font size; no text clipping.
- **TC-BND-F1-02**: *Near-Clipping Plane Intersection*.
  - *Input*: Camera zoomed in to distance $< 0.1\text{m}$ from culvert wall dimension.
  - *Expected*: Sprite material handles depth sorting cleanly; no black z-fighting artifacts.
- **TC-BND-F1-03**: *Far-Clipping Plane Visibility*.
  - *Input*: Camera zoomed out to maximum orbit distance ($500\text{m}$).
  - *Expected*: Dimension lines do not flicker or vanish before camera far plane ($2000\text{m}$).
- **TC-BND-F1-04**: *Station s = 0.0m Inlet Boundary Callout*.
  - *Input*: Check dimension geometry at exact start station $s = 0.000\text{m}$.
  - *Expected*: Normal vector $\vec{n}$ and tangent $\vec{t}$ properly evaluated without NaN or division by zero.
- **TC-BND-F1-05**: *Station s = 146.46m Outlet Boundary Callout*.
  - *Input*: Check dimension geometry at exact end station $s = 146.460\text{m}$.
  - *Expected*: Clamped correctly at terminal alignment without array overflow.

### Feature 2 (F2): Boundary & Corner Cases
- **TC-BND-F2-01**: *Zero Width Tolerance at Foundation Edge*.
  - *Input*: Compare coordinate delta $\|(u = 1.7) - (u = -1.7)\|$ against $3.40\text{m}$.
  - *Expected*: Deviation $< 0.001\text{m}$.
- **TC-BND-F2-02**: *Larsen Sheet Pile Opacity at 0% and 100%*.
  - *Input*: Move Larsen opacity slider to 0% and 100%.
  - *Expected*: Material opacity updates without error; dimension lines remain visible even if shoring is 0% opacity.
- **TC-BND-F2-03**: *Rapid Shoring Toggle During Navigation*.
  - *Input*: Toggle shoring layer while OrbitControls is in active mouse drag.
  - *Expected*: No matrix calculation crash in animation loop.
- **TC-BND-F2-04**: *Negative Elevation Coordinates Handling*.
  - *Input*: Foundation bottom at $y = -0.20\text{m}$ and pile tips at $y = -2.70\text{m}$.
  - *Expected*: Dimension extension lines correctly span negative Y coordinates.
- **TC-BND-F2-05**: *Skewed Shoring Row Alignment*.
  - *Input*: Inspect Larsen alignment along curved segment $s \in [75.60, 97.62\text{m}]$.
  - *Expected*: Shoring follows concentric offset arc with radius $R \pm 1.8\text{m}$ smoothly.

### Feature 3 (F3): Boundary & Corner Cases
- **TC-BND-F3-01**: *Bamboo Pile InstancedMesh Count = 0*.
  - *Input*: Day 1 state where pile driving has not started.
  - *Expected*: `bambooInstanced.count = 0`; GPU draws 0 instances with zero error.
- **TC-BND-F3-02**: *Bamboo Pile InstancedMesh Count = Maximum (13,042)*.
  - *Input*: Day 45 state where pile driving is 100% complete.
  - *Expected*: `bambooInstanced.count = 13042`; instance buffer does not overrun allocated capacity.
- **TC-BND-F3-03**: *Non-Integer Pile Progress Interpolation*.
  - *Input*: Arbitrary progress float e.g. Day 31.42.
  - *Expected*: `Math.floor()` applied to count; integer passed to `count`.
- **TC-BND-F3-04**: *Strut Pitch Irregularity at Curved Section*.
  - *Input*: Strut positions around $R=25\text{m}$ curve.
  - *Expected*: Strut orientations remain orthogonal to centerline normal vector.
- **TC-BND-F3-05**: *Rapid Strut Mesh Visibility Toggling*.
  - *Input*: Toggle `#chkStruts` repeatedly during Day 85 shoring pull.
  - *Expected*: No race condition in scene visibility tree.

### Feature 4 (F4): Boundary & Corner Cases
- **TC-BND-F4-01**: *Exact Boundary Station s = 50.0m Joint 1*.
  - *Input*: Query station alignment at $s = 50.0000\text{m}$.
  - *Expected*: Evaluates Segment 1 end and Joint 1 position seamlessly.
- **TC-BND-F4-02**: *Exact Boundary Station s = 101.46m Joint 2*.
  - *Input*: Query station alignment at $s = 101.4600\text{m}$.
  - *Expected*: Evaluates Segment 2 end and Joint 2 position seamlessly.
- **TC-BND-F4-03**: *Curved Polyline Segment 2 Discretization*.
  - *Input*: Polyline sampling along $L = 51.46\text{m}$ curve.
  - *Expected*: Sampled with $\ge 50$ interpolation vertices to ensure smooth curve representation.
- **TC-BND-F4-04**: *Expansion Joint Mesh Thickness (80mm)*.
  - *Input*: Inspect V250 waterstop mesh thickness along $s$.
  - *Expected*: Mesh thickness is $0.08\text{m}$ centered at $s = 50.0\text{m}$ and $s = 101.46\text{m}$.
- **TC-BND-F4-05**: *Sum of Segment Lengths vs Total Alignment*.
  - *Input*: Compute $50.00 + 51.46 + 45.00$.
  - *Expected*: Equals exactly $146.46\text{m}$ with zero floating point drift.

### Feature 5 (F5): Boundary & Corner Cases
- **TC-BND-F5-01**: *Rapid Consecutive Toggles (Double-Click)*.
  - *Input*: Send double click event to `#chkDimensions` within $50\text{ms}$.
  - *Expected*: Final visibility state matches final checkbox checked state.
- **TC-BND-F5-02**: *Page Reload Persistence Check*.
  - *Input*: Refresh page after toggling dimension layer.
  - *Expected*: Default initial layer state restores cleanly without cached DOM inconsistency.
- **TC-BND-F5-03**: *Concurrent Layer Toggle and Camera View Preset*.
  - *Input*: Click preset "Mặt cắt cống" simultaneously with `#btnDims`.
  - *Expected*: Camera animates to preset view and dimensions render at targeted view without visual artifacts.
- **TC-BND-F5-04**: *DOM Checkbox Synchronized with Quick Button*.
  - *Input*: Click `#btnDims` in toolbar; check `#chkDimensions` in sidebar.
  - *Expected*: Checkbox checked property mirrors quick button active state.
- **TC-BND-F5-05**: *Headless Background Execution*.
  - *Input*: Toggle layers while browser tab is inactive / minimized.
  - *Expected*: State changes correctly in Three.js scene graph.

### Feature 6 (F6): Boundary & Corner Cases
- **TC-BND-F6-01**: *Camera Looking Directly Downward (+Y Gimbal Lock)*.
  - *Input*: Camera set to `(0, 100, 0)`, looking at `(0, 0, 0)` with up vector `(0, 0, -1)`.
  - *Expected*: Billboard sprites orient smoothly without tumbling or NaN transformation.
- **TC-BND-F6-02**: *Extreme High-DPI DevicePixelRatio (dpr = 3.0)*.
  - *Input*: Emulate Retina/4K mobile screen with `devicePixelRatio = 3`.
  - *Expected*: Text sprites remain sharp without memory overflow.
- **TC-BND-F6-03**: *Empty or Null Label String Handling*.
  - *Input*: Call `createDimensionSprite("")` or `createDimensionSprite(null)`.
  - *Expected*: Gracefully returns empty sprite or fallback label without throwing exception.
- **TC-BND-F6-04**: *Very Long Text Label Handling*.
  - *Input*: Call `createDimensionSprite("Kích thước thông thủy cống hộp 2.5m x 2.5m thi công theo tiêu chuẩn TCVN")`.
  - *Expected*: Canvas dynamically measures text width with `ctx.measureText` and expands width without clipping.
- **TC-BND-F6-05**: *Context Loss and WebGL Restoration*.
  - *Input*: Trigger WebGL context loss event and restore.
  - *Expected*: Canvas textures rebind without permanent white blank sprites.

### Feature 7 (F7): Boundary & Corner Cases
- **TC-BND-F7-01**: *Boundary Day 1 (Minimum Day)*.
  - *Input*: Set `#timelineSlider` value to `1` or call `setTimelineDay(1)`.
  - *Expected*: Slider clamped to 1; displays Day 1 metrics; previous day button disabled.
- **TC-BND-F7-02**: *Boundary Day 90 (Maximum Day)*.
  - *Input*: Set `#timelineSlider` value to `90` or call `setTimelineDay(90)`.
  - *Expected*: Slider clamped to 90; displays Day 90 completed metrics; next day button disabled; playback pauses upon reaching Day 90.
- **TC-BND-F7-03**: *Out of Bounds Input (< 1 or > 90)*.
  - *Input*: Execute `setTimelineDay(0)` and `setTimelineDay(99)`.
  - *Expected*: Clamped automatically to `1` and `90` respectively without index errors.
- **TC-BND-F7-04**: *Rapid Scrubbing (100 events per second)*.
  - *Input*: Fire `input` events on `#timelineSlider` across days 1–90 continuously.
  - *Expected*: No dropped frames, no audio/video glitches, memory usage remains flat.
- **TC-BND-F7-05**: *Switching Speed Multipliers While Playing*.
  - *Input*: Toggle from 1x to 5x then 2x while `isPlaying == true`.
  - *Expected*: Playback interval updates seamlessly without double timer loops or skipping days.

### Feature 8 (F8): Boundary & Corner Cases
- **TC-BND-F8-01**: *Phase Transition Boundary: Day 10 to Day 11*.
  - *Input*: Advance from Day 10 to Day 11.
  - *Expected*: Transition from Phase 1 to Phase 2; Larsen sheet piles begin emergence; phase badge updates.
- **TC-BND-F8-02**: *Phase Transition Boundary: Day 25 to Day 26*.
  - *Input*: Advance from Day 25 to Day 26.
  - *Expected*: Transition from Phase 2 to Phase 3; excavation level active; bamboo piles begin driving.
- **TC-BND-F8-03**: *Phase Transition Boundary: Day 45 to Day 46*.
  - *Input*: Advance from Day 45 to Day 46.
  - *Expected*: Transition from Phase 3 to Phase 4; rebar and culvert base/walls appear; top slab still hidden.
- **TC-BND-F8-04**: *Phase Transition Boundary: Day 70 to Day 71*.
  - *Input*: Advance from Day 70 to Day 71.
  - *Expected*: Transition from Phase 4 to Phase 5; top slabs and manholes appear.
- **TC-BND-F8-05**: *Phase Transition Boundary: Day 82 to Day 83*.
  - *Input*: Advance from Day 82 to Day 83.
  - *Expected*: Transition from Phase 5 to Phase 6; strut disassembly begins; Larsen pulling begins.

### Feature 9 (F9): Boundary & Corner Cases
- **TC-BND-F9-01**: *Narrow Viewport Resize (Tablet / Small Desktop 1024px)*.
  - *Input*: Set browser width to $1024\text{px}$.
  - *Expected*: Site diary dock maintains `right: 390px`, width adjusts responsively ($634\text{px}$); panels wrap or scroll horizontally without overflowing into sidebar.
- **TC-BND-F9-02**: *Ultra-Wide Viewport Resize (2560px)*.
  - *Input*: Set browser width to $2560\text{px}$.
  - *Expected*: Site diary dock expands cleanly, max-width or flex distribution remains aesthetically balanced.
- **TC-BND-F9-03**: *Repeated Collapse/Expand Cycling*.
  - *Input*: Click dock collapse toggle 50 times in rapid succession.
  - *Expected*: Smooth CSS transition, no DOM detaching, no height calculation desync.
- **TC-BND-F9-04**: *Text Overflow in Weather or Notes*.
  - *Input*: Feed extra-long safety note text string.
  - *Expected*: Text wraps or ellipses cleanly; no horizontal page scrollbar created.
- **TC-BND-F9-05**: *Zero Touch / Mouse Event Propagation to 3D OrbitControls*.
  - *Input*: Click and drag mouse inside Site Diary dock.
  - *Expected*: Clicks inside dock do not rotate 3D camera (proper `e.stopPropagation()` on dock element).

### Feature 10 (F10): Boundary & Corner Cases
- **TC-BND-F10-01**: *Fast Reverse Scrubbing (Day 90 to Day 1)*.
  - *Input*: Drag timeline slider backwards from Day 90 to Day 1 in one drag gesture.
  - *Expected*: Metrics decrease monotonically back to baseline; 3D components hide in reverse sequence.
- **TC-BND-F10-02**: *Leap Day / Calendar Date Integrity*.
  - *Input*: Inspect calendar dates from 01/03/2026 to 29/05/2026.
  - *Expected*: All 90 date strings formatted strictly as `DD/MM/YYYY`; March has 31 days, April has 30 days, May has 29 days.
- **TC-BND-F10-03**: *Zero Values at Day 1*.
  - *Input*: Query cumulative concrete, steel, piles at Day 1.
  - *Expected*: All structural cumulative volumes equal `0.0`.
- **TC-BND-F10-04**: *Exact Match at Day 90 to BoQ Contract Totals*.
  - *Input*: Query cumulative metrics at Day 90.
  - *Expected*: Values match contract BoQ: `474.90 m³` concrete, `57.64 Tấn` steel, `13,042 cọc` tre.
- **TC-BND-F10-05**: *Missing Day Data Fallback*.
  - *Input*: Call `renderSiteDiaryDock(undefined)` or `renderSiteDiaryDock(NaN)`.
  - *Expected*: Safely defaults to Day 1 without throwing unhandled exception.

### Feature 11 (F11): Boundary & Corner Cases
- **TC-BND-F11-01**: *Unsupported Codec Graceful Degradation*.
  - *Input*: Mock `MediaRecorder.isTypeSupported('video/mp4;codecs=avc1')` returning `false`.
  - *Expected*: Falls back automatically to `video/webm;codecs=vp9`, then `video/webm`.
- **TC-BND-F11-02**: *Immediate Cancellation / Abortion of Recording*.
  - *Input*: Trigger recording and immediately navigate away or click stop.
  - *Expected*: `mediaRecorder.stop()` called cleanly; memory buffers released; no dangling streams.
- **TC-BND-F11-03**: *Low Memory / Constrained Canvas Buffer*.
  - *Input*: Export video on device with limited VRAM.
  - *Expected*: Full HD $1920 \times 1080$ buffer allocations handled cleanly without WebGL context loss.
- **TC-BND-F11-04**: *Zero Blank Frames via `preserveDrawingBuffer`*.
  - *Input*: Record stream while WebGL draws frames.
  - *Expected*: Recorded frames contain non-black pixel data (verified by sampling video buffer).
- **TC-BND-F11-05**: *Blob Download Header and Extension Validation*.
  - *Input*: Verify created download link filename.
  - *Expected*: Download filename has extension matching selected MIME type (`.mp4` or `.webm`).

### Feature 12 (F12): Boundary & Corner Cases
- **TC-BND-F12-01**: *Offline / Zero Network Connection Resiliency*.
  - *Input*: Load `/static/bim/index.html` with network disconnected.
  - *Expected*: Local Three.js (`three.min.js`) and OrbitControls (`OrbitControls.js`) load offline without CDN failure.
- **TC-BND-F12-02**: *Zero CSP Violations in Console*.
  - *Input*: Inspect console for `Content-Security-Policy` warnings.
  - *Expected*: Zero CSP errors; blob URL creation permitted.
- **TC-BND-F12-03**: *Maximum Concurrency on Static File Delivery*.
  - *Input*: Send 50 concurrent HTTP requests to `/static/bim/index.html`.
  - *Expected*: All 50 return HTTP 200 OK with identical ETag.
- **TC-BND-F12-04**: *Memory Growth During Continuous 10-Minute Playback*.
  - *Input*: Run 4D simulation loop for 10 minutes continuously at 5x speed.
  - *Expected*: Heap memory consumption remains stable ($< 150\text{ MB}$ variation); zero memory leaks.
- **TC-BND-F12-05**: *Pytest Execution Under Strict Warning Flags*.
  - *Input*: Run `pytest -W error::DeprecationWarning tests/test_architecture_boundary_enforcement.py`.
  - *Expected*: Zero unhandled deprecation warnings or failures.

---

## 6. Tier 3: Cross-Feature Combinations (Pairwise & Multi-Way Interactions)

| Test ID | Features Combined | Interaction Specification | Expected Result |
| :--- | :--- | :--- | :--- |
| **TC-XF-01** | F5 (Toggle Dimensions) + F7 (Timeline Scrubbing) | Toggle dimensions OFF, scrub timeline Day 1 $\to$ 90, toggle dimensions ON. | Dimensions remain hidden during scrubbing, reappear instantly on toggle with correct station coordinates. |
| **TC-XF-02** | F7 (5x Speed) + F10 (Real-Time Diary Sync) | Play simulation at 5x speed (200ms per day). | Diary dock panels update smoothly at 5 Hz without UI stutter, text lag, or DOM queue blockage. |
| **TC-XF-03** | F8 (Phase 3 Bamboo) + F3 (Bamboo Density Callout) | Scrub through Days 28–38 (active pile driving). | InstancedMesh count increments in lockstep with cumulative pile count shown on Site Diary and callout sprite. |
| **TC-XF-04** | F8 (Phase 2 Shoring) + F2 (Larsen Clearance Callout) | Observe Day 15 when Larsen sheet piles are driven down. | 200mm clearance annotation correctly points from culvert envelope to the Larsen sheet pile face in 3D. |
| **TC-XF-05** | F9 (Dock Collapse) + F7 (Player Controls Positioning) | Click collapse toggle on Site Diary dock. | 4D BIM player controls bar drops smoothly to `bottom: 48px`, maintaining perfect vertical rhythm and zero overlap. |
| **TC-XF-06** | F11 (Video Export) + F6 (Billboard Sprites in WebGL) | Record video while dimension layer is visible. | Billboard sprites are burned directly into the 1080p canvas stream, crisp and legible in the resulting video. |
| **TC-XF-07** | F11 (Video Export) + F8 (Full 90-Day Simulation Sweep) | Trigger "Quay Video Lifetime" export button. | Timeline advances 1 $\to$ 90 while camera sweeps along 6 alignment waypoints; finishes with complete lifecycle video. |
| **TC-XF-08** | F5 (Layer Toggle) + F11 (Video Export during Toggle) | Toggle layers (Rebar, Site, Dimensions) during an active recording run. | Video stream records the dynamic transition without frame stutter or encoder failure. |
| **TC-XF-09** | F9 (Sidebar 390px) + F9 (Site Diary Dock Right Margin) | Open BIM 5D Inspector on sidebar; resize window from 1920px to 1280px. | Dock right edge stays fixed at `390px`; Inspector panel and Site Diary dock never intersect. |
| **TC-XF-10** | F8 (Phase 6 Pull Larsen) + F2 (Shoring Dimensions) | Advance timeline to Day 88 (pulling Larsen piles). | As Larsen piles retract and disappear, shoring dimensions hide or fade gracefully with the layer. |
| **TC-XF-11** | F7 (Scrub to Day 50) + F4 (Joint 1 Inspection) | Jump to Day 50 (Segment 1 completion) and click "Chi tiết Cốt Thép". | Joint 1 (V250) and Segment 1 ($50.0\text{m}$) dimension callouts align directly with the active construction head. |
| **TC-XF-12** | F1 (Cross-Section Dims) + F6 (Camera 360° Rotation) | Set preset to "Mặt cắt cống", perform full orbit rotation around culvert portal. | $2.5\times2.5\text{m}$ clearance and $250\text{mm}$ thickness text sprites remain right-reading from all angles. |
| **TC-XF-13** | F10 (Diary Sync) + F12 (Performance > 30 FPS while Scrubbing) | Drag timeline slider vigorously while measuring instantaneous FPS. | Render loop FPS remains $\ge 30$ FPS (no GC stalls during continuous DOM updates). |
| **TC-XF-14** | F11 (Video Export) + F12 (Zero Console Errors During Export) | Monitor browser console during entire video export cycle. | Zero uncaught promises, zero WebGL warnings, zero MediaRecorder errors. |
| **TC-XF-15** | F9 (Dock Expansion) + F12 (Layout Compliance Zero Occlusion) | Verify DOM bounding box coordinates on automated Playwright run. | Bounding box intersection check between `.site-diary-dock` and `.sidebar` returns `null` (zero overlap). |

---

## 7. Tier 4: Real-World Construction Workflows (5 End-to-End Scenarios)

### Workflow 1 (TC-SCEN-01): Investor & Public Client Executive Presentation
- **Persona**: Ban Lãnh Đạo Công ty TNHH Xây Dựng Định Sơn presenting to Trung tâm DV Sự Nghiệp Công Xã Kiến Minh.
- **Workflow Steps**:
  1. Open `/static/bim/index.html` on high-resolution display.
  2. Switch to "Bình đồ (Sheet 03)" preset; verify $L = 146.46\text{m}$ overall dimension and 3 segments ($50.0\text{m}, 51.46\text{m}, 45.0\text{m}$).
  3. Start 4D player at 2x speed; allow automated playback from Day 1 to Day 90.
  4. Observe synchronized 5D cumulative volumes matching contract value 6,482,295,000 VND and HSMT items.
  5. Click "Quay Video Lifetime"; download generated 1080p video file to verify client deliverable readiness.
- **Expected Outcome**: Flawless visual simulation with verified contract grounding, zero UI stutter, and export of a high-quality video file.

### Workflow 2 (TC-SCEN-02): Safety & Neighbor House Protection Protocol at TC1–Cọc 4
- **Persona**: Site Manager Nguyễn Văn Hoạt & Safety Inspector.
- **Workflow Steps**:
  1. Scrub timeline directly to Phase 3 (Day 35: Excavation and Bamboo Piling).
  2. Inspect Site Diary Panel 4: Safety & Monitoring notes.
  3. Verify documented safety protocol: Proximity to Mr. Nguyễn Văn Quyết's house ($0.65\text{m}$ clearance), displacement pins M1–M3, allowable settlement $S \le 2.0\text{mm}$, short-span manual excavation ($4\text{m}$ bays), immediate lean concrete placement.
  4. Inspect 3D model around TC1–Cọc 4: Verify shoring wall, reduced strut pitch, and surrounding house model blocks (`groupSite`).
- **Expected Outcome**: Safety-critical construction constraints are visually and textually grounded in actual field conditions.

### Workflow 3 (TC-SCEN-03): Quality Assurance Handover for Waterstop Joints V250
- **Persona**: QA/QC Engineer Bùi Văn Định & TVGS Cường Đạt (Phạm Văn Dự).
- **Workflow Steps**:
  1. Navigate timeline to Day 48 (Phase 4 rebar and joint installation).
  2. Inspect 3D dimension callouts at Joint 1 ($s = 50.0\text{m}$) and Joint 2 ($s = 101.46\text{m}$).
  3. Verify V250 rubber waterstop meshes and bitumen felt expansion gap ($80\text{mm}$ thickness).
  4. Check Site Diary supervisor notes: Confirmation of waterstop alignment inspection and M250 test cube sampling.
- **Expected Outcome**: Structural continuity and waterproofing standards verified against drawing Sheet 09 and TCVN 9346.

### Workflow 4 (TC-SCEN-04): Subcontractor Transition & Machinery Logistics Coordination
- **Persona**: Construction Superintendent coordinating multiple trades.
- **Workflow Steps**:
  1. Jump between Phase 2 (Day 20), Phase 3 (Day 35), and Phase 4 (Day 60).
  2. Inspect Panel 2 of Site Diary Dock across each phase.
  3. Verify machinery handover:
     - Phase 2: Hydraulic static pile press + 60kW vibrating hammer + 2 submersible pumps.
     - Phase 3: Mini excavator with bamboo pile clamp + Mikasa tampers + 350L mixers.
     - Phase 4: Boom pump truck + 3 transit mixers ($7\text{m}^3$) + needle vibrators.
  4. Confirm trade workforce changes from 14 piling specialists to 22 earthwork/bamboo workers, then 28 rebar/formwork/concrete workers.
- **Expected Outcome**: Accurate resource allocation schedule reflected in real-time diary dock.

### Workflow 5 (TC-SCEN-05): Storm Season Emergency Cofferdam & Siphon Trench Diversion
- **Persona**: Emergency Response Team during adverse weather in early March.
- **Workflow Steps**:
  1. Navigate to Phase 1 (Days 1–10).
  2. Verify cofferdam and bypass canal visualization.
  3. Inspect meteorological parameters in Panel 1: Northeast monsoon level 2, temperature $24.5^\circ\text{C}$, pump dewatering status.
  4. Verify cofferdam integrity checks and flood diversion safety protocols.
- **Expected Outcome**: Environmental resilience measures clearly represented during the vulnerable foundation phase.

---

## 8. Test Automation Implementation Mapping

The automated testing script `tools/verification/test_ong_den_4d_bim_and_video_export.py` maps directly to this 4-tier matrix:
- **Check 1**: HTTP 200 live navigation (`TC-COV-F12-03`).
- **Check 2**: Zero console errors & exceptions (`TC-COV-F12-01`).
- **Check 3**: Performance render loop $> 30$ FPS (`TC-COV-F12-02`).
- **Check 4**: 3D Dimension annotations & billboard sprites (`F1` to `F6`, `TC-COV-F1-01` to `TC-COV-F6-05`).
- **Check 5**: 4D BIM player controls & timeline slider (`F7`, `F8`, `TC-COV-F7-01` to `TC-COV-F8-06`).
- **Check 6**: Site Diary collapsible dock with zero sidebar occlusion (`F9`, `F10`, `TC-COV-F9-01` to `TC-COV-F10-05`).
- **Check 7**: Lifetime video export trigger & blob verification (`F11`, `TC-COV-F11-01` to `TC-COV-F11-05`).
- **Check 8**: Backend regression gate (`TC-COV-F12-04`, `TC-COV-F12-05`).
