Skip to content

Retire the event-type waiver, and refuse a malformed event_type at intake - #27

Merged
monthop-gmail merged 1 commit into
mainfrom
chore/retire-stale-waiver
Aug 21, 2026
Merged

Retire the event-type waiver, and refuse a malformed event_type at intake#27
monthop-gmail merged 1 commit into
mainfrom
chore/retire-stale-waiver

Conversation

@monthop-gmail

Copy link
Copy Markdown
Owner

งานเล็กสองอันที่เจอตอนเชคสถานะ — เก็บให้จบก่อนไป #26

core          335 passed
observability 115 passed · intake.py และ errors.py 100%
conformance   exit=0 · 56 event ผ่านทุกตัว · ไม่มี waiver ทำงานอยู่แล้ว

1. waiver ที่ตายแล้ว แต่ยังกลืนของอยู่

agent-platform#17 ปิดไปตั้งแต่ 2026-08-18 — เขาแก้ให้แล้ว event_type อ้าง EventTypeName (ชุดเปิด บังคับแค่รูปแบบ ^[A-Z][A-Z0-9_]{2,63}$) ไม่ได้อ้าง $defs.EventType (ชุดปิด) อีก · pin ปัจจุบันมีตัวแก้นั้นอยู่แล้ว

แต่ known_gaps ใน conformance/pinned.yaml ยังค้างอยู่ หมดอายุ 2026-11-18

ปัญหาไม่ใช่ความรกรุงรัง — เงื่อนไขของ waiver คือ "error ที่ field event_type ของ event ที่ source.kind: external" ซึ่งครอบทั้ง ค่าที่ไม่รู้จัก และ ค่าที่ผิดรูป

ยัด event ภายนอกที่ event_type = "sighting recorded!!" เข้า scenario:

gap  payload: 1 event ติดช่องว่างที่รู้ตัว event-type-enum-closed
passed=20  FAIL=0        ← เขียว exit=0

event ที่ผิดรูปชัด ๆ ไหลเข้า audit log แล้ว CI บอกว่าเรียบร้อย — false ✅ ชนิดเดียวกับที่ repo นี้เจอมาแล้วสองครั้ง (คำว่า approval โผล่ในย่อหน้าอื่น · status ที่หาทั้งไฟล์) แต่คราวนี้มาจากฝั่งเราเอง

แยกสองที่ตามหน้าที่จริง

ไฟล์ คืออะไร ทำยังไง
conformance/pinned.yaml known_gaps เครื่องจักร — รายการที่ค้างยังทำงาน ถอดออก → []
platform-contract.yaml gaps: บันทึก — เหตุผลที่เคยเบี่ยง status: resolved + resolved_by + note

ข้อหลังทำตามธรรมเนียมที่ไฟล์นั้นเขียนไว้เองว่า "ข้อที่ปิดแล้วไม่ลบทิ้ง แต่ติด status: resolved"

เพิ่มคำเตือนไว้ในหัว known_gaps ด้วย เพื่อไม่ให้ครั้งหน้าค้างอีกด้วยเหตุผลเดิม

2. intake ปฏิเสธ event_type ที่ผิดรูป

ไม่ใช่การกลับคำเรื่อง "ค่าที่ไม่รู้จักต้องเก็บไว้"SIGHTING_RECORDED จาก navi-ims ยังรับเต็ม ๆ เหมือนเดิม

ไม่รู้จัก = ค่าที่เรายังไม่เคยเจอ → เก็บไว้ ไม่ตีความ ตาม event/v1
ผิดรูป = ไม่ใช่ค่าตั้งแต่แรก → ปฏิเสธที่ขอบ ตาม RFC-0008

EventTypeName บังคับรูปแบบชื่อ ไม่ใช่ตัวค่า เพื่อให้ vocabulary โตได้โดยที่ชื่อยังอ่านรู้ว่าเป็น event type

ค่า ผล
SIGHTING_RECORDED MEDICATION_TAKEN ABC ✅ รับ · is_recognised = False
"sighting recorded!!" lowercase Mixed_Case AB 9START "A"*65 MalformedEventType
✅ ปฏิเสธที่ intake: event_type='sighting recorded!!' does not match
   event/v1 EventTypeName ^[A-Z][A-Z0-9_]{2,63}$
   log ว่างเปล่า: True

EVENT_TYPE_PATTERN มิเรอร์ contract ด้วยเหตุผลเดียวกับ identity.ID_PATTERN — ขอบต้องปฏิเสธก่อนเขียนลง record ที่แก้ไม่ได้ และ contract อยู่คนละ repo · เป็นขั้นต่ำที่จำเป็นเพื่อปฏิเสธ ไม่ใช่ schema ขนานที่ RFC-0005 Rule 4 ห้าม (เขียนกำกับไว้ในโค้ดแล้ว)

เพิ่มเทสต์ที่ยืนยันว่า vocabulary ของเราเองทั้ง 9 ตัวผ่าน pattern — กฎที่ปฏิเสธคำของตัวเองคือกฎที่ผิด

3. ของแถม — ข้อความที่ชวนเข้าใจผิด

payload_check เคยพิมพ์ "56 event ผ่าน (ยกเว้นช่องว่างที่รู้ตัว)" ทุกครั้ง แม้ไม่มีอะไรถูกยกเว้น · ตอนนี้วงเล็บนั้นโผล่เฉพาะเมื่อมีของถูกยกเว้นจริง

จำนวน check ลดจาก 20 เป็น 19 เพราะไม่มี waiver ให้ตรวจอายุแล้ว — ไม่ใช่มีอะไรหาย

Impacted planes

Observability เท่านั้น · job state machine ไม่ถูกแตะ (core 335 tests ผ่านเหมือนเดิม)

Risk analysis

  • ปฏิเสธของที่เคยรับ (medium) → เฉพาะค่าที่ผิด pattern ของ contract ซึ่ง validate ไม่ผ่านอยู่แล้ว · ต่างกันแค่ตอนนี้ถูกจับที่ขอบแทนที่จะถูกกลืน · เทสต์ยืนยันว่า vocabulary ของเราเองและค่าที่ไม่รู้จักแต่ถูกรูปยังผ่าน
  • EVENT_TYPE_PATTERN drift จาก contract (low) → pattern อยู่ที่เดียว มี comment ชี้ไป EventTypeName · ถ้า contract ผ่อนรูปแบบ conformance จะยังเขียว (เราเข้มกว่า) แต่ถ้าเขาเข้มขึ้น payload ของเราจะแดงทันที ซึ่งเป็นทิศที่ปลอดภัย
  • ถอด waiver แล้วมีของแดงที่ยังไม่รู้ (low) → รันจริงแล้ว 56 event ผ่านหมด ไม่มีตัวไหนพึ่ง waiver อยู่

Related

#26 (งานใหญ่ถัดไป) · agent-platform#17 · RFC-0008 · RFC-0009

🤖 Generated with Claude Code

…take

agent-platform#17 closed on 2026-08-18 — event/v1's event_type refs EventTypeName,
an open set constrained by shape, instead of the closed $defs.EventType enum. The
waiver we recorded against it stayed behind in conformance/pinned.yaml.

A waiver left behind after its cause is fixed does not sit there harmlessly. Its
condition was "any validation error at event_type on an external event", which
covers a value we have not met and a value that is not a value at all. Injecting
an external event typed "sighting recorded!!" into the scenario showed it being
tolerated with the run still green at exit 0 — the same false-green shape this
repository has already been bitten by twice, from the wrong side this time.

So both halves are dealt with. known_gaps goes to an empty list, with a note at
the top saying why a retired entry has to be removed rather than left: that list
is machinery and a stale entry still runs. The record of what we deviated on and
why stays in platform-contract.yaml under gaps:, which is documentation and marks
closed entries status: resolved rather than deleting them, following the
convention already in that file.

Intake now refuses a malformed event_type. This is not a reversal of the rule that
an unrecognised type is kept: event/v1 says keep what you do not recognise and skip
interpreting it, and SIGHTING_RECORDED from navi-ims is still accepted whole.
EventTypeName constrains the shape of the name so a vocabulary allowed to grow
still reads as a vocabulary. Unknown is a value we have not met; malformed is not
a value, and RFC-0008 puts that refusal at the boundary rather than in a record
nobody can correct. EVENT_TYPE_PATTERN mirrors the contract for the same reason
identity.ID_PATTERN does, and is the minimum needed to refuse rather than a second
copy of the schema.

One line of output was also saying "except for known gaps" on every run whether or
not anything had been excepted, which invites a reader to assume a waiver is at
work. It now appears only when something was actually tolerated.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@monthop-gmail
monthop-gmail merged commit 773ffd3 into main Aug 21, 2026
5 checks passed
@monthop-gmail
monthop-gmail deleted the chore/retire-stale-waiver branch August 21, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant