KB-315F

S145-M1 Scanner Automation + Auto-Apply Report

4 min read Revision 1
reports145automationscannerdieu32cron

S145-M1: Scanner Automation + Auto-Apply — Report

Date: 2026-03-28 | OR: v6.5


Step 0: Checkpoint

  • OR v6.5 confirmed. AP-09+10 read. Assembly Gate 6/6.
  • Merge rule: 4 required GREEN = MERGE NGAY. CẤM --admin.

Targets

# Target Status
1 Cron daily 2:30AM DOT-115 DONE
2 Cron weekly Sun 3AM DOT-116 DONE
3 Auto-apply PG function DONE — auto_apply_approval()
4 Expired mechanism 30d DONE — expire_stale_approvals()
5 End-to-end automation DONE — E2E test PASS
6 FIX DOT-116 excluded→observed DONE — v1.1.0, 17 junctions reclassified
7 Birth trigger coverage audit DONE — 4 gaps documented

Changes

DOT-116 Fix (v1.0.0 → v1.1.0)

  • Rule 1: junction tables now propose observed + atom (Dieu 0-B), NOT excluded (AP-10)
  • Rule 2: directus internal tables now propose observed, NOT excluded
  • Extended junction patterns: +_contacts, +_items, +_logos, +_rows

PG Functions Created

  • auto_apply_approval() — Loai 2: birth_orphan + reclassify, normal/low priority, scanner source
    • meta_catalog auto-create from collection_registry data
    • dot_tools auto-register
    • collection_registry governance_role update
    • Error handling: try/catch per item, log errors in review_note
  • expire_stale_approvals() — pending > 30 days → expired

Cron Entries (4 new)

  • 30 2 * * * — DOT-115 orphan scanner daily
  • 0 3 * * 0 — DOT-116 misclass scanner weekly Sunday
  • 30 4 * * * — auto_apply_approval() daily (after scanners)
  • 0 5 * * * — expire_stale_approvals() daily

Junction Reclassification

  • 17 junction tables: excluded → observed (auto-applied)
  • Collections: block_columns_rows, block_gallery_files, block_logocloud_logos, block_step_items, block_testimonial_slider_items, checkpoint_set_items, navigation_items, navigation_navigation_items, organizations_contacts, os_activity_contacts, os_deal_contacts, os_invoice_items, os_items, os_project_contacts, os_proposal_contacts, os_task_files, post_gallery_items

Test Results

Test Result
On-demand scanner 0 orphans
Auto-apply (empty) 0 applied (correct)
Auto-expire (empty) 0 expired (correct)
E2E simulation PASS: insert → auto-apply → DOT-148 created → cleanup
Misclass scanner 17 junctions found → auto-applied → 0 remaining
Re-scan orphan 0 findings
Re-scan misclass 0 findings

VERIFY NUXT


§0-AW AUTOMATION CHECK

  1. Feature chạy TỰ ĐỘNG? CÓ. 4 cron entries.
  2. DUAL-TRIGGER?
    • dot-orphan-scanner: cron=CÓ (2:30AM daily), on-demand=CÓ (./dot/bin/dot-orphan-scanner)
    • dot-misclass-scanner: cron=CÓ (Sun 3AM), on-demand=CÓ (./dot/bin/dot-misclass-scanner)
    • auto-apply: cron=CÓ (4:30AM daily), on-demand=CÓ (SELECT auto_apply_approval())
    • expire: cron=CÓ (5AM daily), on-demand=CÓ (SELECT expire_stale_approvals())
  3. End-to-end liền mạch? CÓ. Scanner → approval_requests → auto-apply → Directus → Nuxt UI.

Gaps (TD)

TD Description Priority
TD-430 4 governed collections without birth triggers: approval_requests, law_catalog, measurement_registry, pivot_definitions normal
TD-431 141 collections with migration_state=unclassified low

Final State

  • approval_requests: applied=159, rejected=1, pending=0
  • Orphan scanner: 0 findings
  • Misclass scanner: 0 findings
  • DOT tools registered: 147/147
  • meta_catalog entries: 141
  • Cron entries: 16 total (4 new for Dieu 32)

S145-M1 DONE | 0 pending | 4 cron | 2 PG functions | DOT-116 v1.1.0 | 17 junctions reclassified