Skip to content

feat(build): add content freshness detection warnings#187

Open
s1ddh-rth wants to merge 1 commit intoandrewyng:mainfrom
s1ddh-rth:feat/content-freshness-warnings
Open

feat(build): add content freshness detection warnings#187
s1ddh-rth wants to merge 1 commit intoandrewyng:mainfrom
s1ddh-rth:feat/content-freshness-warnings

Conversation

@s1ddh-rth
Copy link
Copy Markdown

Stop silently defaulting missing updated-on to today's date. Instead,
emit an actionable warning and set lastUpdated to null in the registry.

Add a staleness summary that counts entries not updated in 180+ days,
shown as an info line in human output and a stale field in JSON output.
Both validate-only and full build paths report consistently.

Closes #186

What

Two non-breaking additions to chub build:

  1. Missing metadata.updated-on now emits a warning with a suggested fix instead of silently defaulting to today's date
  2. A freshness summary counts entries older than 180 days and reports it in both human and JSON output

Why

Context Hub's value depends on content being current. Currently, missing updated-on is silently backfilled with today's date, masking the problem. There's also no visibility into how many entries in the registry are going stale. This change surfaces both issues as non-blocking warnings so contributors and maintainers can act on them.

Related: #106, #107

Testing

  • npm test passes (231/231)
  • chub build content/ --validate-only succeeds
  • Manual testing done:
    • Verified missing updated-on emits actionable warning with suggested date
    • Verified --json output includes stale field
    • Verified freshness line only appears when stale entries exist (real content shows 0, test fixtures with old dates trigger correctly)
    • Verified no existing test assertions broken

Notes

  • Only one file changed: cli/src/commands/build.js
  • No new dependencies
  • lastUpdated is set to null (not "unknown") when missing — cleaner for JSON consumers
  • Staleness uses a Set to deduplicate by doc ID so multi-language/version docs aren't double-counted
  • This is purely additive — no builds break, no new errors, just warnings and info

Stop silently defaulting missing updated-on to today's date. Instead,
emit an actionable warning and set lastUpdated to null in the registry.

Add a staleness summary that counts entries not updated in 180+ days,
shown as an info line in human output and a stale field in JSON output.
Both validate-only and full build paths report consistently.

Closes andrewyng#186

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Add content freshness detection in build system

1 participant