Repository navigation
feat(action-center): send a page from its Site Audit report to the Action Center (learning D2) - #1709
Conversation
…tion Center as a Fix action
Learning D2. A Site Audit report showed what a page fails, but the only way
to the Action Center was the nightly pass, a day later and grouped with
other pages. A person can now send the page from its report at once.
- server from-audit.js: the audit read again within the brand (completed,
its page and score), its failing checks (a fail, and a warning for
JSON-LD validity only, as the page check reads them) with their names;
one Fix action a page (dedup on the page), impact high below the
low-score line, F01's plan, the page and its checks as its target (what
an audit run again reads), measured on the page (basket kinds), scored
as a site fix (priority sentByHand). 404 for another brand's audit, 409
not completed or nothing to fix.
- POST /api/action-center/audits { brandId, auditId }.
- Web: "Send to Action Center" on the report's header once it fails a
check, with a toast that opens the action (or the one already open);
audit_page joins the action kinds ("Fix the issues Site Audit found on
/path", "the page fails N checks"), its no-signals note in the drawer.
- Docs: the Site Audit and Action Center guides.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion-center # Conflicts: # server/src/lib/action-center/priority.test.js # web/messages/en.json # web/src/components/action-center/action-drawer.tsx # web/src/lib/action-center/display.test.ts
…ction sent from Site Audit An audit_page action's drawer only said it had no detection signals, so the person had to find the report again to see what to fix. Its Overview tab now shows where it came from with a link to the audit report, the page, and the checks it failed when sent, named by the labels Site Audit gave them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ge audited since A report stays open at its own URL after the page is audited again, and sending it named the checks the page failed then, some of them maybe fixed since. The server now looks for a later completed audit of the same page (the Pages list's page key of final_url, else url) and refuses with 409 newer_audit and the latest audit's id; the report's toast says so and opens the latest report. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o the Action Center POST /api/action-center/audits had no route test. It now pins what the route lets through and how it answers: 400 for an invalid id, 403 not_in_workspace, 201 created and 200 already open, 404, and 409 nothing_to_fix, not_completed and newer_audit with the page's latest audit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… explains it - Site Audit guide: the paragraph on sending one page moves from after the closing card into "How audits feed the Action Center". It says the action is judged like a nightly Site Audit fix, by the page audited again since it closed (learning A2, ansvisor#1689, on main), and by its metrics until then. - The report's section says what a second send does (a notice naming the open action with Open, not the action opened) and that only a page's latest report can be sent. - Action Center guide: the two Site Audit rows of "Sending work to the Action Center" become one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ot-applicable check for a Site Audit send The test's brand had no Site Audit source, so F01's analyze_site_audit and validate_technical_fix left the plan and the test, checking only that some task was planned, didn't notice. Its brand now has its audits and the test names the five tasks in order. It also covers two sends at once (the insert refused by the open-action index returns the other send's action; another refusal fails) and a check that is not applicable to the page, which is neither sent nor enough to send. 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 |
…hich the route file now uses The Products route (ansvisor#1642) guards itself with requireFeature, so the router doesn't load in a test whose plan-guard mock has none. The audits route test gets the same pass-through stub as the pages and content-drafts tests on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged main (cfd8a35): audit_page sits beside the new shopping_product/shopping_category kinds (validate.js, routes, 73 kinds), and the audits route test now stubs requireFeature like main's sibling tests. |
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good, with follow-ups
Sending a page from its Site Audit report reads the audit again on the server within the brand, refuses an older report of a page audited since, and returns the open action on a second send, including when two sends arrive at once. The action then works with what is already on main: the re-audit check (A2), the page task check and the basket measurement all read payload.targets[].checks and payload.pages, and this payload has both.
What I checked
- Access.
POST /api/action-center/auditsvalidates both ids, runsassertBrandAccessbefore any read, and reads the audit with.eq('brand_id', brandId), so another brand's audit gets a 404. Any member can send, as with the other "Send to Action Center" routes. It is a POST, so a read-only workspace is refused by the subscription middleware before it reaches the route, and the web shows that refusal's message in the toast. - What is sent. The failing checks come from
audit_signal_results, not from the client. The server'sfailing()and the web'sfailingChecks()match each other and match the inverse ofpasses()inaudit-recheck.js(a fail, or a warning on JSON-LD validity only).nothing_to_fix,not_completedandnewer_audit(withlatestAuditId) reach the toast with their codes. - Dedup. The key is
audit_page:<opportunityKey(url)>, underactions_active_dedup_idx(00084). An open action is returned with a 200. When two sends race, the loser gets a 23505 and re-reads the winner's action. - Judging and measuring.
audit_pagewas added to the basket kinds invalidate.js(citations and AI-referred sessions on the page).auditRecheckis not tied to a kind, so a closed action is judged by the page's next audit.priority.jsscores it as a person-sent site fix. The task writer treats it like the other sent kinds. - Web. The button shows only on a completed report with something failing. The toasts cover created, already open, a newer audit (with "Open the latest report") and other refusals. The drawer's
AuditPageContextreads the payload defensively.ACTION_KINDSgrew to 73 and display copy was added. The English copy reads well. - Docs. The Site Audit and Action Center guides match the behaviour.
- Merge. Merges clean on 2391b43 (#1710). No migrations.
- Tests. Server: the five touched suites pass (100 tests), and the full suite passes (269 files, 3,725 tests). Web: the four new or touched test files pass (213 tests), as do the audit and action-center folders (34 files).
tsc --noEmitis clean. ESLint shows 0 errors (one existing warning in the report page). Prettier is clean on the touched code files.
Follow-ups (not blocking)
newerAuditOfusesreadAllRpcRowsto read every completed audit of the brand newer than the report, then matches the page in JS. On an older report of a brand with scheduled audits, one click can read thousands of rows (the cap is 100,000) to answer one yes/no question. Two cheaper options: stop at the first page of rows that contains a match, or narrow the query to the page's address (url/final_url) and keep the JS key check as the final word.- A page can have both a nightly Site Audit Fix action (F01/F03/F10) and an
audit_pageaction open at once, because they use different dedup keys. Worth a line in the drawer, or a check against the nightly action's targets, if people send pages that are already in a nightly fix. - If the web ships before the API that has
/api/action-center/audits, the button gets a 404 and shows "Couldn't send to the Action Center" with a server error. Deploy the API with the web, or before it.
Summary
Learning D2: send a page from its Site Audit report straight to the Action Center. Until now a report showed what a page fails, but the only way into the Action Center was the nightly pass, a day later and grouped with other pages.
lib/action-center/from-audit.js,POST /api/action-center/audits { brandId, auditId }): the audit is read again within the brand (completed, its page and score) with its failing checks (a fail, and a warning for JSON-LD validity only, as the page check reads them) and their Site Audit names. One Fix action a page (deduped on the page; an open one is returned instead), high impact below the low-score line, F01's task plan, the page and its checks as the target (what a re-audit reads), measured on the page, scored as a site fix. 404 for another brand's audit, 409not_completed/nothing_to_fix, and 409newer_audit(with the newer audit's id) when the page has been audited since, so an old report can't open an action for checks that already pass. Two sends at once settle on one action (23505).newer_audit. The action drawer shows the report link, the page and the checks that failed when it was sent (AuditPageContext).audit_pagejoins the action kinds.Related issue
None (agentic learning, Phase D).
Type of change
feat— New featureHow to test
Checklist
npm run lint,npm test(263 files, 3,643 tests) passyarn lint(0 errors),yarn typecheck,yarn buildpass;yarn test475 of 477 files pass — the two others (Content Editor page, Library) time out under a loaded machine and pass alone with a longer timeout; this PR touches neithernpm run version:check(fails on main too: docker-compose images 0.2.0)🤖 Generated with Claude Code