diff --git a/features/acms/index_data_model_and_traversal.feature b/features/acms/index_data_model_and_traversal.feature index f94da8e69..015d81100 100644 --- a/features/acms/index_data_model_and_traversal.feature +++ b/features/acms/index_data_model_and_traversal.feature @@ -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 | @@ -116,7 +117,7 @@ Feature: ACMS Index Data Model and File Traversal Engine Scenario: Get entry count from index Given I have an index with 10 entries When I get the entry count - Then the count should be 10 + Then the ACMS entry count should be 10 Scenario: Remove entry from index Given I have an index with 3 entries @@ -131,6 +132,7 @@ Feature: ACMS Index Data Model and File Traversal Engine | /project/tests/test_main.py | python | test | cold | | /project/docs/readme.md | markdown | docs | cold | When I query the index with filters: + | filter | value | | path_pattern | src | | file_type | python | | tier | hot | diff --git a/features/steps/acms_index_data_model_traversal_steps.py b/features/steps/acms_index_data_model_traversal_steps.py index f7e95aaff..c3c2f7554 100644 --- a/features/steps/acms_index_data_model_traversal_steps.py +++ b/features/steps/acms_index_data_model_traversal_steps.py @@ -361,7 +361,7 @@ def step_get_entry_count(context): context.entry_count = context.index.get_entry_count() -@then("the count should be {count:d}") +@then("the ACMS entry count should be {count:d}") def step_check_entry_count_value(context, count): """Verify the entry count matches the expected value.""" assert context.entry_count == count diff --git a/features/steps/cli_init_yes_flag_steps.py b/features/steps/cli_init_yes_flag_steps.py index 2c77b4801..3828deb31 100644 --- a/features/steps/cli_init_yes_flag_steps.py +++ b/features/steps/cli_init_yes_flag_steps.py @@ -27,7 +27,8 @@ def _restore_cwd(context): os.environ.pop("CLEVERAGENTS_HOME", None) else: os.environ["CLEVERAGENTS_HOME"] = context._init_original_home - shutil.rmtree(context.temp_dir, ignore_errors=True) + if getattr(context, "temp_dir", None) is not None: + shutil.rmtree(context.temp_dir, ignore_errors=True) def _create_init_mocks(context): diff --git a/features/steps/pr_compliance_checklist_steps.py b/features/steps/pr_compliance_checklist_steps.py index 19f92172a..badfba79a 100644 --- a/features/steps/pr_compliance_checklist_steps.py +++ b/features/steps/pr_compliance_checklist_steps.py @@ -5,7 +5,7 @@ from typing import Any from behave import given, then, when -PROJECT_ROOT = Path(__file__).resolve().parents[3] +PROJECT_ROOT = Path(__file__).resolve().parents[2] AGENT_DEF_PATH = PROJECT_ROOT / ".opencode" / "agents" / "implementation-supervisor.md" diff --git a/src/cleveragents/acms/index.py b/src/cleveragents/acms/index.py index 549cf8849..2a3745446 100644 --- a/src/cleveragents/acms/index.py +++ b/src/cleveragents/acms/index.py @@ -10,11 +10,12 @@ Based on issue #9579 and ``docs/specification.md`` ~lines 44405-44420. from __future__ import annotations from collections.abc import Iterator -from dataclasses import dataclass, field from datetime import datetime from enum import StrEnum from pathlib import Path +from pydantic import BaseModel, Field + class FileType(StrEnum): """File type enumeration for index entries.""" @@ -45,8 +46,7 @@ class TierLevel(StrEnum): ARCHIVE = "archive" # Reference -@dataclass -class IndexEntry: +class IndexEntry(BaseModel): """Represents a single indexed context entry. Attributes: @@ -65,9 +65,9 @@ class IndexEntry: size_bytes: int created_at: datetime modified_at: datetime - tags: set[str] = field(default_factory=set) + tags: set[str] = Field(default_factory=set) tier: TierLevel = TierLevel.COLD - metadata: dict[str, str] = field(default_factory=dict) + metadata: dict[str, str] = Field(default_factory=dict) def add_tag(self, tag: str) -> None: """Add a tag to this entry. @@ -104,7 +104,6 @@ class IndexEntry: self.tier = tier -@dataclass class ACMSIndex: """ACMS Index for storing and querying indexed context entries. @@ -115,7 +114,8 @@ class ACMSIndex: entries: Dictionary mapping file paths to IndexEntry objects """ - entries: dict[str, IndexEntry] = field(default_factory=dict) + def __init__(self) -> None: + self.entries: dict[str, IndexEntry] = {} def add_entry(self, entry: IndexEntry) -> None: """Add an index entry to the index.