Skip to content

fix(content): tell generators the current year and show past years in titles as this year - #1922

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/current-year-in-generated-titles
Nov 1, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:fix/current-year-in-generated-titles

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Generated titles and prompts kept the year they were written in. Measured on dev: titles, suggestions and prompts said "2026" with no rule behind it, so next January they'll look a year old, and a past year already does. Generators now know the current year. Titles show a past year as this year. Customer priorities plan, P0 item 2 (list hygiene).

What changes

  • Generators: the prompt gets yearRule().
    • It states the current year: "Don't write a year unless it's needed; if you do, write the current year."
    • The fixed years in the examples are removed.
    • Covers onboarding prompts, topic prompts, suggestions, page suggestions and the opportunity generator.
  • Display (refreshYears):
    • A past year in a title shows as the current year.
    • A range moves so its last year is the current one: "2024-2025" → "2025-2026" in 2026.
    • Years before 2025, and years after "since" or "from", are left alone.
  • Applied in:
    • the server's cleanStoredOpportunity: title, asset titles and the representative question;
    • on the web: MCP, Content Plan, the New content list and the opportunity action's title in Action Center.
  • Unchanged: stored text, and tracked prompt text, which is never touched.
  • Help: one sentence in content-opportunities.md; approved-articles.json refreshed.

No migration.

Follow-up (not in this PR): tracked prompts with a past year could get a suggestion: "This prompt names a past year; update it?" That would open a new prompt and keep the tracking history. Two prompts on dev name 2026.

Related issue

None. Customer priorities plan, P0 item 2.

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. Generate opportunities or prompt suggestions. New titles name no year, or this year.
  2. Make an opportunity whose title says "2024 guide" (any past year): the list, detail, Plan and MCP show the current year. The stored row is unchanged.
  3. Unit tests: yearRule, refreshYears (past year, ranges, "since 2019", years before 2025) and each generator's prompt.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (0 errors; 7 old warnings in files this PR doesn't touch)
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

Full checks on this branch (eb71379, from bf707cb; it merges cleanly with current main): web 798 files / 8,295 tests pass, and yarn build passes. Server format:check and lint are clean, and 352 files / 4,986 tests pass (3 skipped). It touches the same help article and approved-articles.json as the same-question PR, in different sections.

🤖 Generated with Claude Code

… titles as this year

Prompt generators wrote the year into their examples ("Top CRM software
for small businesses 2026", "top email marketing tools for startups in
2026") and the opportunity generator had no year at all, so "2026" froze
into 2 opportunity titles, 4 representative questions, 2 prompts and a
fan-out query on dev, all stale on 2027-01-01.

- current-year.js: the year rule every generator now carries ("Leave years
  out unless the need is about a particular year; when one belongs, write
  <this year>, never an earlier year"), and refreshYears, which reads a
  past year as this year and moves a range ending in a past year to end
  this year ("2024-2025" in 2026: "2025-2026"). Years before 2025, after
  since/from/until/before/after/between, and this year or later stay.
- Onboarding's prompts, the topics' prompts, prompt suggestions, a page's
  prompt suggestions and the opportunity generator get the rule; the
  examples no longer carry a year.
- Stored opportunities read with this year in their titles, asset titles
  and question (cleanStoredOpportunity, and on the web: MCP, the Content
  Plan, New content's opportunities and a content opportunity's action
  title). Stored text is unchanged, and a tracked prompt's own text is
  never changed: it is what the prompt is tracked by.

Help: Find content opportunities says years are left out and a past one
shows as this year.

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.

LGTM

@gkhngyk
gkhngyk merged commit 9dc5b2e into ansvisor:main Nov 1, 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