fix: allow mining directories without local mempalace.yaml#173
Closed
mvanhorn wants to merge 2 commits intoMemPalace:mainfrom
Closed
fix: allow mining directories without local mempalace.yaml#173mvanhorn wants to merge 2 commits intoMemPalace:mainfrom
mvanhorn wants to merge 2 commits intoMemPalace:mainfrom
Conversation
When no mempalace.yaml or mempal.yaml exists in the source directory, return a default config (wing = directory name, room = general) instead of calling sys.exit(1). This lets users mine any directory into their palace without requiring init first. Closes MemPalace#14.
|
"The fix: when no yaml is found, derive a wing name from the directory basename and use a single "general" room. Prints an informational message instead of crashing." -- what does the general informational message look like out of curiosity? |
Contributor
Author
|
It prints: Then uses the directory basename as the wing name and a single "general" room with all project files. |
Collaborator
|
Conflicts with main. If the mining-without-yaml feature is still needed, a rebased PR against current main would be welcome. |
Contributor
Author
3 tasks
CuraIQ-Dev
pushed a commit
to Finimo-Solutions/mempalace-nexus-backend
that referenced
this pull request
Apr 21, 2026
…LOW + 2 CodeRabbit minor)
Adversarial R1 + CodeRabbit:
- HIGH (adv): where_document={'$contains': 'foo'} crashed _translate_where
(top-level $op rejected) making the keyword-boost path unreachable.
Fix: _normalize_where_document rewrites top-level {$contains: s} to
{content: {$contains: s}} before translation; _extract_keyword_text
still reads the original dict first so keyword_text is preserved.
- MED (adv): dikw_stage silently dropped on INSERT — listed in
_COLUMN_META_KEYS but missing from the INSERT column list. Fix: added
dikw_stage between source_id and entity in both base INSERT and
ON CONFLICT DO UPDATE SET.
- MED (adv): _connect leaked a Postgres connection when register_vector
raised (e.g. vector extension missing). Fix: try/except closes conn
on any BaseException before re-raising.
- LOW (adv + CodeRabbit MemPalace#173): $and + $or at the same node level, or a
logical op mixed with field keys, silently dropped one branch. Fix:
_translate_where.emit rejects both ambiguous shapes up front with
UnsupportedFilterError.
- LOW (adv): n_results unvalidated. Fix: positive-int guard at top of
query() raising ValueError.
- MINOR (CodeRabbit MemPalace#54): RECENCY_HALF_LIFE_SECONDS was a misnomer —
EXP(-Δt/T) is a 1/e time constant, not a half-life. Fix: renamed
constant to RECENCY_DECAY_SECONDS and updated the one SQL reference;
comment clarifies the formula shape. Behaviour unchanged.
- MINOR (CodeRabbit MemPalace#124): $contains ILIKE pattern f'%{arg}%' leaked %
and _ wildcards from user input (e.g. 'foo_bar' or '50%' acted as
wildcards). Fix: _escape_like helper escapes |, %, _ with | as the
escape char, paired with ESCAPE '|' in the SQL. Substring-only
semantics restored.
Simplify R1 2 LOW cosmetic findings remain accepted-non-blocking per
R1 justification (see code_review round_results).
File now 686 LOC (624 → 686, +62 for the 7 fixes). Under 750 cap.
Refs: specs/IMPL-AO-S301-T03-BACKENDS-NEXUS-001.yaml v0.2.0,
SPEC-KIRA-MEMPALACE-ADOPTION-001, SPEC-AGENT-BOOT-WAKE-UP-001.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
What does this PR do?
Changes
load_config()inminer.pyto return sensible defaults instead ofsys.exit(1)when nomempalace.yamlexists in the source directory.The bug:
mempalace mine ~/chats/fails withERROR: No mempalace.yaml foundwhen the user init'd in a different directory (~/projects/myapp). The miner requiresmempalace.yamlin every source directory, but users expect to init once and mine from anywhere.The fix: when no yaml is found, derive a wing name from the directory basename and use a single "general" room. Prints an informational message instead of crashing.
Closes #14.
How to test
Or run the new test:
Checklist
python -m pytest tests/ -v)ruff check .)This contribution was developed with AI assistance (Codex).