Repository navigation
feat(action-center): measure a night-engine action on the prompts or pages it names, brand-wide beside (learning A1) - #1688
Merged
Conversation
… measured result Learning phase A, A3 (the agentic learning report, gaps 2 and 4). An action's result compared its metrics before and after, but never asked the question closest to its own aim: did the signals that raised it end? Signals close as resolved (the condition gone) or resolved with `supersededBy` (still there, as another kind), and that never reached the outcome. - validate.js: when an action is measured, signalOutcome reads its signals through action_signals and keeps the counts in `validation.signals`: total, ended, replaced, dismissed, open. An action with no metric to measure keeps them too (its validation was null). An action no signal raised (sent from Content, Insights…) has none. - History's drawer says it under Result: "Of the 4 signals that raised it, when measured: 2 ended, 1 turned into another, 1 still open." - The Action Center guide says so. The outcome itself is unchanged; A4 decides what counts as improved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pages it names, brand-wide beside
Learning phase A, A1 (the report's gap 2). The night engine's actions
were measured on the whole brand's figures, so "recover 6 prompts" was
judged by every prompt the brand tracks, and a small real effect drowned
in the rest. Their targets are in the payload already.
- validate.js: an action whose payload's targetEntity is 'prompts' or
'pages' (targetScope) is measured on those targets with the basket
measure the actions sent from Content use: every target it counts
(targetIds, else targets), prompt ids as uuids, a page written as a
path read on the brand's primary domain. The metrics are its basket
KPIs that the action names (all six when it names none). The brand-wide
figures over the same windows are kept as `brandWide`, and
`scope: { kind: 'targets', entity, prompts, pages }` says what it was.
- A basket that measured nothing (no answers in either window) leaves the
action to the brand-wide measure, as before; so does any other target
(competitors, sources…).
- History's drawer: "Measured on the 2 prompts it named." under Result, and
"Brand-wide over the same days: Citations 100 → 104" under the cards.
- The guide says so.
Stacked on feature/outcome-signals-resolved (A3): both change
validateAction.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…akes The A1 drawer test built its metrics with unit 'count', which ActionResultMetric doesn't take: tsc failed on the test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
Own change. cc2031b and ac1b1af on top of #1687 (origin/pr/1687..origin/pr/1688). Once #1687 is squashed, this PR's own change applies to main cleanly; GitHub will show conflicts in action-center.mdx until the branch takes main after that squash.
Checked
- Targets.
targetScopereadstargetIdswhen the payload has them, elsetargets[].id. Prompts must be uuids. Pages must be http(s), or a path read on the brand's primary domain; a path with no domain is dropped rather than guessed. Any othertargetEntity(competitors, sources, platforms) stays brand-wide, as before. - Measure. The basket goes through
opportunity_basket_metricswith the same windows as the brand-wide measure. Empty prompt or page arrays read nothing there, not everything, so a pages basket can't read the whole brand's visibility. The brand-wide figures over the same windows are kept asbrandWide, andscope.kind: 'targets'tells them apart from content baskets, soopportunity-reopen.js(which readskind === 'basket') doesn't pick these up. - Web.
measuredOnFromshows the line only forkind: 'targets'with a count above 0, and the brand-wide line goes throughresultsFrom, so a half-measured pair is dropped there too. - Tests. On this PR's tree,
validate.test.jspasses (26) andhistory-drawer.test.tsxpasses (6). They also pass with the stack and main squashed together.
Follow-ups
- A pages basket always "measures" citations.
basketValuesreturnscitationsas a number whenever there are pages (basket-metrics.js:71), 0 when nobody cites them. So the check atvalidate.js:383is true for every pages basket, and the brand-wide fallback never runs for pages. For a Site Audit fix with no success metric (F03, F10…), the result moves from "Not measurable" to "No meaningful change" on Citations 0 → 0, and with #1690 citations become the main metric of a pages target. Treat a pages basket with no citations in either window (and no GA) as measured nothing, so it falls back as the description says. - Units on the brand-wide line.
history-drawer.tsx:254printsbefore → afteras bare numbers, so AI Visibility and Share of Voice read "12.3 → 14.1" without the%the cards above show. Format them with the same helper the cards use.
Before the API deploy. Nothing shows. Both new lines need the deployed sweep's scope.kind: 'targets' and brandWide; actions measured before keep their result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Learning phase A, A1: a night-engine action is measured on the prompts or pages it names, with the brand-wide figures beside.
Stacked on #1687. This PR's own commits: cc2031b and ac1b1af.
The night engine's actions were measured on the whole brand's figures. So "recover 6 prompts" was judged by every prompt the brand tracks, and a small real effect drowned in the rest. The targets were already in the payload.
targetEntityispromptsorpagesis measured on those targets. It uses the same basket measure as the actions sent from Content.targetIds, elsetargets): prompt ids as uuids, and a page written as a path, read on the brand's primary domain.brandWide, andscope: { kind: 'targets', entity, prompts, pages }records what the action was measured on.Where people see it: Action Center › History › an action › Result.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/action-center/validate.test.jscd web && npx vitest run src/components/action-center/history-drawer.test.tsxRelated issue
Agentic learning report (artifact; draft in the maintainers' notes), phase A: "measure correctly". No GitHub issue. Learning stays within one brand (product decision).
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks at the top of the phase A stack (A5, 596dba6):
npm test(noSUPABASE_*env, as in CI): 3,359 tests passed.content-people.test.jstimed out under load and passed alone (32/32).vitest(444 files, 4,348 tests) and build: all pass.A pre-push review of the six branches was run, and its before-merge findings are fixed in the stack (A4: 18e00bc, 5500708, c427343, cc1f9c8; A6: 381f5c6, 52a34fb; A5: 639c3a17). Only new measurements change. Actions already measured keep their result; there's no backfill.
🤖 Generated with Claude Code