fix(index): a video named .ts counts as skipped, so a full index isn't PARTIAL (#2943)

The full index's batch reader recognises an MPEG transport stream named
`.ts` from its first bytes (Issue #1910) and skips it, but that branch
counted the clip only as processed. Every other file the scan finds lands
in filesIndexed, filesSkipped or filesErrored, and CodeGraph.indexAll
checks those tallies against filesDiscovered, so the clip left the run one
file short. `codegraph init` and `codegraph index` then warned "Index is
missing 1 of N discovered files ... The index is PARTIAL", stored
index_state = partial, which `codegraph status` reports, and left the
indexed commit unrecorded, so status fell back to its full scan. The
branch now counts the clip in filesSkipped, as the branch below it does
for a file gone from disk.

Validation:
- mpeg-ts-not-typescript.test.ts: a new case (a clip beside one source
  file) fails on main's source with the tallies at 1 of 2, and passes
  with the fix: no index_partial warning, index_state complete. The
  file's other 11 cases pass.
- CLI: on main, `init -y` of app.ts plus testdata/clip.ts prints the
  PARTIAL warning, status --json reads state "partial", and in a git repo
  indexed_at_commit stays empty. With the fix it prints "Indexed 1 files",
  the state is "complete" and indexed_at_commit is HEAD.

Follow-up to Issue #1910, reported by @Hetox; found while fixing
Issue #2904 (PR #2928).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-10-28 01:04:24 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 5594843698
commit 72f398af6e
3 changed files with 21 additions and 0 deletions
+1
View File
@@ -85,6 +85,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Running `codegraph status` while `codegraph index` rebuilds a project no longer makes the rebuild fail with "database is locked": status now only reads the index, and it says when a rebuild is running in another process, in its output and as `rebuildInProgress` in `status --json`. Thanks @sealad886 for the report, and @danusha2345 and @KissFeng for the fixes. (#2913)
- Running `codegraph query`, `explore`, `node`, `callers`, `callees`, `impact`, `context`, `files` or `affected` while `codegraph index` rebuilds a project no longer makes the rebuild fail with "database is locked", and neither does the context hook Claude Code runs on its own when you ask about your code: like `codegraph status`, they now only read the index and say when a rebuild is running, and the hook stays quiet until the rebuild is done. They still answer from an index an older CodeGraph version built. Thanks @sealad886 for the report. (#2913)
- `codegraph init` and `codegraph index` no longer report a file you deleted as one that "could not be read" while git still lists it, which it does until the deletion is staged: such a file is now skipped, and so is a symlink that points at nothing. A file that is there but can't be read is still reported. Thanks @xianzhi-xzw for the report and the first fix. (#2904)
- A full index of a project that holds a video named `.ts`, like an MPEG-TS clip among test fixtures, no longer warns that the index is PARTIAL and missing a file, and `codegraph status` no longer reports the index as partial: the video is skipped on purpose, and it now counts as skipped. Thanks @Hetox for the original report. (#1910)
- In CFML, a `<cfquery>` or `<cfscript>` block the parser can't read no longer marks its whole file as contributing nothing to the graph: `codegraph init` no longer warns about the file, and `codegraph status` no longer lists it among files whose symbols are missing, since its component, functions and calls are all indexed. The file's recorded errors now name the block and its line instead. Thanks @HarryMuc for the report. (#2654)
- In Erlang, a comment inside an argument or parameter list, like the one in `add_to_includes( % give access to .hrl in app's src/` before its two arguments, no longer counts as an argument. The call now links to the function of its real arity, and a function whose parameter list holds a comment keeps its own arity. Before, the comment raised the arity by one, so the call linked to nothing. Re-index Erlang projects after upgrading. Thanks @Dshuishui. (#1619)
- Indexing large Python projects is much faster again and needs less memory: since 1.6.2, resolving Python references re-read source files over and over, so a project the size of CPython took several times as long to index. The graph it builds is unchanged. Thanks @bompus for the report. (#2332)
+17
View File
@@ -196,6 +196,23 @@ describe('MPEG-TS video named .ts is skipped, real TypeScript is indexed (#1910)
}
});
it('counts the clip as skipped, so a full index is complete, not PARTIAL', async () => {
const dir = createProject();
fs.writeFileSync(path.join(dir, 'clip.ts'), makeMpegTs(40));
fs.writeFileSync(path.join(dir, 'app.ts'), 'export const a = 1;\n');
const cg = await CodeGraph.init(dir);
try {
const result = await cg.indexAll();
// Every file the scan found is accounted for: indexed, skipped or errored.
expect(result.filesDiscovered).toBe(2);
expect(result.filesIndexed + result.filesSkipped + result.filesErrored).toBe(2);
expect(result.errors.filter((e) => e.code === 'index_partial')).toEqual([]);
expect(cg.getIndexState()).toBe('complete');
} finally {
await cg.close();
}
});
it('indexes past a 900 KB clip in well under two seconds', async () => {
const dir = createProject();
fs.mkdirSync(path.join(dir, 'testdata'));
+3
View File
@@ -2776,7 +2776,10 @@ export class ExtractionOrchestrator {
if (skipped) {
// Not a source file after all — counted as done, stored as nothing.
// Counted as skipped too: the scan found it, and a file no tally
// holds reads as one the run lost, so the index was called PARTIAL.
processed++;
filesSkipped++;
onProgress?.({ phase: 'parsing', current: processed, total });
continue;
}