Skip to content

feat(settings): add Settings › Content with Hand off quality fixes automatically, per brand (CE-051, part 2) - #1482

Merged
gkhngyk merged 11 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-handoff-settings
Oct 25, 2026
Merged

gkhngyk merged 11 commits into
ansvisor:mainfrom
cihan-gyk:feature/quality-handoff-settings

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Quality Phase 2, CE-051, part 2: Settings › Content.

Stacked on #1481, which adds brands.content_quality_handoff (00275). Its own change is the last commits.

The spec says: Settings › Content › "Hand off quality fixes automatically", off by default. When it's on, every new or optimized page gets the hand-off run. Changes still wait for the person's approval, and every run is logged in History.

  • Settings › Content: a new section, shown with Content Editor Quality's phase 2 (hasSettingsSection). It has its own address, /dashboard/settings/content.
  • One setting per brand: "Hand off quality fixes automatically". Drafts belong to a brand, as with the byline setting in Authors.
    • Admins and managers change it (brands' admin/manager update policy). Anyone else sees it with a note.
    • A save shows at once and isn't read again; a failed save puts it back.
  • What it does, as its hint says:
  • web/src/types/supabase.ts gains 00275's columns.

Pre-push review fixes:

Related issue

Quality spec (Drive), Phase 2, CE-051 (part 2). Stacked on #1481.

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. Apply 00275 and set NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2.
  2. Settings now has Content, with each brand and "Hand off quality fixes automatically", unticked.
  3. As an admin or manager, tick it: it stays ticked after a reload. As an analyst, it's read-only with a note.
  4. Below phase 2, the section isn't there, and /dashboard/settings/content opens Account.

The browser check (both themes, 1024 px) is still owed, batched with the other Quality P2 PRs.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Web: yarn test (3,620 passed) and yarn build pass. After the review fixes, I re-ran lint, typecheck, build and the settings tests (63 passed).

🤖 Generated with Claude Code

cihan-gyk and others added 7 commits October 25, 2026 09:29
…t in one run (00275, CE-051, part 1)

POST /api/content-drafts/:draftId/handoff (Quality phase 2): the editor
sends the page's fixable checks by key, with what each names on the page;
the server says what each asks and runs Fix open rules as one run of kind
'handoff', its suggestions left for review. The editor's details are no
fact the agent may write, and a placeholder stays the person's.

00275: content_agent_runs.kind 'handoff' and origin (person | auto), an
automatic hand-off once a draft; brands.content_quality_handoff (off by
default) and content_drafts.quality_handoff, the brand's setting copied
when the draft is made. An automatic run on a draft its brand doesn't
hand off is 409 not_due, a second one 409 already; one the AI budget stops
before it begins is taken back, to run once the budget renews.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tomatically, per brand (CE-051, part 2)

With Content Editor Quality's phase 2, Settings has a Content section: per
brand, Hand off quality fixes automatically (brands.content_quality_handoff,
00275, off by default). Admins and managers change it; anyone else sees it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rand's approved facts

Pre-push review fixes:
- the source checks (claims, fresh, weak, primary, broken) read the
  draft's sources as link targets, so the agent can link one
- trust:brandFacts writes the brand's approved facts, read on the server
- a placeholder is read in the passage before and after the change: a
  "before" that cuts into its brackets doesn't fill it
- the person's own rules are no fact a hand-off may write either
- not_due first; a person's run writes no origin (the column's default),
  so a database before 00275 takes it; a run not taken back is failed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rkspace, say what turning it off does

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 25, 2026
cihan-gyk and others added 3 commits October 25, 2026 10:09
…ne fix at a time (CE-051)

- dropsPlaceholder counts each placeholder before and after the change,
  read in what is kept (the new words and the blocks after them): filling
  one of two "[figure, source]" in a passage is dropped too. In a heading
  only the agent's own forms count, as the editor reads them.
- A hand-off's prompt says to leave every [placeholder] as it is.
- Fix open rules and a hand-off are refused with 409 `running` while
  another fix or hand-off on the draft is under way (fixUnderWay).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged #1481's new head forward in 85c2e5b. It's a clean merge with no changes of its own, and brings in main, #1481's placeholder counts and 409 running. Web: format, lint, typecheck and yarn test (3,664 passed) pass. The server side equals #1481's head, where npm test passed (2,539).

@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.

Looks good.

What I checked:

  • Only admins and managers can change the setting, through the brands admin/manager update policy. The section's canManage matches that policy, and a refused update (no row back) is reported as a failed save.
  • A new draft copies its brand's setting. A member's change to quality_handoff on a draft is undone, by a plain update or an upsert. Another organization can't change the brand or the draft. The server can still set it.
  • The section only shows with phase 2. Below phase 2, /dashboard/settings/content falls back to Account.

Low, follow-up:

  1. web/messages/en.json:6971: the hint says pages get their fixes "when they're first opened in the editor", but that's part 4. Until part 4 lands, ticking the box does nothing visible. Drafts made in the meantime are still flagged, so once part 4 ships they'll be handed off (and use AI usage) the next time they're opened. Keep phase 2 off in production until part 4 is in.
  2. web/src/types/supabase.ts:985 (and its Insert/Update twins): content_drafts.quality_handoff sits between agent_state_at and archived_at. The generator sorts columns, so the next regen will move it. Regenerate the file, or put the column where the generator would.

@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 25, 2026
@gkhngyk
gkhngyk merged commit 8d142a4 into ansvisor:main Oct 25, 2026
4 of 5 checks passed
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