Skip to content

fix(content): keep a missed brand facts page under the hourly cap and its status through a failed weekly read (CE-047 follow-ups) - #1466

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/brand-facts-missed-pages
Oct 24, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/brand-facts-missed-pages

Conversation

@cihan-gyk

@cihan-gyk cihan-gyk commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups from the reviews of #1462 and #1463 (both merged).

  1. A missed page under the hourly cap (feat(content): read a brand's facts from its own pricing, About and product pages, kept for approval (00269, CE-047, part a) #1462).
    • Before, a page whose last answer missed the schema went straight to the model whenever its text changed.
    • Now it waits MODEL_EVERY_MS like any other page, with && !missed dropped as suggested. While it waits it stays missed, with its hash and extracted_at kept.
    • The day-old retry for an unchanged missed page is as it was.
  2. A failed weekly read keeps a missed page's status (feat(content): read brand facts again each week in the daily run (CE-047, part b) #1463).
    • The sweep marks a failed brand's pages failed with .neq('status', 'missed').
    • A missed page only gets today's checked_at, so its retry after a day stands.
  3. A deadline for a run (feat(content): read brand facts again each week in the daily run (CE-047, part b) #1463, optional).
    • A run stops after 10 minutes (SWEEP_DEADLINE_MS).
    • The brands it didn't reach stay first in line for the next run.

Related issue

Follow-ups to #1462 and #1463 (CE-047).

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. A brand_fact_pages row with status: 'missed' and extracted_at 10 minutes ago, whose page text changed, is not sent to the model by POST /api/brand-facts/fetch. It stays missed.
  2. With a brand whose read throws in sweepBrandFacts, its missed page stays missed and its other pages become failed.
  3. Tests: brand-facts.test.js (a missed page whose text changes inside the hour) and brand-facts-sweep.test.js (the two status updates, and the deadline).

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 change
  • yarn typecheck passes (run from web/): no web change
  • yarn format:check passes (run from web/): no web change
  • Changes are focused — one concern per PR

Server: npm run format, npm run lint and npm test pass (2,490 tests). No migration.

🤖 Generated with Claude Code

… its status through a failed weekly read (CE-047 follow-ups)

- A page whose answer missed the schema goes to the model once an hour
  at most when its text changes, as any other page; it stays missed,
  its hash and time kept (ansvisor#1462 review).
- The weekly read marks a failed brand's pages failed except a missed
  one, which only gets today's date: its retry after a day stands
  (ansvisor#1463 review).
- A weekly run stops after 10 minutes; the brands left stand first in
  line for the next run (ansvisor#1463, optional).

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

@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. All three items are done.

  1. A missed page under the hourly cap (server/src/lib/brand-facts.js:765): done.
    • A missed page whose text changes within the hour now waits and stays missed. It keeps its old hash and extracted_at, so the day-old retry still applies.
    • A page whose text keeps changing reaches the model at most once an hour.
    • A page that wasn't missed gets the same row as before.
    • A test is added.
  2. A failed brand keeps a missed page's status (server/src/lib/brand-facts-sweep.js:125-139): done.
    • The two updates cover separate rows, because status is not null.
    • A missed page only gets a new checked_at, so its retry after a day still applies.
    • The test checks both updates.
  3. A deadline for a run (brand-facts-sweep.js:83): done.
    • The deadline is checked before each brand against the real clock, not against the now passed in.
    • The brands left keep their old checked_at, so they stay first in line.
    • A test is added.

Checked: the PR merges cleanly on main and has no migration. CI is green.

@gkhngyk
gkhngyk merged commit 34aa8be into ansvisor:main Oct 24, 2026
6 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