MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readCoverageAnswer

Function readCoverageAnswer

graph-ui/src/app/tree-model.ts:619–681  ·  view source on GitHub ↗
(payload: unknown)

Source from the content-addressed store, hash-verified

617
618/** Eine rohe `check_index_coverage`-Antwort lesen. */
619export function readCoverageAnswer(payload: unknown): CoverageAnswer {
620 const raw = isRecord(payload) ? payload : {};
621 const meta = isRecord(raw['metadata']) ? raw['metadata'] : {};
622
623 const paths: CoveragePathAnswer[] = [];
624 for (const entry of coverageArray(raw['paths'])) {
625 if (!isRecord(entry)) {
626 continue;
627 }
628 paths.push({
629 requestedPath: coverageString(entry['requested_path']),
630 path: normalizeCoveragePath(coverageString(entry['path'])),
631 status: coverageString(entry['status']),
632 freshness: coverageString(entry['freshness']),
633 recommendedAction: coverageString(entry['recommended_action']),
634 coverage: readCoverageRows(entry['coverage']),
635 });
636 }
637
638 const scopes: CoverageScope[] = [];
639 const rawScopes = coverageArray(raw['scopes']);
640 for (const entry of rawScopes) {
641 if (!isRecord(entry)) {
642 continue;
643 }
644 const scope: CoverageScope = {
645 requestedScope: coverageString(entry['requested_scope']),
646 scope: coverageString(entry['scope']),
647 status: coverageString(entry['status']),
648 total: asNumber(entry['total']),
649 // Production reports continuation on the response envelope. A
650 // scope's `truncated` also remains true on its final partial page,
651 // so that flag cannot determine whether another page is needed.
652 hasMore: typeof entry['has_more'] === 'boolean' ? entry['has_more']
653 : rawScopes.length === 1 && raw['has_more'] === true,
654 entries: readCoverageRows(entry['entries']),
655 };
656 if (entry['next_offset'] !== undefined) {
657 scope.nextOffset = asNumber(entry['next_offset']);
658 } else if (rawScopes.length === 1 && raw['next_offset'] !== undefined) {
659 scope.nextOffset = asNumber(raw['next_offset']);
660 }
661 scopes.push(scope);
662 }
663
664 return {
665 project: coverageString(raw['project']),
666 metadata: {
667 generation: coverageString(meta['generation']),
668 indexMode: coverageString(meta['index_mode']),
669 recordedAt: coverageString(meta['recorded_at']),
670 recordingStatus: coverageString(meta['recording_status']),
671 ignoredFilesStored: asNumber(meta['ignored_files_stored']),
672 ignoredFilesTotal: asNumber(meta['ignored_files_total']),
673 hashRecordsComplete: meta['hash_records_complete'] === true,
674 coverageVersion: asNumber(meta['coverage_version']),
675 generationMatches: meta['generation_matches'] === true,
676 },

Callers 4

loadCoverageFunction · 0.90
loadPathCoverageFunction · 0.90
tree-model.test.tsFile · 0.90

Calls 7

coverageArrayFunction · 0.85
coverageStringFunction · 0.85
normalizeCoveragePathFunction · 0.85
readCoverageRowsFunction · 0.85
isRecordFunction · 0.70
asNumberFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected