Skip to content

Source strategy — ContentSourceStrategy + WebsiteSourceStrategy#14

Merged
hendrikebbers merged 3 commits into
mainfrom
feat/007-source-strategy
Jul 12, 2026
Merged

Source strategy — ContentSourceStrategy + WebsiteSourceStrategy#14
hendrikebbers merged 3 commits into
mainfrom
feat/007-source-strategy

Conversation

@herbie-bot

Copy link
Copy Markdown
Collaborator

Summary

Introduces the ContentSourceStrategy seam that decouples the indexer from how a source type is discovered/fetched, plus WebsiteSourceStrategy composing SitemapCrawler (004) + PageFetcher (005) + ContentExtractor (006). SourceStrategyRegistry selects the strategy by ContentSource.type(), so a future git strategy (spec 016) plugs in as a bean with no indexer change. No orchestration/diff/indexing yet (spec 008).

Spec

  • docs/specs/007-source-strategy/{design,behaviors,steps}.md

Changes

  • ContentSourceStrategy interface (type/discover/fetch)
  • FetchOutcome (INDEX/UNCHANGED/DELETE/SKIP + optional document) — widens the design's fetch return so non-happy paths are first-class
  • WebsiteSourceStrategy — maps FetchResultFetchOutcome, builds the ContentDocument
  • SourceStrategyRegistry — type-indexed selection, fail-fast on unknown/duplicate types

Test coverage

  • 8 behavioral scenarios: registry resolution/unknown/auto-discovery + fetch INDEX/UNCHANGED/DELETE/SKIP(error & empty) and discover delegation. WebsiteSourceStrategy tested with real collaborators via MockRestServiceServer (no mocks). 77 tests total; spec-review and quality-review clean.

Closes #13

🤖 Generated with Claude Code

- ContentSourceStrategy interface (type/discover/fetch) — the seam the
  indexer depends on.
- FetchOutcome(Result{INDEX,UNCHANGED,DELETE,SKIP}, document) — widens the
  design's fetch return so non-happy paths are first-class.
- WebsiteSourceStrategy: discover -> SitemapCrawler; fetch maps PageFetcher
  FetchResult (304->UNCHANGED, 404->DELETE, error->SKIP, OK->extract->INDEX,
  empty->SKIP) and builds the ContentDocument (lastmod = discovery marker).
- SourceStrategyRegistry: indexes injected strategies by type(), clear error
  for unknown types, fail-fast on duplicates; future git strategy auto-discovered.
- Tests: registry (test doubles) + WebsiteSourceStrategy with real
  collaborators via MockRestServiceServer. 77 tests green.
- steps.md; refresh CLAUDE.md.

Refs #13
@hendrikebbers hendrikebbers merged commit 2993e03 into main Jul 12, 2026
1 check 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.

Source strategy — ContentSourceStrategy interface + WebsiteSourceStrategy

2 participants