fix: migrate bub-tapestore-otel and bub-tapestore-sqlite from republic to bub.tape#49
Open
CorrectRoadH wants to merge 4 commits into
Open
Conversation
…ve TapeEntry class drift When bub resolves to git HEAD instead of the workspace-locked commit, TapeEntry instances fail pydantic's isinstance check against the TapeEntry class captured at schema-build time, causing every append to raise a ValidationError that the exporter silently swallows — resulting in zero exported spans. Use SkipValidation[list[TapeEntry]] on TraceProjection.entries so pydantic bypasses the isinstance check entirely. The field is internal-only and never needs runtime coercion, so skipping validation is safe and is the explicit recommendation from the pydantic docs for this class of problem. Adds a regression test that feeds build_tape_trace entries whose class object differs from republic.TapeEntry to guard against future drift. Closes bubbuild#47 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EcGvz588KPpJVkEP2eaDby
…uild_llm dependency SQLiteTapeStore.__init__ imported and called bub.builtin.agent._build_llm, a private helper that was removed in bub >= 0.3.10.dev2. This caused an ImportError before any tape operation could run, even when the store was used without semantic search. Fixes: - Remove the _build_llm call from __init__; initialize self._llm = None - Add a module-level _build_embedding_client() that uses the public AnyLLM.create() and bub.ensure_config(AgentSettings) API, with a model_client_kwargs() fallback for newer bub versions - Build the client lazily in _compute_embedding(), only when semantic search is actually invoked - Update tests to mock _build_embedding_client in bub_tapestore_sqlite.store instead of the removed bub.builtin.agent._build_llm Non-semantic store operations (append, fetch_all without query, list_tapes, reset) now work against any bub version without touching the LLM layer. Closes bubbuild#43 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EcGvz588KPpJVkEP2eaDby
bub replaced republic with its own tape implementation (commit 04960b1). Plugins still imported from republic, so bub.tape.TapeEntry instances passed at runtime failed pydantic's isinstance check against republic.TapeEntry — causing ValidationError in otel and ImportError in sqlite (from the now-deleted _build_llm). Changes across both plugins: - Replace all `republic` imports with `bub.tape` / `bub.runtime` - bub-tapestore-otel: remove SkipValidation workaround (no longer needed now that the TapeEntry class identity is correct) - bub-tapestore-sqlite: replace RepublicError→BubError, ErrorKind from bub.runtime; rewrite _build_embedding_client to use the public AnyLLM.create(provider, **settings.model_client_kwargs(provider)) API; type _embedding_client as AnyLLM|None; simplify _compute_embedding to call client.aembedding directly without _core.get_client - Remove republic>=0.5.7 from both pyproject.toml; add bub to sqlite deps Closes bubbuild#43 Closes bubbuild#47 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EcGvz588KPpJVkEP2eaDby
5ccbfb8 to
bab3d9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
bub replaced
republicwith its own tape implementation in commit04960b1(feat: replace republic with any-llm-sdk). Both plugins still importedTapeEntry,TapeStore,TapeQueryetc. fromrepublic, so:close #43 #48
bub.tape.TapeEntryinstances passed at runtime failed pydantic'sisinstancecheck againstrepublic.TapeEntry— everyappendthrewValidationError, silently exporting zero OTel spans.bub.builtin.agent._build_llmwas removed as part of the same migration —ImportErroron any store construction.Fix
Migrate both plugins from
republictobub.tape/bub.runtime. No workarounds needed.bub-tapestore-otel (closes #47):
from republic import TapeEntry→from bub.tape import TapeEntryinexporter.pyfrom bub.tape import ...instore.pyrepublic>=0.5.7frompyproject.tomlSkipValidationworkaround (class identity is now correct)bub-tapestore-sqlite (closes #43):
republicimports withbub.tape/bub.runtimeRepublicError→BubError,ErrorKindfrombub.runtime_build_embedding_clientto use the publicAnyLLM.create(provider, **settings.model_client_kwargs(provider))API — no more_core.get_clientprivate access_embedding_client: AnyLLM | None(properly typed)_compute_embeddingcallsclient.aembeddingdirectlyrepublic>=0.5.7withbubinpyproject.tomlTest results
Both test suites run against local bub HEAD (
/Users/ctrdh/Code/bub).🤖 Generated with Claude Code
https://claude.ai/code/session_01EcGvz588KPpJVkEP2eaDby