Skip to content

Refactor/simplification pass#104

Merged
asiniscalchi merged 5 commits into
mainfrom
refactor/simplification-pass
Jun 12, 2026
Merged

Refactor/simplification pass#104
asiniscalchi merged 5 commits into
mainfrom
refactor/simplification-pass

Conversation

@asiniscalchi

Copy link
Copy Markdown
Owner

No description provided.

asiniscalchi and others added 5 commits June 12, 2026 07:02
Every test module repeated the same register-extension / connect /
migrate block (37 copies) and three files carried identical FakeEmbedder,
FakeIndex, and directional_embedding definitions. Add database::test_pool()
and an embedding::test_support module and point the tests at them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…repository

SqliteEmbeddingRepository and SqliteDailyReviewEmbeddingRepository were
copy-pasted SQL differing only in table names, owner id type, and how
dates bind. Introduce an EmbeddingSchema trait describing those
differences and one SqliteVectorIndex<S> implementation; the two
repositories become type aliases over their schemas.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e LIKE wildcards

The text search and vector search assembled SQL by pushing predicate
strings and then binding in matching order — an easy place to introduce
a bind-order bug. QueryBuilder keeps each predicate and its bind
adjacent. While here, escape %, _, and backslash in the text-search
pattern so user queries match those characters literally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cycle

The two delivery workers were mechanical twins: same targets loop, same
runner-outcome handling, same delivered_at check, same sent/skipped/
failed bookkeeping. Extract the loop into ReviewDeliveryCycle driven by
a ReviewDeliveryKind trait (period arithmetic, runner, formatting) and
one ReviewSender trait; the daily and weekly modules shrink to kind
implementations. The two hand-rolled FakeSenders collapse into a shared
test double, and the daily-only enabled flag now reaches the
reconciliation config for both kinds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The LLM-related configs (OpenAI key, embedding/review/extraction/signal
models and prompt paths) were read from env vars by scattered from_env()
constructors at wiring time, invisible to --help and unvalidated at
startup, while everything else flowed through clap. Move them onto Cli /
ServeConfig and delete the from_env constructors; only the niche
OPENAI_BASE_URL override still reads the environment directly.

ServeConfig now carries the runtime configs, which collapses the
parallel field lists in JournalServiceRegistryConfig and
GlobalWorkersConfig down to the ServeConfig itself.

Behavior note: embedding setup is now gated on the API key being
present. Previously a missing OPENAI_API_KEY made every per-tenant
service construction fail at first message; now the service starts
degraded (semantic search and embeddings disabled, with a warning),
matching what the tests always encoded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@asiniscalchi asiniscalchi merged commit 4176034 into main Jun 12, 2026
3 checks passed
@asiniscalchi asiniscalchi deleted the refactor/simplification-pass branch June 12, 2026 12:54
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.

1 participant