daaain / daaain/claude-code-log
Per-project staleness check in process_projects_hierarchy doesn't gate on requested outputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 98
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 13
Description
From https://github.com/daaain/claude-code-log/pull/272#discussion_r3567034406
Root cause
In claude_code_log/converter.py, the staleness check that decides whether a project needs (re)conversion doesn't distinguish which artifacts were actually requested (write_combined, generate_individual_sessions, use_cache). Today (in _plan_project, and previously in the inline loop it was extracted from):
if write_combined:
needs_work = (
bool(modified_files)
or bool(stale_sessions)
or combined_stale
or not output_path.exists()
)
else:
needs_work = bool(modified_files) or bool(stale_sessions)
Affected scenarios
use_cache=False+write_combined=False(individual-session-only, no cache):cache_managerisNone, somodified_filesandstale_sessionsare always[](the ternaries fall through to theelsebranch).needs_workends upFalseunconditionally, so no per-session files are ever generated, yet the index still links tosession-{id}...paths that were never written — producing 404 links.- Combined-only runs (
generate_individual_sessions=False,write_combined=True):stale_sessionsis still computed and can forceneeds_work=True(or keep itTrue) even though individual files aren't being produced and their staleness is irrelevant to what's requested — causing unnecessary reconversion every run. - Individual-only runs (
generate_individual_sessions=True,write_combined=False): symmetric case —combined_stale/output_path.exists()are correctly skipped, but this branch was only reachable viawrite_combined, notgenerate_individual_sessions, so there's no explicit signal tying the check to what was requested; it currently happens to work only becausewrite_combined=Falseis the only lever, conflating "don't check combined staleness" with "combined wasn't requested."
Proposed fix outline
- Thread
generate_individual_sessionsinto_plan_project(and its caller inprocess_projects_hierarchy). - Gate
stale_sessions/modified_filesevaluation bygenerate_individual_sessions, andcombined_stale/output_path.exists()bywrite_combined. - When
cache_manager is None(i.e.,use_cache=False), don't rely on emptymodified_files/stale_sessionslists as "nothing to do" — treat any requested output as needing work whenever there's no cache to have already produced it. - Add regression tests for: (a)
use_cache=False, write_combined=False, generate_individual_sessions=True, (b)write_combined=True, generate_individual_sessions=Falsesteady-state (no unnecessary reconversion), (c)write_combined=False, generate_individual_sessions=Truesteady-state.
Files/areas
claude_code_log/converter.py:_plan_project, its call site inprocess_projects_hierarchy(Phase 1 planning loop).test/test_parallel_processing.pyor a new staleness-focused test module for the new coverage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read claude_code_log/converter.py at _plan_project and its Phase 1 call site in process_projects_hierarchy. Then run the relevant tests in test/test_parallel_processing.py, adding coverage for the three listed cache and output combinations. Done means requested individual outputs are generated without a cache, and steady-state runs do not reconvert outputs that were not requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100