Codex review — Kế hoạch nháp UI v0 / Sửa rẻ
Codex review — Kế hoạch nháp UI v0 / Sửa rẻ
Date: 2026-07-06
Agent: Codex
Scope: Review only. No DB write, no DDL, no Nuxt edit. Production checks were read-only SELECT/GET, except no mutation DOT was executed.
Verdict: HOLD
One-line reason: GĐ1 is feasible and worth doing, but the plan cannot run as written because seed JS files are not present/verified, the proposed PK shape is risky for existing table molds, and the required custom writable PG-table DOT/rollback is not already available.
Report local: knowledge/current-state/reports/ui-v0-plan-field-review-2026-07-06.md.
Report canonical review path: knowledge/dev/laws-new/kestra/sua-re/nhap-ui/codex-review-ke-hoach-nhap-ui-v0-rev2.md.
Key conclusions:
- Production PG is
directuson PostgreSQL 16.13. - Proposed tables
sua_re_khai_niem_nhapandsua_re_ui_khai_niem_nhapdo not exist yet. table_registryhas 28 rows; 2 rows still useview_sql/view_namefor report snapshots (tbl_report_home,tbl_report_pg)./reports,/reports/report-pg,/reports/report-loaireturned HTTP 200.dot-verify-loai-reportended withDOT_VERIFIED: PASS.- Existing species include
catalog,collection,page,table_ui,task,workflow,workflow_step, andSPE-NVS; do not create a new workflow species. species_collection_maplacks a composite unique guard and already has duplicatepivot_result/pivot_results = 2, so idempotency must be DOT/readback enforced.- Seed files
concept-ledger.js,ui-contracts.js,verify-contracts.jswere not found locally and not retrieved from KB search; the claimed 13/30 migration is not verified. - Production has reusable molds not present in local checkout:
dot-report-publish,dot-list-publish,dot-collection-track-readonly,dot-verify-loai-report.
Minimal new DOTs required for PG-only GĐ1:
dot-sua-re-nhap-ui-v0-ensure— Cấp B: create/ensure the two draft tables, constraints, indexes, timestamps, and allowlisted rollback.dot-sua-re-nhap-ui-v0-import— Cấp B: import seed/scans idempotently and enforce current-scan flow.dot-sua-re-nhap-ui-v0-verify— Cấp A: read-only verification paired to both DOT-Bs; prints row counts, distinct dedupe counts, match-status counts, current-scan invariant output, and sample rows.
Reuse in GĐ2 only after GĐ1 passes:
dot-collection-track-readonlyfor existing PG tables that need Directus read-only serving.dot-list-publishfor live/reports/report-*list pages.dot-report-publishonly forv_report_*snapshot reports.dot-species-maponly after species choice; recommended concept catalog =catalog, usage ledger = defer orcatalog, notworkflow, nottable_uiunless it is truly table UI config.
Recommended schema correction:
- Use
id bigserial primary keyin both tables for Directus/SharedDirectusTable compatibility. - Use
concept_key text uniqueinstead ofconcept_id varchar PK. - Use
item_key text uniquefor idempotent usage import. - Rename
loaitoconcept_kindto avoid confusion withentity_species. - Keep
purpose NOT NULL CHECK (length(trim(purpose)) >= 15)anddedupe_key NOT NULL. - Keep no scan table in v0 only if DOT import transaction verifies that each
ui_idhas at most one currentscan_id; otherwise add a scan table.
Final verdict: HOLD execution as written. PASS_TO_GD1 only after the seed source is frozen and the minimal DOT-A/B pair exists.