Skip to content

feat(context): canonical report-flag vocabulary + validation#428

Merged
hyoshi merged 1 commit into
mainfrom
feat/report-flags-contract
Jul 15, 2026
Merged

feat(context): canonical report-flag vocabulary + validation#428
hyoshi merged 1 commit into
mainfrom
feat/report-flags-contract

Conversation

@hyoshi

@hyoshi hyoshi commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

Report-flag chips on the Reports dashboard were free-form snake_case strings
with their detail baked in, e.g. adspot_4311492_invalid_traffic_spike_115740yen_0cv_ctr4.66pct.
Read as bare chips they were too detailed for an at-a-glance tag, could not be
localized (English-only in the Japanese UI), and mixed positive/informational
flags in with alarms so a coherent report read as self-contradictory.

This PR (backend contract — base of a 3-PR stack)

Introduce a canonical flag vocabulary and validate/normalize a report's
flags at the mureo_state_report_set boundary:

  • mureo/analysis/report_flags.pyFLAG_SEVERITY (18 canonical codes →
    default severity), SEVERITIES (action/watch/info/positive), and
    normalize_flags().
  • A structured flag is {code, severity, params}: code from the vocabulary,
    severity defaulted from the code, params carrying the detail (adspot ids,
    yen, ctr) — so the chip stays coarse and the numbers move to a drill-down.
  • code: "custom" is an explicit escape hatch (author-supplied label +
    severity) for a finding outside the vocabulary. Unknown non-custom codes
    are rejected.
  • Backward compatible: legacy bare-string flags pass through untouched.
  • Fail-closed: validation runs before the STATE.json write (a rejected flag
    never reaches disk).

Tests

tests/test_report_flags.py (vocabulary contract, legacy passthrough, custom
hatch, immutability, boundaries) + handler integration tests in
tests/test_mcp_tools_mureo_context.py. ruff/format clean, new code mypy-clean.

Stack

  • This PR (A)main — backend vocabulary + validation.
  • PR C → renders structured flags as coarse, localized chips (frontend/i18n).
  • PR B → teaches the daily-check skill to author structured flags.

PR B and PR C both depend only on this PR. Merge order: merge this PR first;
the children retarget to main (retarget before deleting this branch).

…ation

Add a fixed vocabulary of report-flag codes each mapped to a severity
bucket (action/watch/info/positive), and validate/normalize a report's
`flags` in mureo_state_report_set. Structured flags {code, severity,
params} keep detail in params (not the code) so the dashboard can show a
coarse, localizable chip; a `custom` code carries an author label for
novel findings. Legacy bare-string flags pass through unchanged.
@hyoshi
hyoshi merged commit 24906d4 into main Jul 15, 2026
9 checks passed
@hyoshi
hyoshi deleted the feat/report-flags-contract branch July 15, 2026 07:55
hyoshi added a commit that referenced this pull request Jul 15, 2026
Bump 0.10.26 -> 0.10.27 (pyproject, __init__, plugin.json, 51 SKILL.md
frontmatters) and cut the CHANGELOG for the report-flag changes merged since
0.10.26 (#428 / #429 / #430 / #431).

Added — structured, localizable report-flag chips on the Reports dashboard:
flags persisted via mureo_state_report_set can be {code, severity, params} from
an 18-code vocabulary; the dashboard renders coarse, localized (en / ja),
severity-coloured chips with the detail on a click-to-expand drill-down. The
daily-check / weekly-report / goal-review skills author flags in this shape.

Changed — mureo_state_report_set validates report flags (unknown non-custom
codes rejected, severities defaulted); legacy bare-string flags still pass through.
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