Skip to content

feat(triage): chat-channel messages, set authoring, context-aware remediation - #18

Merged
dalpan merged 1 commit into
feature/demo-datafrom
feature/triage-whatsapp
Oct 30, 2026
Merged

dalpan merged 1 commit into
feature/demo-datafrom
feature/triage-whatsapp

Conversation

@dalpan

@dalpan dalpan commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Stacked on #17.

What

  • POST /api/triage (trainer): author triage sets. Validation: id ^[a-z0-9-]+$, language en/id, 4–40 items, must contain both pretexts and legitimate messages, each pretext needs principle + explanation. Duplicate id → 409. Audited.
  • Chat channels in Triage Inbox: whatsapp / sms items render as a phone-style chat pane; set picker appears when more than one set exists.
  • Translatable remediation reasons: assignments store reason_key + reason_params; My Assignments renders them via remediation.* keys (EN/ID).
  • Context-aware remediation: picks content with the most overlapping context tags (indonesia, satuan, military) and excludes the exercise that was just failed; retests do the same. Titles no longer get a Remediation: prefix.
  • Scenario debrief keeps line breaks; removed duplicate untranslated "Try another scenario" button.
  • docs/api.md: triage, readiness and demo endpoints.

Why

Chat-based pretexts are a primary lure channel but cannot ethically be sent to personal phones; the lab measures them as a triage channel scored with d′ (false flags on legitimate messages are penalised). Remediation for a localized failure should stay in the same context instead of falling back to a generic English scenario.

Testing

  • pytest: 219 passed (new tests for set authoring/validation, translated reasons, context preference + failed-exercise exclusion)
  • ruff check / ruff format clean
  • CI=true craco build OK
  • Manual: played a WhatsApp triage set and a failing scenario as trainee; remediation picked a same-context scenario with a localized reason.

🤖 Generated with Claude Code

…ediation

- POST /api/triage lets trainers add triage sets (validated: id pattern,
  4-40 items, must mix pretexts and legitimate messages, every pretext
  needs a principle and explanation); audited.
- Triage Inbox renders WhatsApp/SMS items as a phone chat and offers a
  set picker when more than one set exists.
- Remediation assignments carry reason_key/reason_params so the reason is
  translated in the UI instead of stored as English text.
- Remediation prefers content sharing context tags with the failed
  exercise and never re-assigns the exercise that was just failed;
  retests follow the same rule.
- Scenario debrief keeps line breaks; removed duplicate untranslated
  "Try another scenario" button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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