feat(mine): expand readable extension coverage - #4
Open
mjc wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Expands and centralizes the “readable file extensions” allowlist used by the miner and entity detection flows, aiming to prevent the two components from drifting over time.
Changes:
- Added
mempalace/readable_extensions.pywith a shared base set and component-specific layered sets. - Updated
mempalace/miner.pyto source itsREADABLE_EXTENSIONSfrom the centralized module. - Expanded
READABLE_EXTENSIONSinmempalace/entity_detector.pyto include many additional code/config extensions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
mempalace/readable_extensions.py |
Introduces centralized base + layered extension sets for reuse. |
mempalace/miner.py |
Switches miner’s allowlist to import from the centralized extension set. |
mempalace/entity_detector.py |
Expands detector allowlist, but still hard-codes the set instead of importing the centralized version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mjc
added a commit
that referenced
this pull request
Apr 28, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mjc
force-pushed
the
expand-readable-extensions
branch
from
May 1, 2026 20:40
5c3a966 to
95cb982
Compare
mjc
pushed a commit
that referenced
this pull request
Jun 27, 2026
Adds _try_gemini_json parser to normalize.py for three layouts:
1. Gemini API contents format (~/.gemini/sessions/*.json):
{"contents": [{"role": "user", "parts": [{"text": "..."}]}, ...]}
2. Messages-wrapper variant:
{"messages": [{"role": "user", ...}, {"role": "model", ...}]}
3. Flat top-level list with role="model".
This complements the existing _try_gemini_jsonl parser (which handles
~/.gemini/tmp/<hash>/chats/session-*.jsonl with session_metadata
sentinel) — JSONL covers Gemini CLI runtime sessions, JSON covers
exported / Studio-saved transcripts.
## Review feedback addressed (PR MemPalace#204)
bgauryy review:
- #1 Parser-precedence bug: _try_gemini_json runs *before*
_try_claude_ai_json so the {"messages":[..., role=model, ...]}
layout is no longer silently claimed by the Claude parser. The
Gemini parser's has_model_role guard prevents false-positives
against Claude / ChatGPT data.
- #2 Layout 2a coverage: TestGeminiJson.test_messages_wrapper_format
+ test_messages_wrapper_does_not_get_claimed_by_claude pin the
fix in place.
- #3 Test conflicts with current main: rebased onto develop;
tests restructured into TestGeminiJson class.
- #4 tempfile/os.unlink → pytest tmp_path everywhere.
- #5 elif not text → else (the elif branch was dead).
- MemPalace#6 Module docstring updated to mention Google AI Studio.
Tests: 9 new cases in TestGeminiJson covering all three layouts,
multi-part text joining, non-text part skipping, has_model_role
disambiguation, dispatch-chain regression for review #1.
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
mempalace/readable_extensions.pyso miner and entity detection do not drift apartTesting
nix develop 'git+file:///home/mjc/projects/mempalace?ref=refs/heads/codex/harden-chroma-repair' --command bash -lc 'cd /home/mjc/projects/mempalace && git checkout expand-readable-extensions >/dev/null 2>&1 && .venv/bin/pytest tests/test_entity_detector.py tests/test_miner.py -q'Related