fix(convert): mtime check before derive_project_slug (#612) — v1.3.74#687
Merged
Conversation
Closes #612 (#arch-h9). convert_all's per-session loop used to call adapter.derive_project_slug(path) BEFORE the mtime check. On Codex CLI that helper opens every .jsonl to read the session_meta cwd field — so a no-op sync of a 5k-session corpus paid 5k needless file opens. Reordered the loop: path.stat() (cheap) and the state-mtime comparison run first. Slug derivation, project filter, and ignore filter only run for sessions that actually need conversion. New regression test test_no_op_sync_does_not_call_derive_project_slug exercises a counting adapter and asserts derive_project_slug is NOT called on the second pass when state already matches mtime.
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
`convert_all` no longer calls `adapter.derive_project_slug(path)` on every session before the mtime check. On Codex CLI that helper opens every `.jsonl` to read the `session_meta` `cwd` field — so a no-op sync of a 5k-session corpus paid 5k needless file opens. The fix reorders the per-session loop so the cheap mtime check runs first; slug derivation, project filter, and ignore filter only run for sessions that actually need conversion.
Closes #612 (`#arch-h9`).
What changed
What's new
Behavioural delta
How to test it
```bash
python3 -m pytest tests/test_convert_no_op_perf.py -v
python3 -m pytest tests/ -q -m "not slow"
Manual perf sniff on a real Codex corpus:
python3 -m llmwiki sync # first run — converts everything
python3 -m llmwiki sync # second run — should print all-unchanged in <1s
```
Pre-merge checklist
Bundle
Out of scope / follow-ups
Next
After merge: tag `v1.3.74`, then run the README-claim audit (#682) or move directly to a final consolidated PyPI release (will need PyPI trusted-publisher to be configured first per the v1.2.0 plan; flagging that as the only remaining blocker).