fix(resource): call bootstrap_builtin_types during initialization #625

Closed
freemo wants to merge 7 commits from feature/m3-fix-resource-bootstrap into master
Owner
No description provided.
Add TDD-style failing tests that verify the built-in git-checkout resource
type is available after initialization. Tests assert the correct expected
behavior: after agents init, the git-checkout type should exist in the
registry and 'agents resource add git-checkout' should succeed.

Tests are expected to fail until bug #524 is fixed, because
bootstrap_builtin_types() is never called during initialization. The fix
branch should be based on this branch so the fix commit inherits these tests.

Files added:
- features/resource_type_bootstrap_git.feature (2 Behave scenarios)
- features/steps/resource_type_bootstrap_git_steps.py (step definitions)
- robot/resource_type_bootstrap_git.robot (Robot Framework smoke test)

ISSUES CLOSED: #553
ISSUES CLOSED: #553
- Add @tdd @bug524 tags to both feature scenarios for selective execution
- Move module-level CliRunner singleton to per-step instantiation for
  consistency with PR #566 pattern

Refs: #553
- SPEC-1: Added genuine TDD failing Scenario 1 (@wip) that creates registry
  WITHOUT bootstrap and asserts git-checkout exists — reproduces bug #524.
  Existing scenarios retained as regression tests (no @wip since they pass).
  Added NOTE FOR FIX AUTHOR comment documenting fix-path expectations.
- BUG-1: Removed colliding @when('I run "agents resource add..."') step.
  Replaced with uniquely-prefixed bootstrap-git step pattern that invokes
  resource_add() directly with mocked DI, avoiding AmbiguousStep collision
  with wildcard @when('I run "{command}"') in cli_plan_context_commands_steps.
- BUG-2: Removed duplicate @then('the CLI exit code should be {code:d}').
  Replaced with prefixed bootstrap-git assertion steps.
- BUG-3: Removed duplicate @then('the CLI output should not contain...").
  Replaced with prefixed bootstrap-git assertion steps.
- TEST-1: Replaced bare MagicMock() with direct service patching via
  _PATCH_SERVICE, consistent with PR #567 pattern.
- TEST-2: Updated Robot docs from 'expected to FAIL' to 'regression tests'
  since both Robot tests call bootstrap explicitly and pass.
- CODE-1: Simplified hasattr guards on enum fields — removed redundant
  hasattr checks, using .value directly since ResourceKind and
  SandboxStrategy are always enums.
- TEST-3: Added assertion on bootstrap_builtin_types() return value via
  new Then step 'the bootstrap-git registered types should include'.
- Updated CHANGELOG from 'Two scenarios' to 'Three scenarios'.

Refs: #553
Addresses BUG-4 from hamza.khyari Round 2 review: @wip scenarios
broke `nox -s unit_tests` because behave.ini had no wip exclusion.
SystemExit(0) and SystemExit(None) are normal termination, not
failures. Only set failed=True when exit code is non-zero.
fix(resource): call bootstrap_builtin_types during initialization
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 34s
CI / typecheck (pull_request) Successful in 38s
CI / unit_tests (pull_request) Successful in 2m31s
CI / integration_tests (pull_request) Successful in 3m4s
CI / docker (pull_request) Successful in 39s
CI / coverage (pull_request) Successful in 5m11s
CI / benchmark-regression (pull_request) Successful in 28m35s
dcd55967f5
Add a call to bootstrap_builtin_types() in init_command() (project.py)
immediately after initialize_project() returns.  This seeds the built-in
resource types (fs-directory, git-checkout, etc.) into the database so
that "resource add" commands succeed without "Resource type not found"
errors.

The call is idempotent — invoking it multiple times will not create
duplicate types.

Also fix the TDD robot test (resource_type_bootstrap_git.robot) to
initialize a project before running "resource add", and fix a
pre-existing parallel test failure in plan_commands_new_coverage where
unittest.mock.patch could not reliably intercept PlanApplyService under
behave-parallel fork() workers.

ISSUES CLOSED: #523, #524
freemo added this to the v3.2.0 milestone 2026-03-07 06:14:49 +00:00
Author
Owner

Replaced with new PR

Replaced with new PR
freemo closed this pull request 2026-03-07 19:36:22 +00:00
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
Required
Details
CI / build (pull_request) Successful in 17s
Required
Details
CI / quality (pull_request) Successful in 19s
Required
Details
CI / security (pull_request) Successful in 34s
Required
Details
CI / typecheck (pull_request) Successful in 38s
Required
Details
CI / unit_tests (pull_request) Successful in 2m31s
Required
Details
CI / integration_tests (pull_request) Successful in 3m4s
Required
Details
CI / docker (pull_request) Successful in 39s
Required
Details
CI / coverage (pull_request) Successful in 5m11s
Required
Details
CI / benchmark-regression (pull_request) Successful in 28m35s

Pull request closed

Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!625
No description provided.