Skip to content

fix(action-center): show the measured result in an action's history - #1079

Merged
gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/action-history-outcome-event
Oct 17, 2026
Merged

gkhngyk merged 3 commits into
ansvisor:mainfrom
cihan-gyk:fix/action-history-outcome-event

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

The Action Center drawer's History tab renders each event from actionCenter.actionsPage.drawer.events.<event>. The Node server's validation sweep (server/src/lib/action-center/validate.js, write()) logs outcome_measured with data: { outcome }, where outcome is one of deriveOutcome's verdicts. There was no message for it, so every measured action got a History line with next-intl's missing-message text.

  • en.json: adds outcome_measured, an ICU select on {outcome}. It follows position_outcome_recorded's "…result: …" tone and keeps the validation module's wording: measured after this action closed, not because of it.
    • improved → Result: metrics improved after this action closed
    • declined → Result: metrics declined after this action closed
    • no_meaningful_change → Result: no meaningful change in metrics after this action closed
    • not_measurable → Result: could not be measured (no success metrics, or no data in either window)
    • other → Result measured (an unknown or missing verdict)
  • action-drawer.tsx: passes outcome: String(event.data.outcome ?? '') to the message, next to the values it already passes.
  • display.test.ts: the "History events" test from fix(action-center): show added, renamed and deleted tasks in an action's history #1078 now also reads the events the Node server's Action Center engine writes. It scans the non-test .js files under server/src/lib/action-center/ for logEvent(id, '…') and event: '…'. That finds created, signals_linked, task_ran, task_run_failed, task_awaiting_approval, position_outcome_recorded and outcome_measured, and each one must format. New tests check the text for each verdict and the other fallback. Without the new en.json key, 6 tests fail. (server/src/lib/action-center/tasks/plan.test.js already reads web/messages/en.json across the package boundary, so this follows that pattern the other way round.)

Stacked on #1078. This branch is based on fix/action-history-task-events because both change the same test and the same t() call. Until #1078 merges, this PR also shows its commit (df175d0). Only 78646f4 belongs to this PR. I'll rebase onto main once #1078 is in.

Note: #1070 moves the drawer's inline t() call into actionEventText in web/src/lib/action-center/display.ts. Whichever merges second needs outcome: String(event.data.outcome ?? '') added there. It's a one-line conflict, the same as #1078's title.

Related issue

None. Found while working on #1078.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Pick an action and give it outcome_measured events, either by letting the validation sweep measure a completed action or by inserting rows into action_events on a dev database (event = 'outcome_measured', data = {"outcome": "improved"}, and so on, plus one with {}).
  2. Open Action Center → Actions → that action → History.
  3. Each event reads as a "Result: …" line from the list above, not as the raw message key.
  4. cd web && yarn test src/lib/action-center/display.test.ts

I checked this in the browser at 1024px, in light and dark themes, with one event per verdict plus an empty one. I removed the test rows afterwards.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/) (0 errors; the 7 warnings are in files this PR doesn't touch)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

yarn test (679 tests) and yarn build also pass. npm run version:check already fails on main (docker-compose images 0.2.0 vs 0.3.0), and this PR doesn't change that.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 16, 2026 02:34
…n's history

The task_added, task_renamed and task_deleted events had no message under
drawer.events, so the History tab showed next-intl's missing-message text
for them. Added and renamed tasks are named as they were typed.

A test reads the events the server actions log and checks each one formats.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Node server's validation sweep logs outcome_measured with its verdict,
but drawer.events had no message for it, so the History tab showed
next-intl's missing-message text. Each verdict now reads in words, measured
"after this action closed" as the validation module puts it, and an
unknown or missing one reads as "Result measured".

The History events test also reads the events the Node server's Action
Center engine writes, so one added there without copy fails the test too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tcome-event

main now carries ansvisor#1078 as a squash; this branch keeps only its own outcome_measured change on top.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, approving. With #1078 squashed into main, I merged main into the branch so it keeps only its own outcome_measured change. The server's validation sweep already logs that event. CI is green.

@gkhngyk
gkhngyk merged commit 9cedd51 into ansvisor:main Oct 17, 2026
5 checks passed
gkhngyk added a commit to cihan-gyk/ansvisor that referenced this pull request Oct 17, 2026
The History line now comes from actionEventText, so the title (ansvisor#1078) and outcome (ansvisor#1079) values that main added inline move into it, with a test.
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.

2 participants