Skip to content

QA follow-up: feat(lifecycle): update and uninstall directory targets via recorded ownership (#354) #366

Closed

Description

@barbatdev

Post-merge QA follow-up (#354)

Source: #354 — feat(lifecycle): update and uninstall directory targets via recorded ownership

Lens: evidence + test design.

The merge covers #342 with real end-to-end evidence: directoryLifecycleInstall drives the production dispatch to a genuinely installed state, and the three tests then check the plan writes nothing, apply actually changes the projected skill, an uninstalled target refuses instead of becoming a first install, and uninstall keeps a foreign file while removing the state file and every owned skill. The ownership wiring (NewUninstallRoot, the RuntimeDirectory arm in validUninstallRoot, the runtimeRank entry) is small and consistent with the existing tables, and the --target-dir/--runtime mutual exclusion in parseUpdateArgs holds.

Two defects and two evidence gaps. The main one: runDirectoryUpdate maps every candidate-build failure to invalid_catalog, and the candidate build also fails when the target path is not absolute, so the documented relative-path invocation of update reports a catalog error that has nothing to do with the catalog. Separately, this PR drops a still-true assertion (docs/README.md listed in the root README) from test_foundation_documents_state_clean_target_status — unrelated to directory lifecycle and unexplained in the PR body. On the evidence side, the update test never checks the manifest refresh the acceptance criteria name, and its ../../catalog fixture resolves only because Go runs the package test with internal/cli as the working directory.

Blocking findings

  • A relative or malformed --target-dir is reported as invalid_catalog (internal/cli/update.go:245): buildDirectoryUpdateCandidate fails for two unrelated reasons: the catalog cannot be built, or skillroot.ResolveIntoDirectory rejects the target (its validPath requires filepath.IsAbs). Both collapse into writeError(stderr, "invalid_catalog") with exit 1. runUninstallCommand gets this right — NewUninstallRoot returns invalid_target for the same class of path — so update now contradicts its sibling command and the operating guide, which documents ./agent-skills style paths as usable.
    • Failure scenario: An installed target at ./agent-skills with a valid ./catalog. cortex update --target-dir ./agent-skills --catalog ./catalog passes os.Stat, then ResolveIntoDirectory refuses the non-absolute root, and the command prints error=invalid_catalog and exits 1. The operator hunts a catalog problem that does not exist, and no diagnostic mentions the path.

Acceptance criteria

  • Fixed: A relative or malformed --target-dir is reported as invalid_catalog (internal/cli/update.go:245). The scenario below no longer reproduces: An installed target at ./agent-skills with a valid ./catalog. cortex update --target-dir ./agent-skills --catalog ./catalog passes os.Stat, then ResolveIntoDirectory refuses the non-absolute root, and the command prints error=invalid_catalog and exits 1. The operator hunts a catalog problem that does not exist, and no diagnostic mentions the path.

Activity

  1. barbatdev commented on Oct 24, 2026

    @barbatdev
    ContributorAuthor

    Fleet issue review (glm)

    Recommendation: approve

    Well-formed QA follow-up: it isolates one concrete defect (runDirectoryUpdate collapses the non-absolute-target failure of skillroot.ResolveIntoDirectory into invalid_catalog at internal/cli/update.go:245), quotes a reproducible failure scenario, and its single acceptance criterion is directly testable by rerunning the documented relative-path update invocation. The named code paths (internal/cli/update.go, docs/README.md) exist on the default branch, and the referenced sibling behavior (runUninstallCommand returning invalid_target) gives a clear consistency target. No open questions remain in the body or comments.

    Item Pass Evidence
    clear problem yes A relative --target-dir on an installed target is reported as invalid_catalog (internal/cli/update.go:245) because buildDirectoryUpdateCandidate merges catalog errors with skillroot.ResolveIntoDirectory's filepath.IsAbs rejection; runUninstallCommand correctly returns invalid_target for the same class of path.
    acceptance criteria present and testable yes One checkbox: the exact scenario (cortex update --target-dir ./agent-skills --catalog ./catalog printing error=invalid_catalog, exit 1) must no longer reproduce — verifiable by running the documented invocation.
    scope bounded yes Single error-mapping fix in the update command path plus a regression test; no unrelated scope.
    no open questions yes Body and comments contain no unresolved decisions; the expected behavior is pinned to the sibling uninstall command's invalid_target handling.
    grounded in upstream yes exists: internal/cli/update.go=true, docs/README.md=true on the default branch.

    Juan merges; the fleet applies the status:approved label when a review recommends approve.

  2. barbatdev commented on Nov 12, 2026

    @barbatdev
    ContributorAuthor

    Fixed by #388 (merged 46f2870): update --target-dir refuses relative or malformed targets as invalid_target before reading the catalog (update.go:245-246). Covered by TestDirectoryTargetCommandsRefuseRelativeTargets with a valid absolute catalog and --apply, which passes on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions