P3D4C2X Event Outbox Filter Discovery & Config Plan
P3D4C2X — Event Outbox Filter Discovery & Config Plan
- phase: P3D4C2X_EVENT_OUTBOX_FILTER_DISCOVERY_AND_CONFIG_PLAN
- phase_status: PASS
- mutation_performed: false
- date: 2026-05-10
- mode: READ-ONLY discovery
1. Inventory (event_outbox)
Sampled via Directus Items API: 200 most recent + 100 oldest by occurred_at. Both ends identical.
Distinct value counts (n=200, sorted -occurred_at)
| Field | Distinct values (count) |
|---|---|
| event_domain | system (200) |
| event_subject_table | system_issues (200) |
| event_type | issue_opened (200) |
| event_stream | alert (200) |
| delivery_lane | immediate (200) |
| event_severity | critical (195), warning (5) |
| source_system | trigger (200) |
| payload_classification | safe_metadata (200) |
| actor_ref | heal_description_basic (194), dot-dot-health (3), dot-context-pack-verify (3) |
| canonical_address (sample) | system://issues/20337..20356 (all system://issues/<id>) |
Oldest 100 by occurred_at: identical pattern (system / system_issues / issue_opened).
IU candidate scan
Filter event_domain ∈ {information_unit, iu, piece, text_as_code, tac} OR event_subject_table ∈ {information_units, information_unit, pieces, documents, text_as_code} OR canonical_address contains information_unit/text-as-code → 0 rows.
- iu_filter_candidate_found: false
- distinct_event_domain_counts:
{system: 200} - distinct_event_subject_table_counts:
{system_issues: 200}
2. table_registry filter precedent
tbl_system_issues (id=20) demonstrates DirectusTable filterOptions support:
{ "key": "severity", "filterable": true, "filterOptions": [
{"label": "Nghiêm trọng", "value": "nghiêm_trọng"},
{"label": "Cảnh báo", "value": "cảnh_báo"},
{"label": "Thông tin", "value": "thông_tin"}
] }
→ filterable: true + optional filterOptions: [{label, value}] is the supported config-only pattern. No Nuxt code change required.
3. Current tbl_event_outbox filter config
filterable: true on: event_domain, event_type, event_stream, delivery_lane, event_severity, source_system, payload_classification.
No filterOptions defined on any field.
default_filter: null.
4. Decision branch → Case C
Case C applies: no IU events exist in event_outbox at all. Adding a "Miếng thông tin" filter now would render an empty result set and mislead users.
- recommended_filter_field: (defer "Miếng thông tin"; expose existing real domains for now)
- recommended_filter_values: see Section 5 proposal
5. Proposed config patch (NOT applied — awaiting approval)
5a. Add filterOptions to event_severity (highest signal)
{ "key": "event_severity", "filterable": true, "filterOptions": [
{"label": "Nghiêm trọng", "value": "critical"},
{"label": "Cảnh báo", "value": "warning"}
] }
5b. Add filterOptions to event_domain (single real value today, future-ready)
{ "key": "event_domain", "filterable": true, "filterOptions": [
{"label": "Hệ thống", "value": "system"}
] }
5c. Add filterable + filterOptions to event_subject_table
{ "key": "event_subject_table", "filterable": true, "filterOptions": [
{"label": "Sự cố hệ thống", "value": "system_issues"}
] }
Notes:
- Do NOT add a "Miếng thông tin" option until real IU events exist.
- Keep
default_filter: null(default = all). - No fields visibility change. No permission change.
6. Requirement for IU emission (next pack)
For "Miếng thông tin" filter to be meaningful, the event core must emit:
event_domain = 'information_unit'(canonical) for all IU lifecycle eventsevent_subject_table∈ {information_unit canonical table name(s)}canonical_addresslikeinformation_unit://<id>(oriu://<id>)
Once at least one such event is persisted, a follow-up pack can add:
{ "key": "event_domain", "filterOptions": [
{"label": "Hệ thống", "value": "system"},
{"label": "Miếng thông tin", "value": "information_unit"}
] }
7. Boundaries respected
- No table_registry mutation
- No Directus permission change
- No Nuxt code change
- No deploy / restart / build
- No PG mutation
- No fields visibility change
8. Routing
- next_required_pack: P3D4C2X_IU_EVENT_EMISSION_REQUIREMENT
- followup_pack (optional, parallel-safe, applies real-data filters now): P3D4C2X_EVENT_OUTBOX_FILTER_CONFIG_PATCH (apply Section 5 patch — no IU value yet)
- final resume after both: P3D_INFORMATION_UNIT_TEXT_AS_CODE_RESUME
Rationale for ordering: emit IU events first so the filter option lands on a non-empty population; otherwise the patch ships a misleading "Miếng thông tin" option.