Repository navigation
feat(content): add Brief › Your input, and count the experience, data and quotes the page uses (CE-048, part a) - #1452
Conversation
… and quotes the page uses (CE-048, part a) Quality phase 2 (NEXT_PUBLIC_CONTENT_QUALITY_PHASE at 2): - Brief › Your input, at Brief's top: the person's experience; their data (Ansvisor data cards from the draft's prompts, kept with the day and the 30 days they cover; CSV or Excel read in the browser; pasted numbers, tabs included); expert quotes with name, title, the words and an http(s) source; the guard note - 00265 content_draft_inputs: one row a draft, members only, a write names its writer; sizes as the editor keeps them (jsonbBytes measures jsonb as Postgres writes it) - inputsUsed: a quote word for word, marks around it aside; a figure from the person's data (a share, a decimal, 3+ digits that aren't a year); Ansvisor data's two numbers in one sentence; the experience by its own runs of three words - E-E-A-T gains experience (20) and original data (15), Trust expertQuote (8); in phase 2 they wait for the input; Your to-dos gain three, each with Add opening Brief › Your input, and say when given but not used - changes are made to the input as it is when they land; a failed save reads it again unless a change came since; a failed read offers Try again Co-Authored-By: Claude Opus 5.5 <[email protected]>
…omment Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-input # Conflicts: # supabase/schema.sql # web/messages/en.json # web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx # web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx # web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx # web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx # web/src/lib/content/quality-checks.test.ts # web/src/lib/content/quality-checks.ts # web/src/types/supabase.ts
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good. Two small follow-ups and a note for part b.
00265 dry-run against the production schema (rolled back): it applies cleanly. RLS is on and 4 policies are created. A member reads, writes and deletes their own draft's row. A write that names someone else as updated_by, or names no one, is refused. Another workspace sees nothing and can't update, delete or insert. anon is refused. Every size and shape check holds. updated_at moves on update, and the row goes with its draft. schema.sql matches the migration, and the merge of main carries no changes beyond the two sides.
Phase 1: useDraftInputs is off below phase 2, so nothing is read, shown or saved, and E-E-A-T, Trust and the to-dos get used: null / quote: null, as before. The Ansvisor data cards come from content_draft_sources, which already checks membership and is scoped to the draft's brand.
-
Quote fields have no length limit in the UI (
_your-input.tsx:381-405).quoteSchemacaps name, title, text and link at 120 / 160 / 600 / 2048. The inputs have nomaxLength, so past a cap Add quote just stays disabled, with nothing saying why. Give the four inputsmaxLength={…}from the same constants, as the experience box has. A count under the quote text would help too. -
asOfdepends on a locale's date format (_your-input.tsx:264).new Date().toLocaleDateString('en-CA')givesYYYY-MM-DDtoday, but the en-CA short date format has changed between ICU/CLDR releases before. If it isn't ISO,z.iso.date()turns the whole save away and the card is dropped on the re-read. Build the local day fromgetFullYear()/getMonth() + 1/getDate(), padded. -
For part b:
ansvisor_datais saved as the browser sends it, andpromptIdand the counts aren't checked against the draft. That's fine while it's only shown back to the same workspace. When the agent reads it on the server, take the numbers for eachpromptIdfrom the draft's own sources (content_draft_sourcesfor the draft) instead of the stored values.
Summary
Quality Phase 2, CE-048 "Brief › Your input", part a: the block, where it is kept, and how Quality counts it. Part b, the Content Agent writing from it as numbered sources, is the next PR. Everything sits behind
NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2. At phase 1, nothing is read or shown.Brief › Your input (
_your-input.tsx) sits at the top of Brief, titled "Your input · used only as you write it" (spec §6):asOf, in the person's time zone) anddays: 30(Sources' window). The block cites them as "Ansvisor data, October 2026", as the spec says, andasOf/dayslet part b name the exact window if you'd rather.Kept per draft: 00265
content_draft_inputs. It is one row a draft, beside the brief, so a rebuilt brief leaves it.content_draft_member(), as the draft itself. A write must name its writer (updated_by = auth.uid()), as in 00214.jsonbBytes, checked againstoctet_length(…::jsonb::text)), so a save is never turned away for size.draftInputsSchema) and upsert the whole input.keptInputs), so one stale item doesn't empty the block, and the next save doesn't write over the rest.Quality counts what the page uses (
inputsUsed), only as far as it can be read:42%,%42), a decimal, or 3+ digits that aren't a year. Thousands separators are read alike.Then:
QualityTodo.scoreis new).Some copy ("the agent writes from it as you give it", "let the agent write from it") describes what part b adds. Phase 2 stays off until part b lands with it.
Related issue
Quality spec (Drive), Phase 2, CE-048 (part a). Independent of #1449–#1451 (from
main).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
NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2inweb/.env.local.Teams,Share/1250,42%). It is listed with its row count. Paste numbers and add them too.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)00265 is applied on the dev DB and
schema.sqlis rebuilt. I checked its policies there inside a rolled-back transaction, signed in as a member: a write naming someone else asupdated_byis refused, one naming the member goes through, and oversized Ansvisor data hits its check. Web: format, lint (no errors), typecheck, all 3,390 tests and the build pass.I haven't checked it in the browser in both themes yet; it goes into the next local test session, with screenshots.
🤖 Generated with Claude Code