Skip to content

fix(manifest): use JSON file pattern during discovery - #305

Merged
bobtista merged 2 commits into
developmentfrom
fix/manifest-discovery-pattern
Jul 29, 2026
Merged

fix(manifest): use JSON file pattern during discovery#305
bobtista merged 2 commits into
developmentfrom
fix/manifest-discovery-pattern

Conversation

@bobtista

@bobtista bobtista commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Fix manifest discovery to use the configured JSON filename pattern instead of a literal identifier, restoring recursive filesystem discovery.

Add coverage for nested manifests, non-JSON files, and malformed JSON.

Testing

  • Focused manifest tests: 7 passed.
  • Core Release suite: 1,210 passed.

Follow-up

Unavailable-directory resilience is tracked in #308 and implemented separately in #309.

Closes #302

Greptile Summary

Corrects filesystem manifest discovery and adds focused coverage.

  • Replaces the literal search-pattern identifier with FileTypes.JsonFilePattern.
  • Adds tests for recursive JSON discovery, non-JSON exclusion, malformed JSON handling, and temporary-directory cleanup.

Confidence Score: 3/5

The manifest-pattern correction works as intended, but the outstanding recursive-enumeration failure should be fixed before merging.

Recursive enumeration remains outside the exception handler, so an inaccessible or concurrently removed descendant can still abort discovery instead of preserving manifests from accessible paths.

Files Needing Attention: GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs

Important Files Changed

Filename Overview
GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs Uses the centralized JSON glob during recursive discovery; the previously reported directory-enumeration failure remains outstanding.
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs Adds filesystem-backed tests for nested manifests, filtering, malformed JSON, and best-effort fixture cleanup.

Reviews (4): Last reviewed commit: "test(manifest): harden temporary directo..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Manifest discovery now safely enumerates nested JSON files, skips inaccessible filesystem entries and malformed manifests, honors cancellation, and uses injected filesystem delegates. Tests add isolated temporary-directory coverage for nested discovery, filtering, and malformed JSON.

Changes

Manifest discovery resilience

Layer / File(s) Summary
Safe filesystem enumeration
GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs
Adds injectable enumeration delegates and stack-based JSON traversal with cancellation checks, exception filtering, and warning logs.
Filesystem discovery validation
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs
Adds temporary-directory tests for nested manifests, ignored non-JSON files, malformed JSON, and cleanup helpers.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DiscoverManifestsAsync
  participant EnumerateFilesSafely
  participant FileSystem
  participant Logger
  DiscoverManifestsAsync->>EnumerateFilesSafely: enumerate JSON manifests
  EnumerateFilesSafely->>FileSystem: enumerate files and directories
  FileSystem-->>EnumerateFilesSafely: paths or enumeration failures
  EnumerateFilesSafely->>Logger: log skipped failures
  EnumerateFilesSafely-->>DiscoverManifestsAsync: matching manifest paths
Loading

Poem

I’m a rabbit with folders to hop,
JSON trails never suddenly stop.
Bad files I skip,
Through safe paths I zip,
While nested manifests go pop!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address #302 by using the JSON pattern, supporting nested discovery, ignoring non-JSON files, and handling malformed JSON.
Out of Scope Changes check ✅ Passed The added filesystem safety helpers and temp-directory test setup are in scope for the discovery fix.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 50.00%.
Title check ✅ Passed The title follows conventional commit format and accurately describes the manifest discovery fix.
Description check ✅ Passed The description is clearly related to the manifest discovery changes and added test coverage.
📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #302

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/manifest-discovery-pattern

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bobtista
bobtista marked this pull request as ready for review July 27, 2026 15:34
@bobtista bobtista self-assigned this Jul 27, 2026
Comment thread GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs
@kilo-code-bot

kilo-code-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs - Previous CRITICAL issue resolved, core JSON filename-pattern fix validated
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs - Test cleanup hardened, no issues

Previous CRITICAL Issue:

The previous review identified: "Recursive enumeration aborts discovery - when a configured content directory contains an inaccessible or concurrently removed descendant, recursive enumeration throws outside the per-file exception handler."

Resolution:

The issue was previously addressed in commit aff90d0. The incremental changes in this review (commit 1079387) focus on:

  1. Removing the unavailable-descendant test (now split to PR fix(manifest): continue past unavailable directories #309)
  2. Hardening the Dispose method with proper exception handling

The core JSON filename-pattern fix remains validated, and unavailable-directory resilience is tracked separately in #308 and PR #309 as stated in the PR description.

Previous Review Summaries (2 snapshots, latest commit aff90d0)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit aff90d0)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs - Previous CRITICAL issue resolved
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs - No issues

Previous CRITICAL Issue:

The previous review identified: "Recursive enumeration aborts discovery - when a configured content directory contains an inaccessible or concurrently removed descendant, recursive enumeration throws outside the per-file exception handler."

Resolution:

The incremental changes in commit aff90d0 fix(manifest): continue past unavailable directories successfully address this issue by:

  1. Replacing recursive Directory.EnumerateFiles with stack-based EnumerateFilesSafely method
  2. Adding IsSkippableEnumerationException helper to catch UnauthorizedAccessException and IOException
  3. Logging warnings and continuing with other directories instead of aborting
  4. Handling unavailable descendants gracefully without failing discovery

The added test DiscoverManifestsAsync_WithUnavailableDescendants_ContinuesDiscoveringAccessibleManifests validates that inaccessible descendants do not prevent discovery in accessible sibling directories.

Previous review (commit 0ddbd1d)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs 64 Recursive enumeration aborts discovery - when a configured content directory contains an inaccessible or concurrently removed descendant, recursive enumeration throws outside the per-file exception handler, causing content discovery to fail or manifest initialization to abort instead of returning accessible manifests.
Files Reviewed (2 files)
  • GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs - 1 issue
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs - 0 issues

Fix these issues in Kilo Cloud


Reviewed by glm-4.7 · Input: 35.4K · Output: 2.2K · Cached: 149.2K

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs`:
- Around line 273-277: Update Dispose to tolerate an already-removed
_tempDirectory and transient Directory.Delete failures by handling
DirectoryNotFoundException, IOException, and UnauthorizedAccessException without
propagating them to xUnit; remove the redundant GC.SuppressFinalize call while
keeping synchronous IDisposable cleanup.

In `@GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs`:
- Around line 272-282: Update DiscoverFileSystemManifestsAsync to call the
existing LoadManifestAsync helper for each discovered manifest file instead of
duplicating file loading and deserialization logic. Preserve the current
scanning, cancellation, and manifest-processing behavior while reusing
LoadManifestAsync consistently with DiscoverManifestsAsync.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f138ae9f-28c2-4424-a9f1-146de7a832d5

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba2a51 and aff90d0.

📒 Files selected for processing (2)
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Manifest/ManifestDiscoveryServiceTests.cs
  • GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs

Comment thread GenHub/GenHub/Features/Manifest/ManifestDiscoveryService.cs Outdated
@bobtista

Copy link
Copy Markdown
Author

@coderabbitai review

Scope update: unavailable-directory resilience was split into #308 and PR #309. PR #305 now contains only the JSON filename-pattern fix and focused filesystem tests. The LoadManifestAsync review thread is outdated because DiscoverFileSystemManifestsAsync is no longer modified here.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

@bobtista Understood. I’ll review #305 against its narrowed scope—the JSON filename-pattern fix and focused filesystem tests—and disregard the outdated LoadManifestAsync thread.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bobtista
bobtista merged commit 083c62d into development Jul 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant