Commit Graph

115 Commits

Author SHA1 Message Date
21ee36390e [CLAUDE] Docs+Skill: chốt Session 16 wrap-up — drastic refactor flat workflow (Chunk D)
Session 16 (2026-05-08) docs/skill/memory wrap-up:

STATUS.md:
- Last updated Session 16 (2 commit Chunk A+B)
- Phase summary count (20→21 mig, 96→77 test, 57→55 bảng)
- Recently Done row Session 16 chi tiết (drastic refactor hoàn tất)
- Phase enum simplified semantic post-Mig 21

HANDOFF.md:
- TL;DR Session 16 prepend với 2 chunk + Chunk C SKIP rationale
- Per-chunk implementation chi tiết (Domain + Mig 21 + Service + Tests
  + FE Designer)
- 8 cảnh báo Session 17+: UAT live test / old data migration / Sample
  seed / Budget N-stage / schema-diagram / skill refresh / tests flat /
  Hard blockers Ops

migration-todos.md: Phase 9 + Session 16 block 2 chunk done + 7 defer task

Session log NEW `2026-05-08-0500-drastic-refactor-flat-workflow.md`:
- Bối cảnh resume từ S15 defer
- Spec implementation (Phase enum, state machine, schema Mig 21)
- Per-chunk Chunk A + Chunk B detail
- Chunk C skip rationale
- Memory `feedback_drastic_refactor_scope` validation:
  scope estimate 30% accurate (3h actual vs 10h conservative)
- Plan organization sau S16

Skill ef-core-migration:
- description + heading: 20→21 migration
- + Mig 21 row "RefactorWorkflowToFlatModel" với detail (4 ALTER + 2
  ALTER + DROP TABLE × 2 + DROP COLUMN × 2 + restore simple unique × 2)
- Total 57→55 bảng (-2 InnerStep tables)
- Tests: 96→77 (drop 19 legacy)

CLAUDE.md root:
- Migration count 20→21
- DB tables 57→55
- Workflow flat description thay N-stage description

docs/rules.md §7: 96→77 test (Mig 21 simplified)

Memory `project_solution_erp.md`:
- Add "Tổng sau session 16" block với drastic refactor details

🎉 Session 16 wrap-up. Cumulative since session start (S15 wrap-up
`38d10b7`): 4 commit (S15 wrap-up was final S15) + 3 commit Session 16
(A `dbb0089` + B `88a5be1` + D current).

Defer Session 17+ priority:
1. UAT live test workflow flat (3 phòng × N cấp realistic)
2. Old PE/HĐ legacy phase data migration
3. Sample data seed (Task 2 carry-over)
4. Hard blockers Ops

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:16:32 +07:00
38d10b7897 [CLAUDE] Docs: chốt Session 15 wrap-up — tooltip diagnose + drastic refactor DEFER
Session 15 (2026-05-07) docs update:

STATUS.md:
- Last updated Session 15 (1 commit `835cc7f` tooltip + working tree
  drastic refactor revert)
- Recently Done row Session 15 chi tiết (diagnose + plan drastic +
  attempt 12 file edits + REVERT decision)

HANDOFF.md:
- TL;DR Session 15 prepend với 2 phần: Diagnose tooltip + Drastic
  refactor DEFER decision
- 4 cảnh báo Session 16+: Drastic refactor pending (8-10h dedicated
  hoặc fallback Approach Y), Task 2 sample seed pending, schema-diagram
  defer cron audit, Hard blockers giữ nguyên

migration-todos.md:
- Phase 9 + Session 15 block với 1 task done (tooltip) + 1 defer
  (drastic refactor) + memory entry note
- Defer Session 16+ list

Session log NEW `2026-05-07-2600-tooltip-defer-drastic.md`:
- Bối cảnh user UAT báo button silent disabled
- Phần 1 — Diagnose tooltip (root cause + fix UX + "trùng ID" KHÔNG
  phải bug FE)
- Phần 2 — Plan drastic refactor flat workflow → DEFER:
  * User spec mới (Phòng × Cấp × Users[] flat)
  * Plan 6 chunk + estimate scope realistic ~8-10h
  * Attempt 12 file working tree edits → REVERT decision
  * Memory entry capture decision rule
- Plan organization sau S15 (defer queue)

Memory entry NEW `feedback_drastic_refactor_scope.md`:
- Quy tắc: drastic refactor cần dedicated session, scope conservative
  2x buffer
- Anti-patterns mid-session big refactor + commit broken state
- Defer pattern (revert working tree → document → memory entry → surface
  trade-off cho user)
- Cross-ref `feedback_per_chunk_commit.md` discipline

🎉 Session 15 wrap-up. Cumulative since session start (13h17): 16 commit
(1 button removal + 6 PE N-stage + 5 Contract N-stage + 1 3-button +
1 Session 14 wrap-up + 1 tooltip + 1 Session 15 wrap-up).

Verify: dotnet test 96 pass + working tree clean.

Defer Session 16+ priority order:
1. Drastic refactor flat workflow (dedicated session ~8-10h)
   OR fallback Approach Y (FE flat UI 5 phòng, 1-2h)
2. Task 2 sample data seed N-stage
3. Hard blockers Ops (UAT, SMTP, etc.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:03:56 +07:00
7c83ac8f17 [CLAUDE] Docs+Skill: chốt Session 14 wrap-up — PE 3-button workflow + Task 2 defer
Session 14 (2026-05-07) docs/skill update:

STATUS.md:
- Last updated + Phase summary count (95→96 test, 20 mig, 57 bảng, 41 gotcha)
- Recently Done row Session 14 chi tiết (3-button + Task 2 in-progress + DesignTime/Runtime DB gotcha)

HANDOFF.md:
- TL;DR Session 14 prepend với 1 commit + Task 2 defer
- 5 cảnh báo Session 15+: TraLai phase orphan / Task 2 sample seed / DesignTime
  vs Runtime DB / Budget N-stage defer / schema-diagram §17-19 defer

migration-todos.md: Phase 9 + Session 14 block 4 sub-task done + 2 defer task

Session log NEW `2026-05-07-2500-3-button-workflow.md`:
- Bối cảnh + spec 3-button (Duyệt/Trả lại/Từ chối) + implementation chi tiết
  (Domain policy expand + Service tách reject + FE button + dialog warning)
- Tests update (95→96 với +1 NEW Reject_To_TuChoi_Locks_Permanently)
- Task 2 in-progress: DesignTime vs Runtime DB gotcha + API exit 255 sớm
- Plan organization sau S14

Skill ef-core-migration:
- description + heading: 17→20 migration
- Bảng migration history thêm Mig 18-19 (PE) + Mig 20 (Contract)
- Section MỚI "N-stage workflow pattern (Mig 18-20)" — architecture decision
  với filtered unique trick + per-module migration packaging guideline
- Phase 8 update: 83→96 test breakdown

Skill contract-workflow:
- Section MỚI "Phase 9+ done (Mig 18-20 — Session 12/13/14)":
  * N-stage workflow PE + Contract (entity + filtered unique split + service
    refactor + tests + FE Designer + UsersPage cấp + API)
  * PE 3-button approval (Duyệt/Trả lại/Từ chối) Session 14
  * Defer: Budget N-stage / Phase TraLai=98 orphan

CLAUDE.md root: 16→20 migration + 55→57 bảng + 83→96 test
docs/rules.md §7: Phase 9 active 83→96 test

Verify: dotnet test 96 pass + npm build (skip — pure docs/skill update).

🎉 Session 14 wrap-up complete. Pushed 1 task (3-button) + Task 2 defer.
Cumulative since session start (13h17): 13 commit (1 button removal +
6 PE N-stage Chunk A-F + 5 Contract N-stage Chunk A,B,C,D,F + 1 3-button).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 19:40:00 +07:00
b06bdce694 [CLAUDE] FE-Admin+Docs: Contract workflow N-stage Designer mirror PE + Docs (Chunk F)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m3s
FE Admin WorkflowsPage Designer extend mirror PeWorkflowsPage:
- Type InnerStepDto + extend StepDto +innerSteps
- Type EditInnerStep + extend EditStep +innerSteps
- copyFromDefinition include innerSteps map
- Default new step +innerSteps:[]
- departmentsList useQuery
- Save mutation payload include innerSteps Order asc
- UI sub-section "Cấp duyệt nhỏ trong phòng" drag-list per step card với
  Phòng × Cấp + required checkbox + button "+ Thêm cấp duyệt" emerald
- Empty state hint fallback 2-cấp legacy

KHÔNG đụng fe-user — WorkflowsPage admin-only.

Reuse PositionLevel const + Label maps từ Session 12 types/users.ts.

Docs:
- STATUS.md Last updated + Phase summary (19→20 mig, 89→95 test, 56→57
  bảng) + 1 row Recently Done Session 13 (KEEP narrative cũ)
- HANDOFF.md TL;DR Session 13 prepend + 7 cảnh báo Session 14+
- migration-todos.md Phase 9 + Session 13 block 5 chunk
- Session log NEW `2026-05-07-2400-n-stage-contract-mirror.md` đầy đủ
  rationale + per-chunk + bug log

Defer cron audit 2026-06-01: schema-diagram §17 Mig 20, skill
ef-core-migration row, skill contract-workflow N-stage cross-ref.

🎉 SESSION 13 COMPLETE: Mirror N-stage Contract module (Mig 20). 5
commit per-chunk + skip Chunk E auto-bind. Total 95 test pass.
Backward compat 100% với 2-stage Mig 16 legacy.

Pending Task 4: Wire BE TraLai PE transition + Task 2: Sample data seed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 19:13:27 +07:00
5e5042d717 [CLAUDE] FE-Admin+Docs: PE workflow N-stage Designer + UsersPage cấp + Docs (Chunk F)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m0s
FE Admin:
- types/users.ts: User +positionLevel field + PositionLevel const +
  PositionLevelLabel/Short maps (NV/PP/TP).
- PeWorkflowsPage.tsx Designer extend: InnerStepDto + EditInnerStep types,
  copyFromDefinition include, departmentsList query, sub-section "Cấp duyệt
  nhỏ trong phòng" per step card với drag-list { Phòng × Cấp + required }
  + button "+ Thêm cấp duyệt" emerald + payload include (Order asc).
  Empty state hint fallback 2-cấp legacy.
- UsersPage.tsx: column "Cấp" badge NV/PP/TP emerald (— nếu null) +
  action button cycle null→1→2→3→null call PATCH /users/{id}/position-level.

KHÔNG đụng fe-user — admin-only feature (PeWorkflowsPage + UsersPage ở
fe-admin only).

Docs:
- STATUS.md Last updated + Phase summary count (17→19 mig, 83→89 test,
  55→56 bảng) + 1 row Recently Done Session 12 (KEEP narrative cũ).
- HANDOFF.md TL;DR Session 12 prepend + 8 cảnh báo Session 13+ + giữ
  Session phase 2 narrative.
- migration-todos.md Phase 9 + Session 12 block 6 chunk + 5 defer task.
- session log NEW `2026-05-07-2300-n-stage-workflow.md` đầy đủ rationale
  + per-chunk + bug log + plan hierarchy.

Defer cron audit 2026-06-01: schema-diagram §15 Mig 18 + §16 Mig 19,
skill ef-core-migration Mig 18+19 row, skill contract-workflow N-stage
cross-ref section.

Verify:
- npm run build fe-admin pass (✓ built, 0 TS error)
- dotnet test 89 pass (no regression)
- dotnet build 0 error

🎉 SESSION 12 COMPLETE: N-stage workflow approval Phòng × PositionLevel
PE-only. Backward compat 100% với 2-stage Mig 16. 6 commit per-chunk
A→F. Total 89 test pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 18:32:56 +07:00
edc66602c1 [CLAUDE] Docs: chốt Session phase 2 wrap-up — B12-B14 PE detail polish iterate
Tổng hợp 3 commit từ `378c993` → `d2306b8` (B12-B14) sau wrap-up `6e7a6db`.
KHÔNG cắt narrative cũ — thêm row STATUS, TL;DR HANDOFF, block migration-todos,
append session log (rule §6.5).

Files:
  ~ docs/STATUS.md
    - Last updated phase 2 + Phase summary cập nhật 8→9 PE phase enum
    + Recently Done: 1 row B12-B14 polish (commit SHA + chi tiết narrative
      đầy đủ context)
  ~ docs/HANDOFF.md
    - Last updated phase 2 + TL;DR Session phase 2 prepend với 3 batch
    + 4 cảnh báo Session 12+ bổ sung (8-11): isSelected per-quote BE field
      legacy, winner column logic, loading overlay scope, useEffect deps risk
  ~ docs/changelog/migration-todos.md
    + Session phase 2 done block với 3 task tick (B12-B14 commit SHA)
  ~ docs/changelog/sessions/2026-05-07-2359-pe-workspace-ux-overhaul.md
    + Append "Session phase 2" section với 3 batch chi tiết (B12-B14) + bug
      log + stats cumulative phase 2

Skill: KHÔNG update (no skill-relevant changes — pure FE polish).
Memory: KHÔNG add mới (rule UAT skip-verify đã update mid-session).
Tests: 83 pass (no test changes — UAT iter mode rule §7).

Verify: dotnet test 83 pass · git status clean · push pending.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 17:04:07 +07:00
6e7a6db4e8 [CLAUDE] Docs+Skill: chốt Session S10-11+++++++ wrap-up — PE Workspace UX overhaul
Tổng hợp 23 commit từ `b7a153e` (post Session 9+) → `4c0625c` (last) thành
1 wrap-up entry. KHÔNG cắt narrative cũ — thêm 1 row đầu STATUS + 1 TL;DR
prepend HANDOFF + 1 block migration-todos + 1 session log mới (rule §6.5).

Files:
  ~ docs/STATUS.md
    - Last updated S10-11+++++++ wrap-up + Phase summary 16→17 mig + 5 display
      status + 8→9 phase enum (TraLai)
    + Recently Done: 1 row tổng hợp 11 batch deliverable (B1-B11) với commit
      SHA range, narrative đầy đủ context per §6.5 KEEP rule
  ~ docs/HANDOFF.md
    - Last updated + TL;DR Session S10-11+++++++ prepend với 11 batch summary
    + Stats table cumulative (BE LOC +450, Mig 17, FE pages 31→32, +5 component
      mới, +1 phase TraLai, +5 display status, 23 commit)
    + 7 cảnh báo Session 12+ (TraLai workflow transition pending, multi-phase
      filter, opinion sign Duyệt mode, UAT skip-verify exception, Workspace
      vs Danh sách vs Duyệt matrix, Mig 17 backward compat, CI deploy status)
  ~ docs/changelog/migration-todos.md
    + Session S10-11+++++++ done block với 11 task tick + commit SHA references
    + 3 defer task cho Session 12+ (TraLai workflow, multi-phase filter, opinion sign)
  + docs/changelog/sessions/2026-05-07-2359-pe-workspace-ux-overhaul.md
    Session log đầy đủ (11 batch chi tiết + bug log + docs updates checklist
    + stats cumulative + Plan organization hierarchy)
  ~ .claude/skills/ef-core-migration/SKILL.md
    - "16 migration" → "17 migration" header
    + Row 17 `AddManualBudgetFieldsToPeAndContract` table entry
    - Total: 55 bảng giữ nguyên (+4 cột không thêm bảng) + note clarification
    ~ Phase 7 pending PaymentTermFields cập nhật note (Workspace UI đã thay
      Select preset, BE schema giữ nvarchar(max), defer migration tách field)

Defer cho cron audit 2026-06-01:
  - contract-workflow/SKILL.md TraLai phase note (chờ wire workflow xong)
  - schema-diagram.md §15 Mig 17 +4 columns (small, không drift major)
  - gotchas count update (KHÔNG add vì TS strict CI fail là process issue,
    addressed via memory rule, không phải code-bug pattern)

Memory updated trước đó (commit không có vì memory ở ngoài repo):
  - feedback_uat_skip_verify.md: thêm exception "rename/remove → BẮT BUỘC
    npm run build" + lesson hotfix CI 0ae3fe2

Verify: `dotnet test` 83 pass · git log clean · branch up-to-date sau push.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 16:24:53 +07:00
cb0598d76d [CLAUDE] Docs: Session 11++ housekeeping — InfoTab inline edit + pencil hover
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m9s
Chunk 3/3 — STATUS row + HANDOFF TL;DR Session 11++. KHÔNG cắt narrative cũ
(rule §6.5).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 14:57:52 +07:00
7f38c02ab3 [CLAUDE] Docs: Session 11+ housekeeping — PE BudgetFieldRow inline editor
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m13s
Chunk 3/3 — STATUS Recently Done row + HANDOFF TL;DR Session 11+ housekeeping
trên cùng. KHÔNG cắt narrative S11 cũ.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 13:13:58 +07:00
bf177408b0 [CLAUDE] Docs: chốt Session 11 — Migration 17 manual budget fields PE + HĐ
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m17s
Chunk 5/5 — close session log + STATUS Recently Done + HANDOFF TL;DR Session 11
+ migration-todos tick + 6 cảnh báo Session 12+. KHÔNG update skill (per §9.5
— defer cron audit 2026-06-01 nhỏ enough). KHÔNG update schema-diagram count
55→55 (không bảng mới, chỉ +4 column).

Files:
  ~ docs/STATUS.md       — Last updated S11 + Phase summary 16→17 mig + Recently Done row
  ~ docs/HANDOFF.md      — TL;DR Session 11 prepend + 6 cảnh báo + giữ S10 narrative
  + docs/changelog/sessions/2026-05-07-2300-pe-hd-manual-budget-mig17.md
  ~ docs/changelog/migration-todos.md — Session 11 done block

Validation per §6.5: KHÔNG cắt narrative, chỉ thêm rows + sections mới.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 12:43:00 +07:00
d04bd88fbe [CLAUDE] Docs: tick migration-todos Phase 9 — Session 10 PE workspace 2-panel
Add Session 10 done block với 4 task tick (Chunk 1 fe-admin / Chunk 2 fe-user
mirror / Chunk 3 docs / Verify), reference 3 commit SHA. Phase 9 active
section nối tiếp Session 9+ housekeeping pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 10:40:55 +07:00
7e3cfa580a [CLAUDE] Docs: chốt session 10 — PE Thao tác 2-panel workspace + session log
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m19s
Chunk 3/3 — close session log + STATUS Recently Done + HANDOFF TL;DR Session 10
+ cảnh báo Session 11+. KHÔNG update skill (per §9.5 anti-pattern: không drift
đáng audit, chỉ FE refactor pure).

Files:
  ~ docs/STATUS.md        — Last updated + Recently Done row + FE pages 31→32
  ~ docs/HANDOFF.md       — TL;DR Session 10 prepend + 6 cảnh báo + giữ S9 narrative
  + docs/changelog/sessions/2026-05-07-2100-pe-workspace-2panel.md

Validation per §6.5: KHÔNG cắt narrative cũ, KHÔNG paraphrase. Chỉ thêm row
mới + section TL;DR mới phía trên các section cũ.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 10:40:09 +07:00
b7a153e45a [CLAUDE] Docs: chốt session 9+ housekeeping log + STATUS+HANDOFF+migration-todos update
Session log mới `2026-05-04-1900-chot-session-9-plus-housekeeping.md`:
chốt 4 commit Session 9+ post-Session-9 (Audit 2026-05 + Inbox PE +
Housekeeping docs + User Manual 7 file rewrite). Full narrative
+ context + lessons + stats + cảnh báo session 10+.

STATUS Recently Done +1 row mới (User Manual rewrite 16c2c9c) +
Phase header refresh "Session 9+ chốt" + "7 file User Manual ~86 KB
compact end-user style".

HANDOFF Housekeeping section +1 mục User Manual rewrite + thêm note
"User Manual style rule mới chốt session này": phân biệt với §6.5
(end-user docs vs dev docs).

migration-todos thêm section "Session 9+ housekeeping done" với 3
task tick (audit + Inbox PE + User Manual).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 20:44:28 +07:00
16c2c9c79e [CLAUDE] Docs: User Manual 7 file rewrite compact cho end-user
User feedback: "ko cần quá đầy đủ chi tiết, cho end-user họ làm".

Rewrite 7 generator scripts theo style end-user friendly:
- Bỏ field validation table 5 cột (Tên field / Kiểu / Bắt buộc / Validation / Ví dụ)
- Bỏ error troubleshoot table 3 cột (Lỗi / Nguyên nhân / Cách xử lý)
- Bỏ FAQ chi tiết 8 câu (giữ 1 chương "Khi gặp lỗi" 4-5 bullet)
- Bỏ phím tắt table
- Giữ: tổng quan ngắn, numbered steps đơn giản, note/warn/tip chỉ khi critical

7 file generator (đã refactor dùng _helpers.js shared):
- _gen-user-01: Bắt đầu (login + đổi pwd + hồ sơ + dashboard + sidebar + chuông)
- _gen-user-02: Hợp đồng (7 loại + tạo + sửa + xóa + đính kèm + comment)
- _gen-user-03: Duyệt Workflow (9 phase + 2-stage NV/TPB + reject + resume)
- _gen-user-04: Phiếu Duyệt NCC (PE) (A/B + matrix báo giá + winner + 4PB + tạo HĐ)
- _gen-user-05: Ngân sách (tạo + hạng mục + WF 3-step + liên kết HĐ/PE)
- _gen-user-06: Cheatsheet 7 loại HĐ (mỗi loại 1 page: use case + field + format mã)
- _gen-admin-02: Quản lý Users-Roles (tạo + role + reset + lock + bypass review S9)

Setup: package.json + npm install docx@9.5.0 + script "gen:all".

Output sizes:
- 01: 12.1 KB (cũ 21.7 KB → giảm ~44%)
- 02: 12.4 KB
- 03: 12.2 KB
- 04: 12.4 KB
- 05: 12.0 KB
- 06: 12.8 KB
- admin-02: 12.7 KB
- Tổng ~86 KB cho 7 file đầy đủ chức năng cốt lõi.

Note: ContractType label "Phương án" → "Giải pháp" (đã rebrand session 3).
2-stage dept approval mention ở Phần 03 + admin-02 (Migration 16 Session 8/9).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 17:06:01 +07:00
bdd175c07b [CLAUDE] Docs: housekeeping reflect audit 2026-05 + Inbox PE section done
STATUS Recently Done +2 row mới (audit 7dc0233 + Inbox PE 332a90f),
section F audit định kỳ tick 2026-05-01 done + ghi cron Claude SDK
KHÔNG fit monthly cadence (auto-expire 7d) → user setup OS Task
Scheduler nếu cần auto-remind. Next audit 2026-06-01 manual.

HANDOFF +1 section "Housekeeping today" tóm tắt 2 commit hôm nay sau
Session 9 close. Cảnh báo cron limitation ngắn cho session sau.

migration-todos Phase 9 §C tick "fe-user Inbox PE section" done với
commit hash + summary 1 line. 5 optional polish khác giữ pending.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 15:59:49 +07:00
7dc0233f08 [CLAUDE] Docs+Skill: audit định kỳ 2026-05 — 6 file patch + 1 log page
Combined audit (skill staleness + doc drift) theo §6.4 + §9.4. Cron 2026-05-01 trễ 4 ngày (cron empty), chạy manual 2026-05-04 sau Session 9 close Chunk E-bis.

Drift patched (Phase 1 — count cross-check):
- docs/CLAUDE.md:70    52 bảng → 55 bảng (+§14 DepartmentApprovals Mig 16)
- docs/rules.md:368    Phase 8 active — 77 test → Phase 9 — 83 test
- docs/architecture.md:329, 365   77 test → 83 test (2 chỗ)
- .claude/skills/ef-core-migration/SKILL.md:52    77 test → 83 test + ghi 6 PE 2-stage S9
- .claude/skills/dependency-audit-erp/SKILL.md:153    26+ bẫy → 41 bẫy

Skill content patch (Phase 2 — staleness):
- contract-workflow: thêm "Phase 9 cross-ref (Mig 16)" block + section "Phase 9 done" (2-stage dept approval + smart reject + lock edit + CanBypassReview)
  → KHÔNG tạo skill 2-stage riêng (§9.5 anti-pattern "viết skill chỉ để có thêm")

KEEP per §6.5 (không cắt narrative):
- docs/rules.md:328 "52 bảng" example minh họa rule §6.5
- docs/changelog/migration-todos.md:152, 196 historical session record
- 9 session log mention 77/52 — snapshot lịch sử

Total patches: 6 file ~+30 / ~12 lines, KHÔNG rewrite, đáp ứng 3 câu validation §6.5.

Audit log: docs/changelog/skill-audit-2026-05.md (1 page max per cadence).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 15:53:51 +07:00
b431c8f68d [CLAUDE] Docs: Chunk E7 — chốt session 9 Chunk E-bis complete
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m7s
- STATUS: Recently Done +1 row session 9 (5 commit per-chunk + 83 test). Phase 9
  header update count 77→83. Section E (Chunk E-bis) tick toàn bộ done.
- HANDOFF: TL;DR session 9 + Cảnh báo session 10. Giữ session 8 narrative cũ.
- migration-todos: Phase 9 +1 section "Session 9 done" với 5 task tick. Pending
  Chunk E-bis tick chuyển done.
- CLAUDE.md (root + docs): test count 77 → 83 (54 Domain + 29 Infra:
  17 codegen + 6 PE WF Application + 6 PE 2-stage approval).
- Session log mới: 2026-05-04-1700-chot-session-9-chunk-e-bis-complete.md
  (full narrative + lessons + stats theo §6.5 KEEP rule).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 13:56:38 +07:00
d206e14550 [CLAUDE] Docs+Skill: chốt session 8 ending — patch count drift + skill refresh
Session 8 ending workflow theo template (kết thúc lúc ~13:00).

Patch drift count post Migration 16:
- docs/architecture.md §1: "(dbo schema, 19 bảng)" → 55 bảng
  (drift cũ session 6 chưa fix, giờ fix luôn)
- docs/database/schema-diagram.md §8 Migration history: thêm row 16
  AddTwoStageDeptApprovalAndSmartReject + Tổng 52 → 55 bảng
- .claude/skills/ef-core-migration/SKILL.md: 15→16 migration history,
  52→55 tables, description + code pointers + related links
- .claude/skills/README.md: ef-core-migration row "13 migration" → 16,
  gotchas count "32 bẫy" → 41 (drift cũ chưa fix)

Memory entry mới (cross-session pattern):
- feedback_per_chunk_commit.md: rule per-chunk commit cho big-feature
  (>500 LOC, multi-layer). Bài học S8 — 5 commit A-B-C-D-E thay vì
  1 monolithic. MEMORY.md index +1 entry (6 total).

Skip (intentional, theo §6.5 KHÔNG cố sửa):
- docs/gotchas.md: KHÔNG có gotcha mới đáng note (S8 dùng pattern
  đã proven, không có bug pitfall mới)
- docs/database/database-guide.md: KHÔNG có migration table chi tiết,
  chỉ conventions. Skip.
- contract-workflow + permission-matrix skills: KHÔNG touch (PE module
  only, contract policy chưa đổi, permission không liên quan bypass-review)

Verify:
- 77 unit test vẫn pass (54 Domain + 23 Infra)
- Build pass

Total session 8 cumulative: 6 commit (5 code A-B-C-D-E1 + 1 docs ending).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 13:02:22 +07:00
3c4931687a [CLAUDE] App+Api+Docs: Chunk E1 — List endpoint + Bypass-review + Notify TPB + chốt session 8
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m15s
3 endpoint mới + Notify TPB + Docs update để chốt session 8.

Application:
- PurchaseEvaluationDepartmentApprovalFeatures.cs (NEW):
  * ListPeDepartmentApprovalsQuery + DTO PeDepartmentApprovalDto
  * Join Departments (lấy Name) + lookup Users.FullName denorm cho FE timeline
- UserFeatures.cs: SetUserBypassReviewCommand + Handler dùng UserManager.UpdateAsync
- IApplicationDbContext: thêm DbSet<User> Users + DbSet<Role> Roles (cần cho lookup)

Api:
- PurchaseEvaluationsController: GET /api/purchase-evaluations/{id}/department-approvals
- UsersController: PATCH /api/users/{id}/bypass-review (Authorize Users.Update)

Infra:
- PurchaseEvaluationWorkflowService: notify TPB cùng dept khi NV review.
  Query db.Users.Where(DeptId match + IsActive) → UserManager.GetRolesAsync
  filter DeptManager → notifications.NotifyAsync. Best effort fail non-critical.

Docs:
- STATUS.md: Recently Done thêm row session 8 + Phase header update
  count 52→55 tables, 15→16 migrations, 128→131 endpoints
- HANDOFF.md: TL;DR session 8 + 8 cảnh báo session 9 (FE chưa làm,
  test flow anh Kiệt, smart reject test, lock edit test, ...)
- migration-todos.md: Phase 9 done section đầy đủ 3 ràng buộc + pending Chunk E-bis
- CLAUDE.md: count 52→55 + migration 16 description
- session log: 2026-05-04-1230-chot-session-8-2-stage-dept-approval.md (full report)

Verify final:
- Build pass 0 warning 0 error
- 77 unit test pass (54 Domain + 23 Infra)
- Migration 16 applied LocalDB OK + schema verified

Total session 8 cumulative: 5 commit per-chunk:
- 5fe61cc (A: Migration 16 schema)
- 14f3c9f (B: Lock edit guards 17 handler)
- 9747f8c (C: Smart reject + Resume 3 module)
- a532ba6 (D: PE 2-stage logic)
- (current E1: List + Notify + Bypass + Docs)

Pending Chunk E-bis (defer cho session 9 sau UAT PE):
- FE Workflow Panel hiển thị 2-stage timeline
- FE UserManager toggle CanBypassReview
- HĐ + Budget 2-stage extension
- Tests Phase 3 mini cho 2-stage Service-layer logic

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 12:42:47 +07:00
dfb43fcbc6 [CLAUDE] Docs: chốt template session prompts (start + end) — iterate qua 5 AI
User dùng 2 prompt fixed cho mọi session SOLUTION_ERP:
- MỞ ĐẦU: LOAD context (5 mục — đọc MD core, list skill, verify test,
  check audit cadence, sub-rule consolidate)
- KẾT THÚC: UPDATE MD + commit (5 mục — update MD đã đổi, note skill,
  verify test count tăng, add memory entry nếu cần, sub-rule consolidate)

Iterate workflow:
- v1: đề xuất ban đầu (typo + 4 mục giống nhau Mở đầu vs Kết thúc)
- v2: tách action verb LOAD vs WRITE
- v3-v4: refine wording, fix typo, bỏ câu thừa
- v5 final: fix "thei"→"theo", "end từ"→"kết thúc lúc", "vào vào"→"vào"

Bài học: prompt template iterate cross-AI (5 AI cùng review) ra version
robust hơn 1 AI duy nhất. Template lưu 3 chỗ:
1. docs/_templates/session-prompts.md (canonical project)
2. memory/reference_session_prompts.md (cross-session pointer)
3. MEMORY.md index (session sau auto-load nhận diện trigger)

File: docs/_templates/session-prompts.md (NEW, docs-only → CI skip)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 03:04:12 +07:00
2675a3a674 [CLAUDE] Docs: rule §6.5 consolidate KEEP vs CUT + restore narrative migration-todos
Bài học session 6: compact -288 dòng nhanh nhưng paraphrase + collapse mất
narrative tích lũy qua sessions. User feedback: "viết MD gọn lại tý là mất
mẹ luôn tính cách cũ". Docs đọc 6 tháng sau như machine output.

Changes:
1. docs/rules.md §6.5 mới — Consolidate MD đúng cách (KEEP vs CUT):
   - KEEP cấm cắt: narrative, rationale, gotcha context, anecdote, "decision why"
   - CUT được: duplicate cross-ref, list>30 row archive, phase>1 tháng collapse
   - CẤM: paraphrase, summary đoạn có narrative, "đẹp hóa" bằng cắt
   - Decision tree + Validation 3 câu sau consolidate

2. docs/changelog/migration-todos.md restore Phase 6-7 nguyên văn từ b874743:
   - Phase 6 iter 1 (10 task chi tiết: Migration 12, Domain 2 enum, Application
     CQRS ~900 LOC, PurchaseEvaluationWorkflowService, Controller 17 endpoint,
     FE 2 app, Kế thừa HĐ guard, Migration 13 atomic seq, Demo PE seed)
   - Phase 6 iter 2 (8 task UX polish: rename Phương Án→Giải pháp, menu
     inheritance #35, accordion mutex, queryMatches #34, flat layout, per-NCC
     attachment, readOnly mode, email rebrand #38)
   - Domain rebrand 4 task chi tiết (gotcha #30 ASCII-only, 18 file repo,
     CI/CD auto rebuild, "Old fallback chưa remove" rationale)
   - Phase 7 PE feature gap A/B/C/D/E section đầy đủ:
     A. 3 task PE feature gap với file path + Option A/B reasoning
     B. 4 optional polish carry over Phase 9
     C. 6 ops task carry over Phase 9 hard blockers
     D. Budget BE 7 task chi tiết (Migration 14, ~340 LOC, 11 endpoint, 14 demo)
     E. 4 pending migration với rationale "khi nào cần"
   - Tick [x] task đã DONE S5 (PE WF Designer + Ý kiến 4 PB) + giữ [ ] chưa làm

Net change migration-todos: 136 → 217 (+81 dòng narrative)

Files: docs/rules.md + docs/changelog/migration-todos.md (docs-only → CI skip)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 01:56:29 +07:00
2abbc1d867 [CLAUDE] Docs+Skill: chốt session 6 — 3 skill refresh + 2 rule audit định kỳ
Pure docs work — 0 thay đổi code/test. 77 test vẫn pass (Domain 54 + Infra 23).

3 skill refresh stale (audit định kỳ §6.4 + §9.4 phát hiện):
- form-engine: "Phase 2 MVP missing PDF + form builder" → "Tier 3 feature-complete"
  + bỏ section duplicate "Gen mã HĐ chưa implement" (đã DONE Phase 3+6)
- permission-matrix: 12 menu cũ → ~60 menu key (Bg_*/Pe_*/PeWf_*/Catalogs)
  + inheritance roots 4 group + Budgets KHÔNG inherit (gotcha #35)
- ef-core-migration: "24 DbSet" → "52 bảng (15 migration)"

2 rule mới chốt:
- rules.md §6.4 — Audit + compact MD định kỳ (cadence + checklist + anti-pattern)
  Triết lý: KHÔNG rewrite toàn bộ. Compact + patch drift.
  Cron solution-erp-skill-audit-monthly mở rộng scope (skill + doc drift combined)
- rules.md §9.4 mở rộng cross-ref §6.4

Update STATUS Session 7+ priority + HANDOFF cảnh báo session 7 + migration-todos
Phase 9 Session 6 done sub.

Cron 2026-05-01 fire mai → combined audit theo checklist §6.4 + §9.4.

Session log đầy đủ: docs/changelog/sessions/2026-04-30-chot-session-6-md-audit-compact.md

Commit MD-only → CI skip (path filter gotcha #41).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 01:18:51 +07:00
f24acb699a [CLAUDE] Docs: compact 3 file core (-273 dòng tổng)
STATUS.md (-52 dòng, -27%): archive 51 row Recently Done Phase 0-7 cũ
  → changelog/recently-done-archive-2026-04.md (file mới)
  Giữ 12 row mới nhất Phase 8/Session 5 + pointer archive.

HANDOFF.md (-147 dòng, -32%): bỏ 3 section duplicate
  - Versioned workflow quick ref → cross-ref workflow-contract.md §7bis
  - File đang active (90 dòng tree) → cross-ref PROJECT-MAP.md
  - Git state snapshot stale → cross-ref `git log --oneline -10`

migration-todos.md (-74 dòng, -35%): collapse Phase 6 iter 1+2 + Phase 7
  done parts thành 4 dòng paragraph. Giữ Phase 8/9 active + skill audit.

Quy tắc compact (rules.md §6 implicit):
  - Recently Done > 30 row → archive cũ vào changelog/recently-done-archive-{YYYY-MM}.md
  - Phase done >= 1 tháng → collapse thành 1 paragraph + cross-ref session log
  - Section duplicate file khác → cross-ref thay vì copy

Commit MD-only → CI skip (path filter gotcha #41).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 01:10:03 +07:00
d2298fa614 [CLAUDE] Docs: chốt rule timing unit test (1 bảng 5-row compact)
- rules.md §7: thêm section "Khi nào viết test — timing rule"
  4 case (feature mới/bug fix/critical algorithm/spec change) + 1 skip list
- CLAUDE.md root: 1 dòng quick reference timing rule
- User confirm pattern Phase 1-8 (test-after pragmatic) là default cho solo dev
- Test-before BẮT BUỘC chỉ khi: bug fix (regression test) + critical algorithm
- Spec change KHÔNG ngừng test — update test cũ + code, commit chung

Commit MD-only → CI skip (path filter gotcha #41), 0s deploy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 00:40:24 +07:00
b874743081 [CLAUDE] Docs+Tests: chốt final session 5 — 77 test (Phase 3 mini PE WF) + 3 gotcha CI + 8 doc updates
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m21s
Final close session 5 — bao gồm:

==== Tests Phase 3 mini (NEW) ====
tests/SolutionErp.Infrastructure.Tests/Application/PeWorkflowAdminTests.cs
- 6 test CreatePeWorkflowDefinitionCommandHandler:
  - First version → IsActive=true, Version=1, ActivatedAt set
  - Second version same Code → auto-increment v2 + deactivate v1 (atomic)
  - Different EvaluationType (A vs B) → independent active state
  - Persists steps ordered by Order field
  - Persists approvers per step
  - Third version → v1 + v2 deactivate, v3 active

Total tests: 71 → 77 pass / ~2s (54 Domain + 23 Infra).
Skip Phase 3 full (UpsertOpinion + Budget link validation) — cần
Identity UserManager DI helper, defer session sau.

==== 3 gotcha CI mới (#39 #40 #41) ====
- #39 act_runner github.com TCP timeout 21s → manual checkout fix (run #108/#109 fail, #110 pass)
- #40 npm junction cache `tsc not found` after Move-Item — rolled back, hypothesis nested junctions
  trong node_modules disrupt .bin/ paths. TODO debug session sau với robocopy hoặc act_runner cache.host
- #41 Gitea Actions paths-ignore behavior — workflow file change vẫn trigger (correct), commit
  MD-only skip 100% (verify 512880c → no run #113)
+ Checklist debug bug mới items 18-20 referencing 3 gotcha trên.

==== Doc updates (8 file) ====
- STATUS.md: header Phase 8 update + 3 row Recently Done CI fixes + cumulative test 71→77
- HANDOFF.md: TL;DR + CI optimize section + Phase status + gotcha count 38→41
- migration-todos.md: Phase 8 §E updated với Phase 3 mini done + CI fixes
- rules.md §7 Testing: rewrite full — stack + test pyramid + quy tắc bổ sung mỗi feature +
  workflow user end-of-task (`dotnet test` local trước push) + CI gate behavior
- architecture.md §11: update test pyramid + phased priority + CI optimization sub-section
  (3 fix manual checkout / path filter / npm cache rollback) + tốc độ deploy table
- gotchas.md: + #39 #40 #41 đầy đủ (triệu chứng + nguyên nhân + fix + reference)
- ef-core-migration SKILL: Phase 8 update note thêm CI fixes + 77 test
- CLAUDE.md root: test count 71→77 + folder structure + CI/CD pipeline 3 fix section
- memory project_solution_erp.md: session 5 summary + workflow user mới
- session log 2026-04-29-2300-chot-final-ci-tests-gotchas.md (NEW — 9 section detail)

==== Skill audit cron ====
`solution-erp-skill-audit-monthly` next fire 2026-05-01 (2 ngày sau).
Cron survives across sessions (setup commit b904a25). Khi fire sẽ:
- Cross-check 6 skill với STATUS/gotchas/migration-todos
- Auto-refresh stale + đề xuất add/archive cho human approve
- Log vào docs/changelog/skill-audit-2026-05.md
- ABORT nếu repo dirty

==== Verify ====
- dotnet test SolutionErp.slnx → 77 pass / ~2s (54 Domain + 23 Infra)
- git status clean sau commit này
- CI: commit này chứa code (test + workflow) → trigger CI test gate

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 23:43:42 +07:00
512880c5cb [CLAUDE] Docs: STATUS — note CI path filter live (test docs-only commit skip)
Test path filter on:push:paths-ignore — commit này CHỈ touch docs/STATUS.md.
Expected: Gitea Actions KHÔNG trigger run mới.
Verify bằng cách check Actions UI sau ~30s — vẫn ở run #112 (a21790d).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 18:39:44 +07:00
52999f33fa [CLAUDE] Docs: chốt session 5 — Budget FE + PE feature complete + Tests Phase 1-2 + CI gate
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Failing after 22s
Session 5 (29/04) — 6 commit feature + 1 chốt MD này.

==== Stats sau session 5 ====
- 52 DB tables (+1 PEDeptOpinions)
- 15 migrations (+`AddPurchaseEvaluationDepartmentOpinions`)
- ~128 API endpoints (+4)
- ~31 FE pages (+5 Budget + 1 PeWorkflowsPage)
- 71 unit test pass (54 Domain + 17 Infra) — CI gate live, fail → no deploy
- ~13050 BE LOC (+1300)
- 30 demo user, 38 gotchas, 6 skill (no change)

==== MD touched ====
- STATUS.md: header Phase 8 + 6 row Recently Done session 5 + cumulative cột S5 + In Progress S6 (Hard blockers + Optional polish + Tests Phase 3-5 + Ops)
- HANDOFF.md: TL;DR 6 milestone S5 + Cảnh báo S6 (CI test gate workflow mới) + Priority 0 S6 (UAT + Ops focus) + Phase status table cập nhật
- migration-todos.md: Phase 8 done với A/B/C/D/E (FE Budget / PE-HD integration / PE WF Designer / Ý kiến 4 PB / Tests Phase 1-2) + Phase 9 active (UAT + Ops + carry over)
- architecture.md: §11 Testing strategy mới (test pyramid bottom-heavy + stack + CI gate + phased priority + quy tắc bổ sung mỗi feature)
- database/schema-diagram.md: Migration 15 row + total 52 tables + §13 PE Department Opinion (1 bảng UNIQUE PEId+Kind + Upsert behavior + SQL DDL)
- ef-core-migration SKILL: migration 15 entry + 52 tables total + Phase 8 update note
- CLAUDE.md (root): modules table + Tests row + scope `Tests` + Tests section mới + count update 15/52
- docs/CLAUDE.md: 7 module bullet + ERD 52 bảng + Roadmap Phase 8 done + Phase 9 active S6
- memory project_solution_erp.md: Phase 8 summary + Session 6 priority + workflow user mới (dotnet test → commit → push)
- session log 2026-04-29-chot-session-5-budget-fe-pe-tests.md (NEW — 10+ section detail)

==== Verify ====
- dotnet test SolutionErp.slnx → 71 pass / 2s
- git status clean sau commit này

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 13:50:54 +07:00
e0b4e7f096 [CLAUDE] Docs: chốt session 4 — Budget BE module + 14 Solutions users
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m53s
- STATUS.md: header Phase 7 + 3 row Recently Done (Budget BE / 14 users / Docs cleanup) + cumulative cột mới (51 tables / 14 mig / ~124 endpoints)
- HANDOFF.md: TL;DR session 4 (2 milestone Budget BE + 14 users) + Cảnh báo session 5 + Priority 0 (FE Budget + PE/HD integration + PE feature gap) + Credentials 30 user
- migration-todos.md: Phase 7 thêm section D Budget done + Phase 8 mới (FE Budget pages + integration) + pending migrations Budget
- architecture.md: §10 Budget module mới (ERD + state machine + auto-recompute + integration roadmap)
- database/schema-diagram.md: migration history rows 13+14 + §12 Budget ERD chi tiết
- ef-core-migration SKILL: migration 14 entry + Phase 8 pending Budget refinement
- CLAUDE.md root + docs: modules table thêm Budget row + scope Budget + count 51 bảng / 14 mig
- Session log 2026-04-28-chot-session-4-budget.md (10+ section detailed)

Stats: 51 tables (+4 Budget), 14 migrations (+AddBudgets), ~124 endpoints (+11 Budget),
30 demo user (16 sample + 14 Solutions thật), 38 gotchas, ~340 LOC Budget CQRS.
FE Budget pages chưa làm — Priority 0 session 5.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 12:36:31 +07:00
309dcd9768 [CLAUDE] Docs: chot final session 3 — audit MD + session log + minor fixes
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m58s
Audit toan bo MD theo yeu cau 'review cap nhat va tai cau truc'.

Minor fixes outdated:
 - docs/database/database-guide.md: header note '47 bang 13 migration' +
   redirect schema-diagram cho actual schema. Email demo +
   admin@solutions.com.vn (thay solutionerp.local).
 - docs/guides/runbook.md: reset-password email moi.

Session log moi: docs/changelog/sessions/2026-04-25-1430-chot-session-3-
final-cleanup.md
 - Cleanup outcomes: archive 2 raw + compact migration-todos -71% +
   compact STATUS In Progress -50% + update outdated refs.
 - Skill audit 6 skill: tat ca Active (3 skill da update voi PE/G-084
   cross-ref session truoc).
 - Stats session 3 cong don 3 phien 23-24-25: 47 DB tables, 13 migrations,
   ~113 endpoints, 38 gotchas, ~30 commits.
 - Priority 0 session 4: 3 PE feature gap (Designer UI, Y kien 4 phong
   ban, Export PDF) + Ops blockers.
 - Notes session 4: email moi, 3 domain prod, old fallback, G-084, SSH.
2026-04-25 23:40:11 +07:00
e71e0eba65 [CLAUDE] Docs: tai cau truc cleanup — archive raw, compact migration-todos, update CLAUDE+flows
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m53s
User request: 'review cap nhat va tai cau truc lai MD sao cho phu hop
voi hien tai, cac phan thua va da dieu chinh co the bo ra luon hoac
cap nhat lai'.

Cleanup highlights:
1. Archive 2 file Phase 0 raw dump → docs/_archive/ (forms-spec-raw 657
   line + workflow-raw 62 line). Update link reference 2 file goc.
2. Compact migration-todos.md 386 → 114 line (-71%). Collapse Phase 0-5
   + Tier 3 + Sessions detailed thanh 1 bang summary. Detail xem session
   logs. Phase 6 iter 1+2 + Phase 7 active checklist.
3. Compact STATUS.md In Progress: bo ~17 row  done (giu chỉ 5+ task
   pending: 3 PE feature gap + 4 optional polish + 2 Ops). Recently Done
   table giu day du history.
4. Update flows/README — tat ca 6 flow  Implemented + them PE row
   reference architecture.md §9.
5. Update docs/CLAUDE.md — project layout co PurchaseEvaluations, _archive,
   skills 6 (3 dom + 3 ops). Roadmap them Phase 6  + Phase 7 WIP. Lien
   he them prod URL solutions.com.vn + SSH config + login admin.
6. Skill ef-core-migration: 13 migration label.

Net delta: -800 line docs (chu yeu archive + collapse migration-todos).
2026-04-25 14:17:53 +07:00
e65578a821 [CLAUDE] Docs: chot session 3 — PE polish iter 2 + domain rebrand + 5 gotcha moi
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m55s
User request: 'Chot lai toan bo MD de sang session moi'.

Session 3 (2026-04-24) — ~15 commit feat/fix PE module + domain migration:
 - Domain 3 subdomain huypham.vn → solutions.com.vn E2E live
 - PE rename 'Phuong An' → 'Giai phap' + backfill DB
 - Menu tree inheritance extend Pe_*/PeWf_*
 - Accordion mutex Pe_* + sidebar w-72 + label nowrap
 - NavLink queryMatches (fix 2 leaf cung highlight)
 - PE detail flat layout: Panel 2 = 4 section, Panel 3 + approvals/history
 - Upload file dinh kem per-NCC (SupplierAttachmentsCell) + Bang so sanh tong
 - readOnly mode menu 'Duyet' (pendingMe=1)
 - HD move Lich su dieu chinh → Panel 3
 - Demo email rebrand @solutionerp.local → @solutions.com.vn + BackfillUserEmailDomain

Docs updated (6 file):
 - STATUS.md: +9 row Recently Done session 3. In Progress tick 10+ done. Phase
   hien tai = 'UX polish hoan thien, UAT-ready'.
 - HANDOFF.md: TL;DR session 3 summary. Priority 0 = 3 task MISSING cuoi
   (Designer UI, Y kien 4 phong ban, Export PDF). Login email moi.
 - gotchas.md: +5 entry (#34 NavLink query, #35 menu inheritance extend,
   #36 Vite env rebuild, #37 PS 5.1 ASCII, #38 Identity rename 4 field) +
   checklist debug +5 entry.
 - ef-core-migration SKILL: migration 13 AddPurchaseEvaluationCodeSequences
   + Phase 6 update section (ComparisonTable enum + BackfillUserEmail).
 - skills/README: ef-core-migration 13 migration label updated.
 - docs/changelog/sessions/2026-04-24-chot-session-3-pe-polish.md: session log
   15 commit + bugs + stats + next priorities session 4.

Memory project_solution_erp.md: Phase 6 iter 2 DONE. Domain rebrand DONE.
Session 4 priority 3 PE gap remaining.

Stats: 47 DB tables (+1 MaPhieu seq), ~113 endpoint (+3 PE attachments),
13 migrations, 38 gotchas, ~85 commits total.
2026-04-25 00:37:30 +07:00
de1ddc233d [CLAUDE] Docs: STATUS — backfill commit hash c48ac21 cho PE polish row
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 10:41:44 +07:00
c48ac2116d [CLAUDE] PurchaseEvaluation: demo seed 4 phieu + MaPhieu atomic sequence + Pe_* perm defaults
Polish session tiep cua PE module skeleton (commit 2c6f0ca..3990066):
3 task A (MISSING in MVP) khac STATUS.md In Progress:

1. Demo PE data seed (SeedDemoPurchaseEvaluationsAsync)
   - 4 phieu varied A/B x phase: A-001 DangSoanThao (mo), A-002
     ChoCEODuyetNCC (winner+9 quotes), A-003 DaDuyet (chua tao HD,
     PaymentTerms JSON), B-001 ChoDuAn (5-step giua chung).
   - Idempotent: skip-if-[DEMO]-exists.
   - Approval history dung policy A (3-step) hoac B (5-step).

2. MaPhieu atomic sequence — Migration 13
   - Format PE/{YYYY}/{TypeLetter}/{Seq:D3} (vd PE/2026/A/001).
   - PurchaseEvaluationCodeSequence entity (Prefix PK).
   - IPurchaseEvaluationCodeGenerator + impl SERIALIZABLE
     transaction (mirror ContractCodeGenerator 1:1).
   - Replace Random.Shared trong CreatePurchaseEvaluationCommandHandler.
   - Migration AddPurchaseEvaluationCodeSequences (1 bang).

3. Pe_* permission defaults
   - SeedPurchaseEvaluationPermissionDefaultsAsync — 7 role business x 9 menu key.
   - Drafter/DeptManager/Procurement: R+C+U; CostControl/PM/Director/AuthorizedSigner: R+U.
   - DeptManager them Delete (xoa nhap).
   - Idempotent per-(roleId x menuKey).

Build: 0 error, 2 warning (pre-existing DocxRenderer).

Files: 4 new + 8 modified (1 migration + entity + generator + DI + 2 ctx + 2 features).

Resolves: STATUS.md In Progress §A — 3 item PE MISSING.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 10:41:17 +07:00
0048a2e83a [CLAUDE] Docs: STATUS + HANDOFF domain migration E2E done (huypham.vn → solutions.com.vn)
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Failing after 29s
2026-04-24 10:25:41 +07:00
66c1a5c170 [CLAUDE] Rebrand: 3 domain huypham.vn → solutions.com.vn + migrate script
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m52s
User request: anh trỏ 3 subdomain mới về VPS IP 103.124.94.38:
  - api.huypham.vn        → api.solutions.com.vn
  - admin.huypham.vn      → admin.solutions.com.vn
  - user.huypham.vn       → eoffice.solutions.com.vn

Verified DNS: cả 3 resolve 103.124.94.38 ✓

Update 17 file repo:
FE (4): fe-admin/.env.production + fe-user/.env.production
        (VITE_API_BASE_URL → https://api.solutions.com.vn)
        fe-admin/src/lib/{api,realtime}.ts + fe-user equivalents (comment)
BE (1): appsettings.Production.json.example — CORS AllowedOrigins
CI/CD (1): .gitea/workflows/deploy.yml — smoke test URL
Scripts (3): setup-iis-sites (DomainApi/Admin/User), setup-ssl (3 host),
             deploy-all (verify curls)
Docs (5): STATUS, HANDOFF, PROJECT-MAP, vps-setup, gotchas
Skill (1): iis-deploy-runbook — 3 site table + description
Email admin@huypham.vn giữ nguyên (Let's Encrypt contact — không phải
domain serve).

Thêm scripts/migrate-domains.ps1 — 1-shot VPS migration:
  1. Pre-flight: resolve DNS 3 domain → verify IP VPS khớp
  2. Add HTTP binding mới cho 3 IIS site (giữ binding cũ làm fallback)
  3. Run win-acme xin 3 cert Let's Encrypt qua HTTP-01 challenge
     (auto add HTTPS binding + http→https redirect)
  4. Verify /health/live + /health/ready + 2 FE endpoint
  5. (Optional -RemoveOld) xóa binding huypham.vn sau verify OK
Rollback: nếu fail, binding cũ vẫn active → site serve qua huypham.vn.

Anh chạy trên VPS:
  cd C:\solution-erp\scripts  ;  .\migrate-domains.ps1
  # Sau 1-2 ngày verify stable:
  .\migrate-domains.ps1 -RemoveOld -SkipCert
2026-04-24 09:43:05 +07:00
7ca6c914fa [CLAUDE] Docs: chốt session 2 — PE skeleton + G-084 + skill audit
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m55s
User feedback: "phần Duyệt NCC chưa xong đâu đấy nhé, còn chỉnh nhiều"
→ mark PE module skeleton (not feature-complete), liệt kê chi tiết chức
năng/UX/edge-case còn missing cho session tiếp.

Update 7 file:
 - STATUS.md — phase = "PE skeleton + refinement WIP", In Progress liệt
   kê 4 nhóm: A Chức năng MISSING (9 item), B UX/Polish (6 item),
   C Edge case (4 item), D Deploy/Ops (1 item). +G-084 row Recently Done.
 - HANDOFF.md — TL;DR "PE skeleton, còn chỉnh nhiều" + Priority 0 section
   cho session tiếp (9 task PE refinement) + cảnh báo runner + G-084.
 - migration-todos.md — Phase 7 checklist (A/B/C/D nhóm) trước Phase 8
   post-launch. Pending migrations: PaymentTermFields + DepartmentOpinions
   + CodeSequences.
 - architecture.md — Section 9 PurchaseEvaluation module (ERD + workflow
   A/B + kế thừa HĐ flow).
 - CLAUDE.md (root) — 5 file đọc đầu (thêm HANDOFF), Modules table, 12
   migration 46 bảng, +PurchaseEvaluation commit scope.
 - .claude/skills/ — 4 skill cross-ref Phase 6:
   * README: trạng thái updated với Phase 6 note
   * contract-workflow: note PE workflow tách table riêng
   * permission-matrix: +Pe_*/PeWf_* menu keys + TODO grant non-admin
   * ef-core-migration: 12 migration history + Phase 7 pending
 - docs/changelog/sessions/2026-04-23-2359-chot-session-pe-skeleton.md —
   session log full commits + MD files updated + session tiếp priorities
   + notes (PE là skeleton, runner check, G-084 rule, MaPhieu format).
2026-04-23 17:46:41 +07:00
3990066b04 [CLAUDE] Scripts+Skill+Docs: hardening G-084 IPv4/IPv6 port hijack
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m53s
Bài học từ VietReport VPS shared (2026-04-23): Next.js app hijack port
3000 IPv4 → Gitea bị đẩy IPv6-only → IIS ARR localhost:3000 resolve
IPv4 first → git.baocaogiaoduc.vn trả homepage VietReport.

Apply 3 rules G-084 preemptively cho SOLUTION_ERP (risk thấp vì API
in-process IIS, nhưng vẫn chuẩn hóa):

1. `scripts/deploy-iis.ps1` — HealthUrl `localhost` → `127.0.0.1`
2. `.claude/skills/iis-deploy-runbook/SKILL.md` — 7 ref localhost →
   127.0.0.1 + section Hardening mới giải thích G-084 + 3 rules + note
   SOLUTION_ERP relevance (risk thấp vì no standalone Kestrel/no ARR
   proxy hiện tại, nhưng tương lai thêm phải tuân)
3. `docs/gotchas.md` — thêm entry #33 G-084 full writeup (triệu chứng,
   root cause, 3 rules, SOLUTION_ERP relevance) + update debug
   checklist

3 rules:
- Reverse-proxy luôn IP literal 127.0.0.1, không localhost
- Backend services bind loopback IPv4 explicit, không 0.0.0.0
- Service dependency cho boot order khi nhiều service cùng port family
2026-04-23 17:34:22 +07:00
aaf03be8d7 [CLAUDE] Docs: chốt Phase 6 — Module Duyệt NCC E2E
Update 5 file:
 - STATUS.md: phase hiện tại + recently done 4 entry + cumulative stats
   (46 tables, ~110 endpoints, 12 migrations, ~26 FE pages)
 - HANDOFF.md: TL;DR + thêm row "Module Duyệt NCC E2E" 
 - changelog/migration-todos.md: thêm Phase 6 section với checklist
   done/optional (PE Workflow admin UI + Attachments + Auto-map
   Details skip MVP)
 - database/schema-diagram.md: Migration 12 row + section 11 "PurchaseEvaluation
   module" full (10 bảng + state machine + kế thừa HĐ flow)
 - changelog/sessions/2026-04-23-2300-purchase-evaluations.md: session
   log đầy đủ (user input + design + 4 commit + stats + skip MVP notes)
2026-04-23 17:01:53 +07:00
a7ea6ad3d6 [CLAUDE] Docs: chốt session 2026-04-23 tối — UAT-ready 100%
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m48s
5 commit feature work session 2 (072ad6dbcdc007) — clear hết task
pending high-impact, sẵn sàng UAT.

## Session log mới

`docs/changelog/sessions/2026-04-23-2200-roles-demo-pending-cleanup.md`
~270 dòng — outcome A→G (RolesPage + 7 demo HĐ + User-kind guard +
Warning SLA + Edit detail + Master expand + Deps script), stats,
architectural notes, next priority.

## STATUS.md

- Last updated 2026-04-23 22:30 — UAT-ready 100%
- Header phase: "Pending tasks cleared — UAT-ready"
- 5 Recently Done row mới (RolesPage, demo HĐ, user-kind+SLA, edit
  detail+deps, master expand+backfill)
- Cumulative table thêm cột "+RolesPg+Demo+Pending":
  - LOC ~7800 → ~8800
  - Endpoints ~80 → ~93
  - FE pages ~22 → ~23 (RolesPage)
  - Scripts 4 → 5 (deps-audit.ps1)
  - Demo data 5+3 → 15+8+7+13+4 (NCC/Project/HĐ/User/Catalogs)
  - Commits ~47 → ~52
- Session log link mới
- Skills count = 14 file

## HANDOFF.md

- TL;DR cập nhật: UAT-ready 100%, demo data đầy đủ inventory
- Phase table thêm 6 row Done (RolesPage, demo HĐ, user-kind+SLA,
  edit detail, master expand, deps script)
- Git state 8 commit gần nhất

## migration-todos.md

- Section "Session 2026-04-23 (tối)" với 8 ticked checkbox + commit refs
- 3 Roles CRUD checkbox legacy → ticked với commit 072ad6d ref

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 16:07:20 +07:00
ff5e35f279 [CLAUDE] Docs: chốt session 2026-04-23 chiều — toolkit + 4-bảng + master + roles VN
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m47s
11 commit feature work (b75448eae59cfe) → docs sync.

## STATUS.md

- Last updated 2026-04-23 16:00
- Phase header: Tier 3 + 4-bảng + master catalogs + roles VN
- 7 Recently Done row mới (3-panel layout, 4-bảng overhaul, Thao tác
  2-panel, Mã HĐ gen Create, master catalogs, roles VN demo users)
- Cumulative table thêm cột "+Toolkit/Catalogs/Roles" (DB 36, endpoints
  ~80, migrations 11, commits ~47)
- Session log link mới
- Skill list count = 13 file

## HANDOFF.md

- TL;DR cập nhật: 36 tables, 80 endpoints, 11 migrations
- Phase table thêm 5 row Done (3-panel, 4-bảng, mã HĐ, master, roles)
- Git state 18 commit gần nhất
- Credentials block thêm 13 demo user (User@123456) — warn rotate trước UAT

## migration-todos.md

Section "Session 2026-04-23 (chiều)" với 14 ticked checkbox + commit refs.

## schema-diagram.md

- Header: 24 → 36 bảng
- Migration table thêm row 9-11 (highlighted)
- Section 8bis mới: chi tiết 7 Details + ContractChangelogs + 4 Catalogs +
  Role.ShortName + User.DepartmentId/Position

## Session log mới

`docs/changelog/sessions/2026-04-23-1500-toolkit-data-roles.md` (~270
dòng) — outcome A→I, stats cumulative, 6 architectural decisions, next
session priority.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 14:39:48 +07:00
d43d2c0024 [CLAUDE] Docs: chốt session 2026-04-23 — skill governance + cron audit
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m46s
- Session log 2026-04-23-0900-skill-governance.md (A→E):
  khảo sát alirezarezvani/claude-skills + quyết định không bulk-clone,
  3 skill ops mới (dependency-audit-erp, ef-core-migration,
  iis-deploy-runbook), rules §9 + audit cadence cron 1/tháng,
  touch-points 6 file index
- STATUS: Recently Done 2 row mới (b904a25 governance + 661f859
  3 skill), header phase = "Tier 3 + skill governance",
  session log count → 12 file, link skills README.md
- HANDOFF: Last updated → 2026-04-23 09:30, TL;DR mention skill
  governance setup, table phase tier thêm row Skill governance ,
  Skills callout "PHẢI dùng khi task khớp" + audit cron next 2026-05-01,
  git state cập nhật 3 commit gần nhất

Cron task verified live qua list_scheduled_tasks: nextRunAt =
2026-05-01T02:05:48.000Z (jitter 348s).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 00:30:37 +07:00
b904a25dc1 [CLAUDE] Skill: governance + audit định kỳ hàng tháng
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m48s
- rules.md §9 mới: liệt kê 6 skill (3 domain + 3 ops) với trigger,
  nguyên tắc tạo skill project-specific (không clone generic),
  format SKILL.md bắt buộc, audit workflow §9.4 chi tiết 7 bước,
  4 anti-patterns
- CLAUDE.md (root): block "🛠️ Skills" callout 6 skill + audit cadence
  + commit scope thêm `Skill`
- HANDOFF.md: section A1 — định kỳ audit, lần kế tiếp 2026-05-01
- migration-todos: section "Skill governance (recurring)" với checkbox
  audit hàng tháng

Cron task tạo qua scheduled-tasks (ID: solution-erp-skill-audit-
monthly): chạy 9:00 AM ngày 1 mỗi tháng. Self-contained prompt cold-
start để session tự audit + log vào docs/changelog/skill-audit-
{YYYY-MM}.md. Auto-refresh stale skill nhỏ, đề xuất add/archive cho
human approve.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 00:12:54 +07:00
661f8595f8 [CLAUDE] Skill: thêm 3 skill ops project-specific
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m47s
Khảo sát alirezarezvani/claude-skills repo — phần lớn skill đã có ở
user-level (code-reviewer, sql-database-assistant, focused-fix,
senior-frontend, mcp-builder...). Bulk import sẽ trùng + nhiều skill
là doc-dump generic không có YAML when-to-use.

Thay vào đó: viết 3 skill PROJECT-SPECIFIC encode kiến thức
SOLUTION_ERP-only mà generic không thể biết:

- dependency-audit-erp: dotnet list --vulnerable + npm audit cho
  fe-admin/fe-user, respect pin constraint MediatR 12.4.1 +
  Swashbuckle 6.9.0 + Node 20.x, dẫn chiếu gotchas, output template
  + CI integration TODO Phase 5.1

- ef-core-migration: 8 migration history + 3-file rule + Design
  TimeDbContextFactory + 6 pitfalls cụ thể (bao gồm cascade vs
  restrict cho WorkflowDefinitionId), workflow add entity mới end-
  to-end, prod apply via idempotent script

- iis-deploy-runbook: 3 IIS site topology + win-acme cert + NSSM
  gitea-runner shared VIETREPORT + LibreOffice 25.8.6 headless,
  debug playbook 500/502/SignalR/login, deploy steps + manual
  emergency, rotate creds + backup commands, dẫn chiếu gotcha #25/26/28/29

Skills README cập nhật: 6 skill (3 domain + 3 ops). CLAUDE.md
+ docs/CLAUDE.md sync count.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 23:44:24 +07:00
fbca83264c [CLAUDE] Docs: chốt session Tier 3 feature-complete + versioned workflow
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m33s
- Session log 2026-04-22-0300 (A→K): attachment, SignalR, form builder,
  PDF, dynamic + versioned workflow, nested menu, 3-panel permissions,
  seed master, brand identity, content polish, Gitea fix
- STATUS: Tier 3 feature-complete snapshot + cumulative stats (24 tables,
  ~50 endpoints, 8 migrations); next-up = UAT + Email SMTP (blocked) +
  rotate creds + SQL backup schedule
- HANDOFF: rewrite brief cho session mới — phase 5 prod done, Tier 3
  đóng gói, quick sanity-check 2 app, versioned workflow quick ref,
  file active hiện trạng, git state
- migration-todos: tick Tier 3 items (attachment/realtime/form builder/
  PDF/dynamic+versioned workflow/nested menu) + thêm iter-3 versioned
  workflow section + post-launch list
- schema-diagram: +5 table (Notifications, WorkflowTypeAssignments,
  WorkflowDefinitions, WorkflowSteps, WorkflowStepApprovers); indexes
  mới, cardinality FK restrict cho pinned policy, truy vấn tiêu biểu
- workflow-contract: +section 7bis resolution order, 7ter admin
  designer flow, updated data model + code pointers Tier 3
- PROJECT-MAP: module map post-Tier-3 (3 box mới Notification/
  Attachment/Branding + Infra/DevOps box), API namespace đầy đủ,
  architectural wins 5 điểm
- contract-workflow skill: versioned workflow section, policy
  resolution code snippet, admin designer flow, code pointers Tier 3,
  tier 4+ backlog
- gotchas +7 bẫy mới (#26-32): SignalR WebSocket headers, interceptor
  2-phase pattern, LibreOffice mirror 404, PS 5.1 UTF-16 GITHUB_PATH,
  PS 5.1 diacritics parse, Dialog size TS, NavLink end query-params

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 10:25:02 +07:00
29dbac2051 [CLAUDE] Docs: STATUS update cho versioned workflow + nested menu user
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m38s
2026-04-22 09:37:53 +07:00
fb3a410a1b [CLAUDE] Docs: STATUS update cho seed master data + MyDashboard
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m46s
2026-04-21 22:12:08 +07:00
4690cc3a81 [CLAUDE] Docs: STATUS update — PDF + workflow policy + form builder iter2 E2E verified
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m38s
2026-04-21 21:54:21 +07:00
cae4d84830 [CLAUDE] Domain+Infra+App+FE: dynamic workflow policy per ContractType
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m42s
Đọc QT-TP-NCC.docx: quy trình 9 bước chỉ áp dụng cho Thầu phụ/NCC/Tổ đội.
Dịch vụ/Mua bán/Nguyên tắc bypass CCM. Thay hardcoded dict bằng policy
registry.

Domain — WorkflowPolicy.cs:
- Record WorkflowPolicy { Name, Description, Transitions, PhaseSla,
  ActivePhases } — pure data, testable.
- WorkflowPolicies.Standard: 9-phase full (Thầu phụ/Giao khoán/NCC)
- WorkflowPolicies.SkipCcm: 7-phase (Dịch vụ/Mua bán/Nguyên tắc)
- WorkflowPolicyRegistry.For(type) map ContractType → policy
- WorkflowPolicyRegistry.ForContract(c) override nếu BypassProcurement
  AndCCM=true (instance-level escape hatch)

Infrastructure — ContractWorkflowService:
- Xóa hardcoded Transitions/PhaseSla dicts → load từ policy.ForContract
- TransitionAsync: validate qua policy.Transitions thay vì dict local
- Error message include policy.Name để debug dễ hơn
- GetPhaseSla trả SLA từ Standard policy (fallback — SLA hiện tại giống
  nhau giữa 2 policy)

Application — ContractDetailDto:
- Field mới `Workflow: WorkflowSummaryDto { PolicyName, Description,
  ActivePhases, NextPhases }` — FE dùng để render nút chuyển phase
  dynamic + timeline card.
- BuildWorkflowSummary helper trong ContractFeatures.

FE (both apps):
- Type WorkflowSummary + ContractDetail.workflow
- ContractDetailPage xóa hardcoded NEXT_PHASES — dùng
  c.workflow.nextPhases từ BE (single source of truth)
- WorkflowSummaryCard: timeline của ActivePhases với check/current/
  future states + policy name/description ở header
- Card hiển thị trong sidebar, phía trên "Lịch sử duyệt"

Docs:
- gotchas.md #21 marked RESOLVED (NEXT_PHASES sync không còn cần)

Foundation: sau này admin có thể edit policy qua UI khi chuyển sang DB-
backed policy — nhưng API contract (WorkflowSummaryDto) đã stable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:46:31 +07:00
acc134a2fd [CLAUDE] Docs: STATUS update cho Form template builder + Gitea 500 fix
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Failing after 2m23s
2026-04-21 21:21:46 +07:00
c52186bed0 [CLAUDE] Docs: gotcha #25 — Install-WindowsFeature Web-WebSockets locks webSocket section in applicationHost
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 2m24s
2026-04-21 21:10:43 +07:00