fix: two bugs in PR #106's identity-memory test fixture blocking CI#108
Merged
AxDSan merged 1 commit intoMay 13, 2026
Merged
Conversation
…g CI PR AxDSan#106 added tests/test_identity_memory.py whose fixture errors on every PR's CI matrix with two separate setup failures, blocking all five currently-open PRs (AxDSan#98, AxDSan#101, AxDSan#102, AxDSan#105, AxDSan#107): 1. AttributeError: 'str' object has no attribute 'parent' The fixture does `BeamMemory(db_path=db_path)` where db_path is a string from tempfile. BeamMemory.__init__ stored it as-is, then _get_connection at beam.py:326 did `path.parent.mkdir(...)` -- strings don't have .parent. 2. AttributeError: 'BeamMemory' object has no attribute 'initialize' The fixture then calls `beam.initialize()`. BeamMemory has no such method; __init__ already opens the connection and runs init_beam() (schema setup, sleep_log, etc.). The .initialize() call must have been left over from a refactor where the test was rewritten to use BeamMemory directly instead of MnemosyneMemoryProvider (which DOES have an initialize()). Both bugs caused 5 ERROR records in CI, marking the run failed even though the actual test bodies are correct. Fixes: - mnemosyne/core/beam.py BeamMemory.__init__: coerce non-Path db_path via Path(db_path) before storage. Backward-compatible -- real Path inputs stay Path, strings get coerced, None still falls back to _default_db_path(). The implicit Path-only contract is now explicit and tolerant. - tests/test_identity_memory.py fixture: drop the spurious beam.initialize() call. __init__ already does the setup work. Regression test: tests/test_beam_db_path_string_coercion.py pins the db_path acceptance contract across str / Path / None inputs, plus an end-to-end smoke that exercises the .parent.mkdir(parents=True) path that the original AttributeError hit. Empirics: - 9/9 in the targeted slice (4 new coercion tests + 5 PR AxDSan#106 identity tests now pass) - 143/143 in the broader slice across hermes_memory_provider/plugin_session/plugins/integration/ data_dir_scripts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
FYI, this PR will fix the failing CI on the other waiting PRs I did. |
ether-btc
pushed a commit
to ether-btc/mnemosyne
that referenced
this pull request
May 13, 2026
Fixes the upstream beam.py:326 AttributeError where BeamMemory(db_path=str) crashes because _get_connection calls path.parent.mkdir() on a string. Also drops spurious beam.initialize() call from test_identity_memory.py fixture — BeamMemory has no initialize() method; __init__ does all setup. Ported from upstream PR AxDSan#108 (kohai-ut) which passes CI on all Python versions. Includes regression test file test_beam_db_path_string_coercion.py with 4 coverage cases. All 9 tests pass locally: - 4 new db_path coercion tests - 5 test_identity_memory.py identity signal tests
ether-btc
pushed a commit
to ether-btc/mnemosyne
that referenced
this pull request
May 13, 2026
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.
Summary
PR #106 added
tests/test_identity_memory.pywhose fixture errors on every PR's CI matrix with two separate setup failures, currently blocking all five of my open PRs (#98, #101, #102, #105, #107). Same fixture errors would block every future PR until fixed.The fixture is correct in intent — the test BODIES exercise real behavior. Only the setup has two bugs that combined to make the suite show
5 errorsand mark the CI run failed.Two bugs in the same fixture
Bug 1:
BeamMemory(db_path=<str>)crashes at first connectionBeamMemory.__init__stored the string as-is, then_get_connectionatbeam.py:326didpath.parent.mkdir(parents=True, exist_ok=True)→AttributeError: 'str' object has no attribute 'parent'.Fix:
BeamMemory.__init__now coerces any non-Pathdb_pathviaPath(db_path)before storage. Backward-compatible — realPathinputs stayPath, strings get coerced,Nonestill falls back to_default_db_path(). The implicit Path-only contract is now explicit and tolerant.Bug 2:
beam.initialize()is not a thingBeamMemoryhas noinitialize()method.MnemosyneMemoryProviderdoes, and the test author may have left this over from a refactor.BeamMemory.__init__already opens the connection and runsinit_beam()for schema setup.Fix: drop the spurious
beam.initialize()call from the fixture.Test plan
tests/test_beam_db_path_string_coercion.py: 4 regression tests pinning the db_path acceptance contract acrossstr/Path/Noneinputs, plus an end-to-end smoke that exercises the.parent.mkdir(parents=True)path that the original AttributeError hit.Why this PR exists
This fix could/should land on main directly without going through a PR, but since the CI bug is blocking five separate open PRs that I've been shipping, this is the fastest path to unblock all of them at once. Maintainer can land this first, then rebase the other five PRs onto the cleaned main.
If you'd prefer to fold these two changes into a different PR, happy to close this one — just say the word.
🤖 Generated with Claude Code