test: add TDD bug-capture test for #987 — AutomationProfileRepository session leak #1104
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#1092 TDD: Write failing test for #987 — AutomationProfileRepository session leak
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!1104
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tdd/m5-automation-profile-session-leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
AutomationProfileRepositoryinauto_commitmode does not close DB sessions onupsert()/delete()paths.@tdd_bug,@tdd_bug_987,@tdd_expected_fail) so CI remains green until the production fix lands.tracking_session.close) so scenario teardown reliably executes with the existingafter_scenariosuppression wrapper.Motivation
Bug #987 is a session lifecycle leak in repository write paths. This PR captures the buggy behavior as a reproducible, behavior-driven regression test so the subsequent fix can be validated and the expected-fail tag removed safely.
Approach
AutomationProfileRepository.close()is invoked across success and failure paths._cleanup_handlers(instead of a non-callablesuppress(...)wrapper) to ensure teardown handlers are actually executable.Notes
Closes #1092
Review: REQUEST CHANGES
Issues Found:
Critical: Empty PR body — The PR has no description whatsoever. Per CONTRIBUTING.md, every PR must include a clear, descriptive body explaining the purpose of the change, a summary, and an issue reference with a closing keyword. Without a body, there is no
Closesdirective, so the TDD tracking issue will not auto-close on merge. Please add:Closes #1092(or the appropriate TDD tracking issue number)Branch naming mismatch — The branch is
tdd/m5-automation-profile-session-leakbut milestone v3.5.0 corresponds to M6 (Autonomy Hardening), not M5. Per thetdd/mN-naming convention, this should betdd/m6-automation-profile-session-leak.What's correct:
@tdd_expected_fail @tdd_bug @tdd_bug_987present at Feature levelfeatures/, steps infeatures/steps/Action Required:
Closeskeywordtdd/m5-totdd/m6-to match the milestoneDay 43 Review — PR #1104
test: TDD for #987 — AutomationProfileRepository session leakVerdict: APPROVED
TDD Verification
This is a TDD PR capturing bug #987. Standard TDD review checklist:
@tdd_bug,@tdd_bug_987,@tdd_expected_fail)test:prefixThe PR is mergeable with no conflicts. Once merged, the corresponding bug fix branch can be created from
master.@hamza.khyari — Please review and approve for second approval.
33d463043924c7e633baNew commits pushed, approval review dismissed automatically according to repository settings
24c7e633ba5cd7e611b9Review: APPROVED
TDD tags correct (
@tdd_bug @tdd_bug_987 @tdd_expected_fail). Behave steps fully implemented for AutomationProfileRepository session leak bug. CHANGELOG entry present.Note
Missing Robot Framework integration tests. Consider adding in a follow-up for consistency.
Self-QA Closeout Status (Current Work Posted)
Current review outcome
@tdd_expected_fail(success-path operation failures can be inverted without proving the intended leak behavior).What has already been improved across prior cycles
Closeout recommendation
Before merge, add:
This comment records the current self-QA closeout state; no approval is being posted.
New commits pushed, approval review dismissed automatically according to repository settings
4e4e81c2a4814e36f46dAddressed the outstanding review/self-QA requests on this PR:
Added missing test coverage
Then the repository operation should have succeededafter success-pathupsertanddeleteactions.delete of missing profile still closes session in auto_commit modeAutomationProfileNotFoundError) and session closure is still expected.robot/tdd_automation_profile_session_leak.robotrobot/helper_tdd_automation_profile_session_leak.pyLocal verification (logs saved to /tmp)
nox -s lint✅ (/tmp/nox-lint-1104.log)nox -s unit_tests -- features/tdd_automation_profile_session_leak.feature✅ (/tmp/nox-unit-1104.log)The Behave assertions intentionally fail on current behavior (session not closed) and are inverted by
@tdd_expected_fail, preserving the bug-capture semantics for #987.09f2a68fa9b520edef1cReview: test: add TDD bug-capture test for #987 — AutomationProfileRepository session leak
Approved. Clean TDD bug-capture test with proper
@tdd_expected_failand@tdd_bugtags, conventional commit format, and issue reference.b520edef1cb3f826520fNew commits pushed, approval review dismissed automatically according to repository settings
b3f826520f69e2d1f179