985bad7b9e
Add task_validation module that validates files before task assignment: - Checks file existence before dispatching tasks - Filters out files from non-source directories (.git/, .opencode/, etc.) - Logs invalid files with descriptive error messages - Provides filter_files_for_task_assignment() for bulk validation Add comprehensive BDD tests covering: - Valid source file validation - Non-existent file rejection - Skip directory filtering (.git/, .opencode/, etc.) - Directory path rejection - Empty path handling - Absolute path validation - Bulk file filtering This fixes the bug where bug-hunt-pool-supervisor assigned tasks for non-existent files like /app/.git/apply_labels_cleanup.py. ISSUES CLOSED: #9365
80 lines
3.7 KiB
Gherkin
80 lines
3.7 KiB
Gherkin
Feature: Task validation for bug hunt pool supervisor
|
|
As a bug hunt pool supervisor
|
|
I want to validate files before assigning tasks
|
|
So that workers are not dispatched for non-existent or invalid files
|
|
|
|
Background:
|
|
Given a temporary test repository
|
|
|
|
Scenario: Validate existing source file
|
|
Given a file "src/cleveragents/agents/base.py" exists for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should pass
|
|
And no error message should be returned for task validation
|
|
|
|
Scenario: Reject non-existent file
|
|
Given a file "src/cleveragents/agents/nonexistent.py" does not exist for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should fail
|
|
And the task validation error message should contain "does not exist"
|
|
|
|
Scenario: Reject file in .git directory
|
|
Given a file ".git/apply_labels_cleanup.py" does not exist for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should fail
|
|
And the task validation error message should contain "non-source directory"
|
|
|
|
Scenario: Reject file in .opencode directory
|
|
Given a file ".opencode/scripts/apply_tracking_updates.py" exists for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should fail
|
|
And the task validation error message should contain "non-source directory"
|
|
|
|
Scenario: Filter multiple files
|
|
Given a list of files for task validation:
|
|
| file_path | should_be_valid |
|
|
| src/cleveragents/agents/base.py | true |
|
|
| features/steps/agent_skills_loader_steps.py | true |
|
|
| .git/apply_labels_cleanup.py | false |
|
|
| nonexistent_file.py | false |
|
|
| .opencode/scripts/apply_tracking_updates.py | false |
|
|
When I filter the files for task assignment
|
|
Then the valid files for task assignment should be:
|
|
| src/cleveragents/agents/base.py |
|
|
| features/steps/agent_skills_loader_steps.py |
|
|
And the invalid files for task assignment should be:
|
|
| .git/apply_labels_cleanup.py |
|
|
| nonexistent_file.py |
|
|
| .opencode/scripts/apply_tracking_updates.py |
|
|
|
|
Scenario: Reject directory path
|
|
Given a directory "src/cleveragents" exists for task validation
|
|
When I validate the directory for task assignment
|
|
Then the task validation should fail
|
|
And the task validation error message should contain "not a file"
|
|
|
|
Scenario: Handle empty file path
|
|
Given an empty file path for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should fail
|
|
And the task validation error message should contain "empty"
|
|
|
|
Scenario: Validate file with absolute path
|
|
Given a file "src/cleveragents/agents/base.py" exists for task validation
|
|
When I validate the file with absolute path for task assignment
|
|
Then the task validation should pass
|
|
And no error message should be returned for task validation
|
|
|
|
Scenario: Skip directories in path validation
|
|
Given a file "src/cleveragents/agents/base.py" exists for task validation
|
|
When I validate the file for task assignment
|
|
Then the task validation should pass
|
|
And the file should not be in any skip directory for task validation
|
|
|
|
Scenario: Log invalid files
|
|
Given a list of invalid files for task validation:
|
|
| .git/apply_labels_cleanup.py |
|
|
| nonexistent_file.py |
|
|
When I log the invalid files for task validation
|
|
Then the log should contain warnings for each invalid file for task validation
|