Skip to content

feat(mine): expand readable extension coverage - #4

Open
mjc wants to merge 2 commits into
developfrom
expand-readable-extensions
Open

feat(mine): expand readable extension coverage#4
mjc wants to merge 2 commits into
developfrom
expand-readable-extensions

Conversation

@mjc

@mjc mjc commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • expand the curated readable-extension allowlist used by mining and entity detection
  • centralize the shared extension set in mempalace/readable_extensions.py so miner and entity detection do not drift apart
  • keep miner-specific and detector-specific additions layered on top of the shared base

Testing

  • 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

Copilot AI review requested due to automatic review settings April 28, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py with a shared base set and component-specific layered sets.
  • Updated mempalace/miner.py to source its READABLE_EXTENSIONS from the centralized module.
  • Expanded READABLE_EXTENSIONS in mempalace/entity_detector.py to 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.

Comment thread mempalace/entity_detector.py Outdated
mjc added a commit that referenced this pull request Apr 28, 2026
mjc and others added 2 commits May 1, 2026 14:39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mjc
mjc force-pushed the expand-readable-extensions branch from 5c3a966 to 95cb982 Compare May 1, 2026 20:40
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.
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