Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)

未关闭 适合新手
#4,831 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Deepjyoti-Sarmah 已经在做这个了。

开始于 2026年10月28日。

  • #4850 来自 @Deepjyoti-Sarmah —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

从 __main__.py 中的 extract 开始,然后检查 cache.save_semantic_cache 和 check_semantic_cache,追踪 source_file 路径的解析方式。当 --out 与扫描的目录不同时,比较 _sem_extracted 和 files_by_type 使用的路径。完成的标准是语义缓存条目已保存,且清单记录了它们的 semantic_hash,使第二次运行能够复用这些文件。

由索引模型根据 Issue 内容生成。

描述

Version: graphify 0.9.7 (uv tool install graphifyy), macOS, --backend claude-cli

Problem
graphify extract <dir> --out <other> never reuses the semantic cache. Every run re-extracts every doc and reports 0 files cached/unchanged. <other>/graphify-out/cache/semantic/ stays empty.

Cause
The LLM returns source_file relative to the scanned dir (e.g. n1.md). In __main__.py (extract), two places treat it as a path under the output root (out_root) instead:

  1. cache.save_semantic_cache(..., root=out_root) builds Path(root) / "n1.md", is_file() is false, so the entry is skipped. Nothing is saved.
  2. _sem_extracted (used to build _manifest_files) is compared against the absolute paths in files_by_type. A relative source_file never matches, so no doc gets a semantic_hash in manifest.json and detect_incremental re-queues all of them.

When --out is omitted (out_root == target), (1) resolves correctly.

Repro

mkdir vault out cwd
for i in 1 2 3; do echo "# Note $i. Alice uses Redis." > vault/n$i.md; done
cd cwd
graphify extract ../vault --out ../out --backend claude-cli --max-concurrency 1   # run twice

Run 2: incremental summary: 0 files cached/unchanged, 3 re-extracted, tokens spent again, out/graphify-out/cache/semantic/ empty, manifest.json is {}.

Workaround
Omit --out and set GRAPHIFY_OUT=/abs/path/graphify-out. Run 2 then reports 3 files cached/unchanged, 0 re-extracted and spends no tokens. On a ~106-doc vault this took a nightly run from ~340k in / ~66k out tokens to ~17k / ~7k.

Suggested fix
Resolve relative source_file against target (the scanned dir) in save_semantic_cache and when building _sem_extracted, while keeping the cache key relative to out_root as check_semantic_cache already does.

主要语言
Python
星标
124k
派生
11.9k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Graphify-Labs/graphify 的其他 Issue

查看 Graphify-Labs/graphify 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。