Files
cleveragents-core/features/project_show_after_create.feature
brent.edwards 16dc4ab18d fix(project): show created project after creation (#593)
## Summary

Fix `agents project show` not finding a project immediately after creation. Extends the `session.commit()` fix from #589 to also cover `update()` and `delete()` in `NamespacedProjectRepository`.

## Changes

**Production fix** (`src/cleveragents/infrastructure/database/repositories.py`):
- Add `session.commit()` to `create()`, `update()`, and `delete()` methods
- Add `finally: session.close()` guard to all three methods
- Update class docstring to reflect commit-per-method pattern

**Tests & benchmarks**:
- 3 Behave BDD regression scenarios (`features/project_show_after_create.feature`)
- Robot Framework integration smoke tests with "not found" assertion (`robot/project_show_after_create.robot`)
- ASV benchmarks for create-then-show round-trip (`benchmarks/project_show_after_create_bench.py`)

## Review feedback addressed

- **F1**: Removed unrelated em-dash CHANGELOG edits — wrote clean entry from scratch
- **F2**: Kept Suite Setup/Teardown (required for `${PYTHON}` variable); updated stale docs
- **F3**: Added "not found" string assertion to Robot negative test case
- **F4**: Removed redundant `Base.metadata.create_all()` from `_make_fresh_repo()` helper
- Updated all stale TDD "expected to fail" comments — this PR includes the fix

## Process

- Single squashed commit, rebased onto `master` (no merge commits)
- Prescribed commit message from issue #590 metadata

ISSUES CLOSED: #590

Reviewed-on: cleveragents/cleveragents-core#593
Reviewed-by: Rui Hu <rui.hu@cleverthis.com>
Co-authored-by: Brent E. Edwards <brent.edwards@cleverthis.com>
Co-committed-by: Brent E. Edwards <brent.edwards@cleverthis.com>
2026-03-09 07:56:38 +00:00

30 lines
1.4 KiB
Gherkin

# Regression tests for bug #590: project show must find a project immediately after creation.
Feature: Project show displays a created project
As a developer using the agents CLI
I want "agents project show" to display a project I just created
So that I can verify the project details after creation
Background:
Given a fresh project-show database is initialised
@tdd @bug590
Scenario: Show displays a project that was just created
When I create a project named "local/my-app" via the project-show CLI
And I show the project "local/my-app" via the project-show CLI
Then the project-show output should contain "local/my-app"
And the project-show exit code should be 0
@tdd @bug590
Scenario: Show displays correct details for a created project with description
When I create a described project named "local/webapp" with description "My web app" via the project-show CLI
And I show the project "local/webapp" via the project-show CLI
Then the project-show output should contain "local/webapp"
And the project-show output should contain "My web app"
And the project-show exit code should be 0
@tdd @bug590
Scenario: Show returns error for a project that does not exist
When I show the project "local/nonexistent" via the project-show CLI
Then the project-show output should contain "not found"
And the project-show exit code should not be 0