fix(acms): fix BDD test table headers, missing steps, and code formatting
CI / helm (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 1m25s
CI / build (pull_request) Successful in 57s
CI / typecheck (pull_request) Successful in 1m41s
CI / quality (pull_request) Successful in 1m41s
CI / security (pull_request) Successful in 1m47s
CI / integration_tests (pull_request) Successful in 4m1s
CI / e2e_tests (pull_request) Successful in 3m46s
CI / unit_tests (pull_request) Failing after 4m43s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 9m59s
CI / status-check (pull_request) Failing after 3s
CI / helm (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 1m25s
CI / build (pull_request) Successful in 57s
CI / typecheck (pull_request) Successful in 1m41s
CI / quality (pull_request) Successful in 1m41s
CI / security (pull_request) Successful in 1m47s
CI / integration_tests (pull_request) Successful in 4m1s
CI / e2e_tests (pull_request) Successful in 3m46s
CI / unit_tests (pull_request) Failing after 4m43s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 9m59s
CI / status-check (pull_request) Failing after 3s
- Add missing | key | value | header to index entry creation table
- Add missing | filter | value | header to combined query filters table
- Fix file type step pattern to use quoted {file_type} parameter
- Add missing Given step for creating index with N entries
- Add missing When step for traversal with specific chunk size
- Apply ruff format fixes to index.py and acms_index_data_model_steps.py
This commit is contained in:
@@ -9,6 +9,7 @@ Feature: ACMS Index Data Model and File Traversal Engine
|
||||
|
||||
Scenario: Create an index entry with file metadata
|
||||
When I create an index entry with:
|
||||
| key | value |
|
||||
| path | /project/src/main.py |
|
||||
| file_type | python |
|
||||
| size_bytes | 1024 |
|
||||
@@ -131,6 +132,7 @@ Feature: ACMS Index Data Model and File Traversal Engine
|
||||
| /project/tests/test_main.py | python | test | tier_2 |
|
||||
| /project/docs/readme.md | markdown | docs | tier_2 |
|
||||
When I query the index with filters:
|
||||
| filter | value |
|
||||
| path_pattern | src |
|
||||
| file_type | python |
|
||||
| tier | tier_0 |
|
||||
|
||||
@@ -225,9 +225,7 @@ def step_deserialise_from_dict(context: Context) -> None:
|
||||
context.acms_deserialised = IndexEntry.from_dict(context.acms_serialised_dict)
|
||||
|
||||
|
||||
@given(
|
||||
'I have a raw ACMS dict without a tier key for path "{path}" and size {size:d}'
|
||||
)
|
||||
@given('I have a raw ACMS dict without a tier key for path "{path}" and size {size:d}')
|
||||
def step_raw_dict_no_tier(context: Context, path: str, size: int) -> None:
|
||||
now = datetime.now(tz=UTC).isoformat()
|
||||
context.acms_serialised_dict = {
|
||||
|
||||
@@ -186,7 +186,7 @@ def step_query_by_file_type(context, file_type):
|
||||
context.query_results = context.index.query_by_type(FileType(file_type))
|
||||
|
||||
|
||||
@then("all results should have file type {file_type}")
|
||||
@then('all results should have file type "{file_type}"')
|
||||
def step_check_all_results_file_type(context, file_type):
|
||||
"""Verify all results have the expected file type."""
|
||||
expected_type = FileType(file_type)
|
||||
@@ -370,6 +370,28 @@ def cleanup_temp_dir(context):
|
||||
|
||||
|
||||
# Register cleanup
|
||||
@given("I have an index with {count:d} entries")
|
||||
def step_create_index_with_n_entries(context, count):
|
||||
"""Create an index with a specified number of entries."""
|
||||
context.index = ACMSIndex()
|
||||
for i in range(count):
|
||||
entry = IndexEntry(
|
||||
path=f"/project/file{i}.py",
|
||||
file_type=FileType.PYTHON,
|
||||
size_bytes=1024,
|
||||
created_at=datetime.now(),
|
||||
modified_at=datetime.now(),
|
||||
)
|
||||
context.index.add_entry(entry)
|
||||
|
||||
|
||||
@when("I traverse and index the directory with chunk size {chunk_size:d}")
|
||||
def step_traverse_and_index_with_chunk_size(context, chunk_size):
|
||||
"""Traverse and index the test directory with a specific chunk size."""
|
||||
engine = FileTraversalEngine(chunk_size=chunk_size)
|
||||
context.index = engine.traverse_and_index(context.temp_dir.name)
|
||||
|
||||
|
||||
def after_scenario(context, scenario):
|
||||
"""Clean up after each scenario."""
|
||||
cleanup_temp_dir(context)
|
||||
|
||||
@@ -112,31 +112,21 @@ class ACMSIndex:
|
||||
|
||||
def query_by_path(self, path_pattern: str) -> list[IndexEntry]:
|
||||
"""Query entries by path pattern (substring match)."""
|
||||
return [
|
||||
entry
|
||||
for entry in self.entries.values()
|
||||
if path_pattern in entry.path
|
||||
]
|
||||
return [entry for entry in self.entries.values() if path_pattern in entry.path]
|
||||
|
||||
def query_by_tag(self, tag: str) -> list[IndexEntry]:
|
||||
"""Query entries by tag."""
|
||||
return [
|
||||
entry for entry in self.entries.values() if entry.has_tag(tag)
|
||||
]
|
||||
return [entry for entry in self.entries.values() if entry.has_tag(tag)]
|
||||
|
||||
def query_by_type(self, file_type: FileType) -> list[IndexEntry]:
|
||||
"""Query entries by file type."""
|
||||
return [
|
||||
entry
|
||||
for entry in self.entries.values()
|
||||
if entry.file_type == file_type
|
||||
entry for entry in self.entries.values() if entry.file_type == file_type
|
||||
]
|
||||
|
||||
def query_by_tier(self, tier: TierLevel) -> list[IndexEntry]:
|
||||
"""Query entries by tier level."""
|
||||
return [
|
||||
entry for entry in self.entries.values() if entry.tier == tier
|
||||
]
|
||||
return [entry for entry in self.entries.values() if entry.tier == tier]
|
||||
|
||||
def query_by_recency(
|
||||
self, after: datetime, before: datetime | None = None
|
||||
@@ -151,9 +141,7 @@ class ACMSIndex:
|
||||
List of entries matching the recency criteria
|
||||
"""
|
||||
results = [
|
||||
entry
|
||||
for entry in self.entries.values()
|
||||
if entry.modified_at >= after
|
||||
entry for entry in self.entries.values() if entry.modified_at >= after
|
||||
]
|
||||
if before:
|
||||
results = [entry for entry in results if entry.modified_at <= before]
|
||||
@@ -182,29 +170,21 @@ class ACMSIndex:
|
||||
results = list(self.entries.values())
|
||||
|
||||
if path_pattern:
|
||||
results = [
|
||||
entry for entry in results if path_pattern in entry.path
|
||||
]
|
||||
results = [entry for entry in results if path_pattern in entry.path]
|
||||
|
||||
if tags:
|
||||
results = [
|
||||
entry
|
||||
for entry in results
|
||||
if any(tag in entry.tags for tag in tags)
|
||||
entry for entry in results if any(tag in entry.tags for tag in tags)
|
||||
]
|
||||
|
||||
if file_type:
|
||||
results = [
|
||||
entry for entry in results if entry.file_type == file_type
|
||||
]
|
||||
results = [entry for entry in results if entry.file_type == file_type]
|
||||
|
||||
if tier:
|
||||
results = [entry for entry in results if entry.tier == tier]
|
||||
|
||||
if after:
|
||||
results = [
|
||||
entry for entry in results if entry.modified_at >= after
|
||||
]
|
||||
results = [entry for entry in results if entry.modified_at >= after]
|
||||
|
||||
return results
|
||||
|
||||
@@ -277,9 +257,7 @@ class FileTraversalEngine:
|
||||
except (OSError, ValueError):
|
||||
return None
|
||||
|
||||
def _traverse_directory(
|
||||
self, root_path: Path
|
||||
) -> Iterator[Path]:
|
||||
def _traverse_directory(self, root_path: Path) -> Iterator[Path]:
|
||||
"""Recursively traverse directory and yield file paths.
|
||||
|
||||
Args:
|
||||
|
||||
Reference in New Issue
Block a user