Skip to content

feat(compile): allow callers to skip embeddings - #198

Merged
ethanj merged 2 commits into
mainfrom
feat/compile-skip-embeddings
Aug 25, 2026
Merged

feat(compile): allow callers to skip embeddings#198
ethanj merged 2 commits into
mainfrom
feat/compile-skip-embeddings

Conversation

@ethanj

@ethanj ethanj commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Takes over #169 by @TigerOfCountryYao, which had been a draft since 30 July with failing CI. His commit is preserved as the first commit here, rebased onto current main; the second commit is the test work.

What it does

compile({ embeddings: false }) runs page generation, links and the lexical index without any embedding-provider call or pending-embedding retry, for an SDK host that maintains its own semantic index. Omitting it is unchanged.

Why it is needed, which the original PR undersold

"Just don't set the embedding credential" does not work for two of the four backends:

Provider Embedding credential Can a caller opt out today?
anthropic / claude-agent VOYAGE_API_KEY Yes, don't set it
openai OPENAI_EMBEDDINGS_API_KEY, then OPENAI_API_KEY No - the chat key doubles as the embedding key
ollama none required No - embeddings always run

What changed from the original

It builds. test/compile-options.test.ts was missing its closing });, so esbuild could not transform it and build-and-test was red from the day the PR opened.

The default path is now pinned. The original had one case, asserting that embeddings: false does not refresh. That is one-directional: it passes against a build that never refreshes, so it cannot distinguish "the flag works" from "embeddings are broken for everyone". Mutation-tested to confirm — forcing the refresh to be skipped unconditionally left it green. Two cases now cover the default, and both mutants are caught: skipping unconditionally turns 2 red, ignoring the flag turns 1 red.

It uses FinalizeFlags. The original added a sixth positional boolean to finalizeWiki, adjacent to scoped. #192 turned those into a named object precisely so this one could join it as flags.embeddings rather than a same-typed neighbour that transposes silently.

embeddings is deliberately not a prompt modifier: it changes what runs after pages are written, never what a prompt asks for, so it must not enter the modifier digest or invalidate a page that is byte-identical under it.

TigerOfCountryYao and others added 2 commits August 25, 2026 01:30
…change

`embeddings:false skips embedding refresh` is a one-directional control. It
passes against a build that NEVER refreshes, so it cannot distinguish "the flag
works" from "embeddings are broken for everyone" — mutation-tested, forcing the
refresh to be skipped unconditionally left it green.

The default path is what the flag actually promises to leave alone, so the two
cases added here are what give the original its meaning. Both mutants are now
caught: skipping unconditionally turns 2 red, ignoring the flag turns 1 red.

Also closes the `describe` block, which was left unterminated and made the file
fail to transform, so `build-and-test` was red on #169 from the day it opened.
@ethanj
ethanj merged commit 48fe156 into main Aug 25, 2026
3 checks passed
@ethanj
ethanj deleted the feat/compile-skip-embeddings branch August 25, 2026 19:18
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