Skip to content

fix(content): read no product sentence as a claim, know the brand's own name, keep the possessive out of the placeholder, and read more Turkish and German forms (review follow-ups of #1537) - #1544

Merged
gkhngyk merged 67 commits into
ansvisor:mainfrom
cihan-gyk:fix/attribution-followups
Oct 26, 2026

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

#1537's low follow-ups from your 10:56 review.

1. No product sentence read as a claim

  • "report / study / survey / paper / poll by or from X":
    • A comma after it counts only after "according to", "per" or a sentence's "In", with up to three small words between that aren't a product's or the reader's: "In a 2025 report by Gartner, …" and "According to a survey from Statista, …" are read. These aren't:
      • "Send a survey from Typeform, Jotform or Google Forms";
      • "Download the 2025 report from Gartner, then…";
      • "In this report from Google Search Console, you can…";
      • "In the Performance report from …";
      • "Built in a study from Figma, …".
    • "shows" counts only before "that" or a figure, as data from does. "The Performance report from Google Search Console shows clicks and impressions" isn't read. "finds", "reveals" and the others still are.
  • The brand's own name is known. attributableSources(…, own), and Fix and the writer pass [brand.name]. So "A weekly report from Acme shows that…" and "Acme's data shows that…" stay on Acme's page. The possessive pattern itself is unchanged.
  • A sentence's words alone name no one. attributionsIn drops a name that is only those words. "Who says B2B content has to be boring?" isn't counted as a claim, as the placeholder already didn't take it. An acronym is still a name ("According to AMA, …"), even when its letters spell a sentence's word.

2. The possessive stays out of the placeholder

attributionEdits ends the edit before a lowercase apostrophe ending, as knownName cuts it, so a name's own apostrophe stays inside it ("O'Day"):

  • "According to Gartner's latest survey" becomes "According to [source]'s latest survey";
  • "Gartner's research shows" becomes "[source]'s research shows".

3. Turkish and German

Now read:

  • "Gartner'ın 2025 raporuna göre" and "Gartner'ın son raporuna göre": a year or one word before the noun.
  • "…, Gartner raporuna göre" and "TÜİK verilerine göre": no genitive. Without the ending, the name has to be inside the sentence or shaped as a name (TÜİK, GA4, HubSpot), so a sentence's first noun isn't one ("Ürün açıklamasına göre", "Sipariş verilerine göre").
  • "Gartner zufolge" and "nach Angaben von Gartner".

Now read whole:

  • A "göre" name of up to three capitalised words: "Google Analytics'e göre" becomes "[source]'e göre".
  • Turkish sentence words ("ancak", "bu", "son"…) are read past by the attributions only (TR_SENTENCE_WORDS), so "Ancak Google Analytics'e göre" keeps "Ancak". The people guard's NOT_NAMES is unchanged ("Son Heung-min said…" still gets its placeholder).

Not read:

  • "laut Hersteller…", "laut Datenblatt…" (plurals too), "laut Anleitung", "laut Produktbeschreibung", "laut Gesetz", and "nach Angaben des Herstellers" ("nach Angaben" is read with "von" only).
  • "zufolge" after an article or possessive ("Dem Bericht", "Einer Studie", "Unseren Messungen") or after a plural ending in -en/-ern ("Berichten", "Herstellerangaben", "Insidern"). A source named like a plural ("Nielsen zufolge") is missed: that's the cost.

Related issue

Follow-ups of #1537's review (no GitHub issue).

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

cd server && npx vitest run src/lib/content-agent.test.js -t "as the review of #1537"

Also run the fixDraftRules test "gives a claim to the brand's own data".

Checklist

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

Server checks, run locally after the review fixes: format and lint clean; 224 test files, 2,811 passed, 3 skipped.

Pre-push review

A review agent read the change before the push. It found nothing high, checked that each new test fails without its change, and timed the regexes (about 260 ms worst on 200,000 characters).

Fixed from it:

  • Turkish nouns read without the ending;
  • German nouns before "zufolge";
  • acronyms ("AMA") and the people guard affected by the Turkish words;
  • "O'Day" in the possessive cut;
  • the "In …" comma form being too broad;
  • "nach Angaben des Herstellers" and "laut Datenblättern".

Each of those now has a negative test. A shaped-name regex in the first version was slow on a 20,000-character word (640 ms); it's rewritten to one pass (53 ms).

Left as is:

  • "In a survey from Typeform, you can add logic." still reads as a claim.
  • A brand's own name is known word by word, as authors are (isKnown).

🤖 Generated with Claude Code

cihan-gyk and others added 30 commits October 25, 2026 21:35
…adings' answers and what the last rewrite came to, and offer a Length it can reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… for, keep its numbers on the row (00285), and read the floor's sections closer (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and count the last rewrite only within its Length's band and the same kept text (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er to rewrite the cited passages too when they hold the Length out of reach

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e back, release an unused hold, keep a cited-too miss as evidence, and offer it only when cited passages hold the Length (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he agent and Next step move on, and count open rules as the Rules tab does

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es read the page, keep the Length's own words, and wait for the passages before dropping skips (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ion, not the next step, and say how many placeholders it leaves to fill

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aphs, and read a rewrite's once, not on every key (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y why a run left nothing, and show a failed last run on the card

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… id and kind, not by clocks, and clear a failed last run once another starts (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e rules before they're accepted, and say which rule met now one would break

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age as it is now, and count a rewrite's Length as its own line reads it (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wasn't given or drops a name a passage has

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…give claims only to sources the page or its input names, and put a rewrite's as a placeholder (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…editor shows them, and hold the rules chip until its count stands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aracters as the toolbar counts them, and the run's rule count

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…for the brief and catalog before the rules' count, hold the panel's counts with it, and read the shown rewrite's Length by the editor's count (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s open suggestions for the page before, and drop a batch's card once the page no longer has it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e left open never holds the next run out of sight

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…estions when they can't be set aside, and hold History while the agent works or a decision saves (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a sweep on the step under way, a line on what it does, and the page drawn in

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, true without an outline, and silent on rules or sources read none of; even step spacing; steadier tests (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hich runs as a Fix, with its steps and Stop

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a Start's write doesn't stand in for it; the rewrite prop says what it reads (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t once it's decided too, not only while it's shown

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ents say when it's read and who counts it (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 9 commits October 26, 2026 14:12
…ace between them, cap a source's name at eight words, read "en" after "göre" as the source's claim, never skip a name's last word, and read "per" and "states" as the page's language and grammar have them (review of ansvisor#1520)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age's language from its rules or My rules as the CMS send does, keep a name's last word only for an -ly word or a capitalised role, and read "states"/"claims" as nouns after a count but a year before a source (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m X" only after "according to", "in" or "per"; a tool's report "shows" only before "that" or a figure), know the brand's own name, keep the possessive out of the placeholder, and read more Turkish and German forms (review follow-ups of ansvisor#1537)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nce or for a name-shaped one, skip German nouns before "zufolge", keep acronyms and the people guard as they were, cut only a lowercase possessive, and hold the comma form to a sentence's "In" (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk and others added 3 commits October 26, 2026 15:58
…als reads in linear time (review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rules by the brand's kind of site (Fix, Start and the CMS send), and read "states"/"claims" after a count at a sentence's start as nouns but small words before a source as a claim (review follow-ups of ansvisor#1537)

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

Copy link
Copy Markdown
Collaborator Author

Merged #1537's dotted-name fix in, and added #1537's round-2 low follow-ups here (8c6253d):

  1. A <br> inside a bold or a link ends a line. inlineText returns a break at a <br> or a block inside it, and walk ends the run there.
    • <strong>Forecasting basics<br>According to Zapier, …</strong> reads two lines, and the claim is caught.
    • "…according to Gartner.<br>Most…" in an <em> reads "Gartner".
    • <strong>ChatGPT<br>Gemini<br>Claude</strong> keeps its three names.
    • The page read and the people guard use the same reader.
  2. My rules are read by the brand's kind of site (00227), as getMyRuleSets does.
    • draftLanguage(draft, brand) filters by brandSiteType(brand) (siteTypeOf). Fix and Start pass their brand row, which has those columns.
    • The CMS send's myRuleSets reads the brand's kind and filters by it too.
    • Tests:
      • the filter's columns;
      • a workspace with a set for each kind;
      • the CMS send picking the brand's kind's set.
  3. "states" / "claims":
    • A count at a sentence's start isn't read as part of the name: "Most US states that…" and "Every FDA states that…".
    • Small words before the name count only after a number or "all", so "In some cases Gartner states that…" and "For many years Gartner claims that…" are read.
    • "Southern states that…" and "New England states that…" at a sentence's start are still read: they're shaped like a source's name.

Checks: server format and lint clean; 224 test files, 2,815 passed, 3 skipped.

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

Needs changes: one fix before merge, for two new patterns' speed on a long run of spaces. Each earlier item is done; the rest are small follow-ups.

What I checked:

  • Stack and merge.
    • 9616cc7 only brings #1537's 38dc169 in: re-merging its parents gives the same tree.
    • #1537 is squashed on main now (64f6d9c), and main's copies of the eight files are #1537's head. Through a temp base (main's tree, with #1537's head and main as parents) this PR merges clean, and the result is exactly its own change (origin/pr/1537..origin/pr/1544).
    • Server only, no migration. Nothing changes on Vercel at merge.
  • #1537's round-31 follow-ups:
    1. Product sentences. Done.
      • The comma form is read only after "according to", "per" or a sentence's "In". "Send a survey from Typeform, Jotform or Google Forms" and "Download the 2025 report from Gartner, then…" aren't read.
      • "report from X shows" needs "that" or a figure: "The Performance report from Google Search Console shows clicks and impressions" isn't read.
      • The brand's own name is known in Fix, Start and the hand-off ([brand.name]): "A weekly report from Acme shows that…" and "Acme's data shows that…" stay on Acme's page.
      • A name made only of a sentence's words isn't counted ("Who says B2B content…"), and an acronym still is ("According to AMA").
      • One gap this opens is item 2; what's still read is item 3.
    2. The possessive. Done. "According to [source]'s latest survey", "[source]'s research shows", with curly apostrophes too; "O'Day" stays whole. One side effect is in item 4.
    3. Turkish and German. Done.
      • Each case I listed is now read: a year or a word before the noun, the form without the ending, "zufolge" and "nach Angaben von".
      • "Google Analytics'e göre" becomes "[source]'e göre", and the sentence words are read past only by the attributions.
      • "laut Hersteller", "Herstellerangaben" and "Datenblatt" aren't read. What's still read is in item 3.
  • #1537's round-32 follow-ups:
    2. A <br> inside a bold or a link. Done. inlineText returns a break that walk ends the line on, and a block inside an inline tag ends it too. The three cases read as separate lines, in the guards and in the page read.
    3. My rules by the brand's kind of site. Done.
    • draftLanguage(draft, brand) filters by brandSiteType(brand), which is siteTypeOf on site_type, industry and shopping_mode_enabled, as the editor's getMyRuleSets does. Fix and Start (and the hand-off, through Fix) select those columns.
    • 00227's key is (organization_id, site_type, page_type), so .maybeSingle() sees one row at most.
    • The CMS send's myRuleSets filters the same way. With no set for the brand's kind, both fall back to the brand's language, as before.
    1. "states" and "claims". Done. "Most US states that…" isn't read, and "In some cases Gartner states that…" is. One side effect is in item 4.
  • Speed. I timed every reader on 100 KB inputs: runs of capitals, acronyms, initials, dotted words, spaces, non-breaking spaces and newlines, punctuation, possessives, the new Turkish and German words, "In … report from" runs, and nested inline tags with <br>. Two patterns grow with the square of a run of spaces (item 1). Everything else is linear.

Before merge:

  1. Bound the work on a long run of spaces (server/src/lib/content-agent.js:424, :446).
    • Both patterns start with a lookbehind that ends in \s+. V8 checks it at every position, and inside a run of spaces each check walks back over the whole run.
    • The time grows with the square of the run, so a long run of spaces, non-breaking spaces or newlines in a paragraph is slow to read. #1537's readers read the same text in milliseconds.
    • This reaches the page read at Fix, Start and the hand-off (attributableSources), a rewrite's placeholders and the check on each change.
    • Fix: look for the word first, so the lookbehind runs only where it can match:
      // :424
      String.raw`(?=(?:[Rr]eport|[Ss]tudy|[Ss]urvey|[Pp]aper|[Pp]oll)\s)(?<=(?:\b[Aa]ccording\s+to|…
      // :446
      new RegExp(String.raw`(?=\p{Lu})(?<=[^\s.!?:]\s+)${TR_NAME}\s+${TR_REPORT}`, 'gu'),
      • With both, the test file's sentences and 60 more of mine read the same, and the runs of spaces read in milliseconds.
    • Add a speed test with a long run of spaces through attributableSources, beside the ones for capitals and initials.

Low, follow-up:
2. A claim with an aside after "a report by X" is no longer read (:414).

  • "A 2025 report by Gartner, published in May, found that 40%…" and "A recent study from Stanford, which surveyed 500 teams, shows that…" were read through the comma before. Now neither form takes them.
  • Fix: allow one short aside before the verb, bounded so it stays linear: (?=(?:\s*,[^,.!?;]{1,80},)?\s+(?:…verbs…)). Both sentences are then read, and the product sentences still aren't. It can go in with item 1.
  1. Product and tool sentences still read:
    • English.
      • "In the report from Google Search Console, you can see…" and "In a report from Google Analytics, filter by channel" (:424): the small words take "the" and "a". Skipping the comma form when the reader is spoken to after it ("you", "your") covers these and your Typeform case.
      • "The Search Console report shows clicks and impressions" and "GA4's Acquisition report shows where…" (:386, from #1520). Hold "shows" / "showed" there to "that" or a figure, as :414 now does.
    • Turkish.
      • An acronym for a kind of report at a sentence's start is read as a source: "SEO raporuna göre", "PDF raporuna göre" (TR_SHAPED, :447). A short list to skip (SEO, PDF, KPI, CRM, ERP) would do.
      • A list's number makes a first noun read mid-sentence: "1) Ürün açıklamasına göre" (:446). Leave ) out of the lookbehind's class.
    • German.
      • "Laut Angaben des Herstellers", the commonest maker's form, still reads "Angaben" (:393). So do compounds of the skipped nouns and other product-page nouns: "Laut Produktdatenblatt", "Laut Packungsbeilage", "Laut Kundenbewertungen". Skip "Angaben", and match the skipped nouns inside a compound.
      • "Einer neuen Studie zufolge" and "Einer repräsentativen Umfrage zufolge" are newly read as "Studie" and "Umfrage" (:403). A rewrite then writes "Einer neuen [source] zufolge". Skip a noun after an adjective ending (-en, -em, -er, -es), as after an article.
  2. Two small side effects.
    • A name that is itself possessive: "According to McDonald's, sales rose" becomes "According to [source]'s, sales rose" (:592). Keep the ending out only when a word follows it.
    • "In most of the US states that allow it…" now reads "US", which #1537 didn't (:382). Allow "of the" after the count words.
  3. Tests and the send's brand read.
    • The CMS send's test brand is B2B, which the default also gives. A brand with Shopping mode on, expecting the e-commerce set's language, would show the filter works.
    • myRuleSets reads the brand a second time (content-delivery.js:447-451). brandFor could select the three columns instead. Today a failed read there picks the B2B set, not none.

…lowups

# Conflicts:
#	server/src/lib/content-agent.js
#	server/src/lib/content-agent.test.js
#	server/src/lib/content-delivery.js
#	server/src/lib/content-language.js
#	server/src/lib/content-language.test.js
#	server/src/lib/content-people.js
#	server/src/lib/content-writer.js
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Merged main forward (d1acdb2), as #1537 is squash-merged now.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 26, 2026 18:30
…ith a short aside after "a report by X" (review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… knows no performance global

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

Copy link
Copy Markdown
Collaborator Author

Thanks. Item 1 and item 2 are done (f2ccadb, 70ae579).

1. Long runs of spaces. Both of your fixes are in:

  • the noun is looked for first in the "In … report from X," pattern;
  • a capital is looked for first in the Turkish one.

Timing every pattern in ATTRIBUTIONS and PER_ATTRIBUTIONS on "Ürün + 10k spaces + açıklamasına" found two more patterns of the same shape, a lookbehind ending in \s+ at their start. Each now starts with (?=\p{Lu}), so the lookbehind runs only where a name can start:

  • "states/claims that": its negative lookbehind took 66 ms at 10k spaces;
  • German "zufolge": (?<!\b${DE_DET}\s+) took 525 ms.

With all four, the readers take about 40 ms on 40k spaces, NBSP or newlines.

The same search over content-people.js (the people and quote guards, also run on each change) found three older spots of this kind. They're fixed here too:

  • "Sarah, our head of growth": it started with a lookbehind ending in spaces. It now looks for a capital first: 20k spaces took about 2 s, now a few ms.
  • The two quote patterns read ${QUOTE_END}\s*[,.!?]?\s*, so the spaces after a quote mark could be split two ways. It's now \s*(?:[,.!?]\s*)?, which matches the same text: a quote mark then 20k spaces took 1–7.5 s.

The tests (content-agent.test.js, content-people.test.js):

  • each call runs once untimed first, so compiling isn't timed;
  • each input has a character past Latin-1 (’, “, ı). V8 skips positions in Latin-1-only text, so without one the English and German inputs read fast even without the fixes;
  • 30k runs of spaces, NBSP and newlines, each call under 150 ms.

I reverted each fix on its own, and the tests fail for six of the seven. The "In … report from X," noun lookahead is the exception: its old form read a long run in 20–40 ms, so it guards in theory only. Behaviour is unchanged: on about 4k strings from the content tests, the old and new patterns match the same, apart from item 2's two new sentences.

2. An aside before the verb. Done as you wrote it: (?:\s*,[^,.!?;]{1,80},)?. Now read:

  • "A 2025 report by Gartner, published in May, found that…";
  • "A recent study from Stanford, which surveyed 500 teams, shows that…".

Still not read: "The Performance report from Google Search Console shows clicks", and an aside past its bound.

3–5 go in the next follow-up PR, as you marked them:

  • the product and tool sentences in English, Turkish and German;
  • the two side effects (a name that is itself possessive, "In most of the US states");
  • a Shopping-mode brand in the CMS send's test, and brandFor selecting the three columns.

Server checks: format and lint clean; 225 test files, 2,892 passed, 3 skipped.

🤖 Generated with Claude Code

@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, with follow-ups. Both round-33 items are done, and the patterns you changed read the same text as before, in linear time. Three kinds of long input still slow down older code in content-people.js and the number guard. That code has been on main since #1421 and CE-033, and this PR doesn't make it slower, so the fixes can go in the follow-up PR.

What I checked:

  • The new commits.

    • d1acdb2 only brings main in. Each server conflict took this branch's side, where main's copy was #1537's head, which this branch already has. The two web conflicts took main's.
    • f2ccadb and 70ae579 change content-agent.js, content-people.js and their tests.
  • Merge. It merges clean on main (307670b). The merged tree differs from main by exactly this PR's own change: 9 server files, no migration.

  • What users see. Nothing changes on Vercel at merge. The server changes go out with the next API deploy.

  • Behaviour. I read about 5,300 strings with the round-33 head and with this one, through the attribution readers and the people guards (text and HTML):

    • every string and line in the 20 content-* test files;
    • round 33's sentences;
    • about 90 of mine on the quote cues, "Sarah, our head of growth", "states/claims", "zufolge", the Turkish form and the aside, with extra spaces, line breaks and marks.

    Only the aside's sentences read differently (item 2). The quote cues' new spacing and the lookaheads that look for a capital or a noun first match the same text as before.

  • Speed. I timed each public reader on 100 KB inputs, as Latin-1 text and with a character past Latin-1:

    • the readers: attributedNames, addsAttribution, placeholderAttributions(InHtml), attributableSources, dropsName;
    • keepSuggestions, with an insert, a replace and a long after;
    • guardPeople and guardPeopleInHtml.

    The inputs:

    • runs of spaces, non-breaking spaces, newlines, tabs and mixed whitespace, alone and before each pattern's trigger words;
    • capitals, initials, dotted words, possessives, apostrophes, commas, list separators and brackets;
    • quote marks followed by spaces;
    • people cues;
    • the Turkish and German words;
    • the aside, repeated.

    I also timed each of the 80 regexes in the two files alone, and the slowest cases on Node 20 too, which the server runs. Node 20 and Node 22 time them alike.

    • The eight patterns you changed, the aside among them, read every input in linear time.
    • Item 6 is what still grows faster than the text. Item 7 is linear but adds up.

Round 33:

  1. A long run of spaces. Done.
    • The "In … report from X," pattern looks for the noun first. The Turkish pattern, "states/claims" and "zufolge" look for a capital first.
    • In content-people.js, the "Sarah, our head of growth" cue looks for a capital first, and the two quote cues read the spaces one way only.
    • The new speed tests use a character past Latin-1, so the timed input can't hide a slow path.
  2. An aside before the verb. Done.
    • Both sentences are read. "The Performance report from Google Search Console shows clicks" still isn't, and nor is an aside past 80 characters.
    • One side effect: the aside can be the rest of a list, so "A survey from Typeform, Jotform or Google Forms, found that…" now reads Typeform. That's rare, and the sentence is a claim anyway.
  3. Product and tool sentences. Not done: next PR, as agreed.
  4. The two side effects. Not done: next PR.
  5. The tests and the send's brand read. Not done: next PR.

Follow-ups:

  1. Bound the work on three more kinds of long input. These run on the model's text: a Fix's or a Start's changes (keepSuggestions), a page rewrite and the brief.
    • Letters joined by apostrophes ("Ab’Ab’Ab’…", "A’A’A’…", "a’Aa’A…", "''A''A…"; content-people.js:62, :65).
      • NAME may start right after an apostrophe, since it only checks for a letter before it. WORD's lookahead [\p{L}'’]*\p{Ll} then scans to the end of the run from each capital in it.
      • The time grows with the square of the run, in the four cues that start with NAME (:317, :323, :353, :383).
      • Fix:
        • Don't start a name inside a word: (?<!\p{L}|\p{L}['’]).
        • Let the lookahead read only what the word can hold: (?=(?:\p{L}|['’](?=\p{Lu}))*?\p{Ll}).
      • With both, each apostrophe run I tried reads in linear time. The 5,300 strings read the same, and a name after an opening quote mark ("'Jane Doe said…") is still read.
    • An opening bracket with no closing one ("[a [a [a …"; content-people.js:483, and content-sources.js:145 in the number guard).
      • /\[[^\]]*\]/g scans to the end of the text from each [.
      • Fix: /\[[^[\]]*\]/g. It reads a placeholder the same way; only nested brackets read differently.
    • A line with thousands of names, sources or numbers to replace.
      • Each new edit is checked against every edit kept so far: content-people.js:504, content-agent.js:600.
      • editLines rebuilds a node's whole text once per edit (content-people.js:652-660), and placeholderNumbers rebuilds and re-slices the text per number (content-sources.js:335-345).
      • So the time grows with the number of edits times the line's length.
      • Fix:
        • Keep the edits in order of start, and check only the neighbours with a binary search.
        • Rebuild each text node, or the text, once from its pieces between the edits.
      • I tried this for the two guards: the placeholders come out the same on the 5,300 strings, and the time is linear.
    • Add each to the speed tests, with a character past Latin-1.
  2. Low: the attribution readers on a long line of capitalised words.
    • It's linear, but each pattern that starts with a name tries one at every capital. This PR adds several of those ("zufolge", the Turkish forms), so such a line takes about half again as long as on main.
    • Fix: run a pattern only when its trigger word is in the line ("zufolge", "laut", "states", "claims", "says", the Turkish forms' word after a source…). A line without one then skips it.

@gkhngyk
gkhngyk merged commit 3b650fb into ansvisor:main Oct 26, 2026
5 checks passed
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Thanks for the merge. The follow-ups (round 33's items 3–5 and items 6–7 from your approval) are in #1563.

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