UAT: GitCheckoutHandler.discover_children() does not create a git child resource — only creates fs-directory children #2059

Open
opened 2026-04-03 03:45:41 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/m7-git-checkout-handler-discover-children-git-child
  • Commit Message: fix(resource): GitCheckoutHandler.discover_children() creates git child and fs-directory child
  • Milestone: v3.7.0
  • Parent Epic: #398

Background and Context

During UAT testing of the resource management feature area, it was discovered that GitCheckoutHandler.discover_children() does not produce the full set of child resources required by the specification. The method only creates fs-directory children for top-level directories found via git ls-tree, but the Auto-Discovery rules in docs/specification.md require it to also create a git child resource representing the repository's object database, and an fs-directory child for the worktree root itself.

Current Behavior

In src/cleveragents/resource/handlers/git_checkout.py, GitCheckoutHandler.discover_children() runs git ls-tree --name-only -d HEAD and creates only fs-directory children for each top-level directory:

def discover_children(self, *, resource: Resource) -> list[Resource]:
    # Only creates fs-directory children for top-level directories
    for dirname in result.stdout.strip().split("\n"):
        child = Resource(
            resource_id=self._derive_child_id(resource.resource_id, dirname),
            name=dirname,
            resource_type_name="fs-directory",  # Only fs-directory, no git child
            ...
        )

No git child resource is created for the repository object database.

Expected Behavior

Per docs/specification.md (Auto-Discovery section):

"a git-checkout handler creates a git child and an fs-directory child for the worktree root; a git handler lists remotes, branches, tags, commits, stashes, and submodules"

The discover_children() method must create:

  1. A git child resource (with name=None, ULID-only) representing the repository's object database (.git directory)
  2. An fs-directory child (with name=None, ULID-only) for the worktree root

Supporting Information

  • Code Location: src/cleveragents/resource/handlers/git_checkout.pyGitCheckoutHandler.discover_children()
  • Spec Reference: docs/specification.md — Auto-Discovery section: "a git-checkout handler creates a git child and an fs-directory child for the worktree root"
  • Parent Epic: #398 Epic: Post-MVP Resources

Subtasks

  • Add git child resource creation in GitCheckoutHandler.discover_children(): create a child resource with resource_type_name="git" pointing to the .git directory of the checkout
  • Ensure the git child resource has name=None (auto-discovered, ULID-only)
  • Create an fs-directory child for the worktree root (the checkout location itself), not just subdirectories
  • Ensure the fs-directory worktree-root child has name=None (auto-discovered, ULID-only)
  • Tests (Behave): Add/update BDD scenarios verifying that discover_children() creates both a git child and an fs-directory child
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • GitCheckoutHandler.discover_children() creates a git child resource and an fs-directory child for the worktree root
  • Both auto-discovered children have name=None (ULID-only identification)
  • All subtasks above are completed and checked off
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done
  • All nox stages pass
  • Coverage ≥ 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/m7-git-checkout-handler-discover-children-git-child` - **Commit Message**: `fix(resource): GitCheckoutHandler.discover_children() creates git child and fs-directory child` - **Milestone**: v3.7.0 - **Parent Epic**: #398 ## Background and Context During UAT testing of the resource management feature area, it was discovered that `GitCheckoutHandler.discover_children()` does not produce the full set of child resources required by the specification. The method only creates `fs-directory` children for top-level directories found via `git ls-tree`, but the Auto-Discovery rules in `docs/specification.md` require it to also create a `git` child resource representing the repository's object database, and an `fs-directory` child for the worktree root itself. ## Current Behavior In `src/cleveragents/resource/handlers/git_checkout.py`, `GitCheckoutHandler.discover_children()` runs `git ls-tree --name-only -d HEAD` and creates only `fs-directory` children for each top-level directory: ```python def discover_children(self, *, resource: Resource) -> list[Resource]: # Only creates fs-directory children for top-level directories for dirname in result.stdout.strip().split("\n"): child = Resource( resource_id=self._derive_child_id(resource.resource_id, dirname), name=dirname, resource_type_name="fs-directory", # Only fs-directory, no git child ... ) ``` No `git` child resource is created for the repository object database. ## Expected Behavior Per `docs/specification.md` (Auto-Discovery section): > "a `git-checkout` handler creates a `git` child and an `fs-directory` child for the worktree root; a `git` handler lists remotes, branches, tags, commits, stashes, and submodules" The `discover_children()` method must create: 1. A `git` child resource (with `name=None`, ULID-only) representing the repository's object database (`.git` directory) 2. An `fs-directory` child (with `name=None`, ULID-only) for the worktree root ## Supporting Information - **Code Location**: `src/cleveragents/resource/handlers/git_checkout.py` — `GitCheckoutHandler.discover_children()` - **Spec Reference**: `docs/specification.md` — Auto-Discovery section: "a `git-checkout` handler creates a `git` child and an `fs-directory` child for the worktree root" - **Parent Epic**: #398 Epic: Post-MVP Resources ## Subtasks - [ ] Add `git` child resource creation in `GitCheckoutHandler.discover_children()`: create a child resource with `resource_type_name="git"` pointing to the `.git` directory of the checkout - [ ] Ensure the `git` child resource has `name=None` (auto-discovered, ULID-only) - [ ] Create an `fs-directory` child for the worktree root (the checkout location itself), not just subdirectories - [ ] Ensure the `fs-directory` worktree-root child has `name=None` (auto-discovered, ULID-only) - [ ] Tests (Behave): Add/update BDD scenarios verifying that `discover_children()` creates both a `git` child and an `fs-directory` child - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - `GitCheckoutHandler.discover_children()` creates a `git` child resource and an `fs-directory` child for the worktree root - Both auto-discovered children have `name=None` (ULID-only identification) - All subtasks above are completed and checked off - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done - All nox stages pass - Coverage ≥ 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 03:45:45 +00:00
freemo self-assigned this 2026-04-03 16:58:12 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#398 Epic: Post-MVP Resources
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2059
No description provided.