style(acms): apply ruff format to fix CI lint format check failure
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m18s
CI / build (pull_request) Successful in 32s
CI / typecheck (pull_request) Successful in 1m25s
CI / quality (pull_request) Successful in 1m29s
CI / push-validation (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 45s
CI / security (pull_request) Successful in 1m45s
CI / benchmark-regression (pull_request) Failing after 42s
CI / e2e_tests (pull_request) Successful in 3m5s
CI / integration_tests (pull_request) Failing after 4m41s
CI / unit_tests (pull_request) Failing after 5m57s
CI / docker (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 10m25s
CI / status-check (pull_request) Failing after 3s

The CI lint job runs both ruff check and ruff format --check. The format
check was failing because 5 files had formatting inconsistencies. Applied
ruff format to fix the CI lint failure.

ISSUES CLOSED: #9584
This commit is contained in:
2026-05-04 22:07:10 +00:00
parent e08942f1b1
commit d18e92983c
5 changed files with 38 additions and 61 deletions
+2 -8
View File
@@ -43,18 +43,12 @@ policies:
_YAML_CONFIG_10 = """
view_name: bench_view
policies:
""" + "\n".join(
f" - name: policy{i}\n priority_weight: {i}.0"
for i in range(10)
)
""" + "\n".join(f" - name: policy{i}\n priority_weight: {i}.0" for i in range(10))
_YAML_CONFIG_100 = """
view_name: bench_view
policies:
""" + "\n".join(
f" - name: policy{i}\n priority_weight: {i}.0"
for i in range(100)
)
""" + "\n".join(f" - name: policy{i}\n priority_weight: {i}.0" for i in range(100))
_TOML_CONFIG_1 = """
view_name = "bench_view"
@@ -31,9 +31,7 @@ def step_have_loader(context: Any) -> None:
@given("I have a YAML configuration file with:")
def step_have_yaml_file(context: Any) -> None:
"""Create a temporary YAML configuration file."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=".yaml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as tmp:
tmp.write(context.text)
context.config_path = tmp.name
@@ -41,9 +39,7 @@ def step_have_yaml_file(context: Any) -> None:
@given("I have a TOML configuration file with:")
def step_have_toml_file(context: Any) -> None:
"""Create a temporary TOML configuration file."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=".toml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".toml", delete=False) as tmp:
tmp.write(context.text)
context.config_path = tmp.name
@@ -169,9 +165,7 @@ def step_check_file_not_found_error(context: Any) -> None:
@given("I have a configuration file with unsupported format {fmt}")
def step_have_unsupported_format(context: Any, fmt: str) -> None:
"""Create a file with unsupported format."""
with tempfile.NamedTemporaryFile(
mode="w", suffix=fmt, delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=fmt, delete=False) as tmp:
tmp.write("{}")
context.config_path = tmp.name
@@ -239,8 +233,7 @@ def step_have_policy_config(context: Any) -> None:
context.policy_config = ViewPolicyConfiguration(
view_name=config_dict.get("view_name", "default"),
policies=[
ContextPolicyConfig(name=p["name"])
for p in config_dict.get("policies", [])
ContextPolicyConfig(name=p["name"]) for p in config_dict.get("policies", [])
],
)
@@ -345,7 +338,9 @@ def step_apply_policy(context: Any) -> None:
def step_check_assembled_budget(context: Any, budget: int) -> None:
"""Check the budget in the assembled context."""
# Support both direct assembler context and integration context
assembled = getattr(context, "assembled", None) or getattr(context, "llm_context", None)
assembled = getattr(context, "assembled", None) or getattr(
context, "llm_context", None
)
assert assembled is not None
assert assembled["assembled_data"].get("budget") == budget
@@ -368,7 +363,9 @@ def step_policy_disabled(context: Any) -> None:
def step_policy_not_applied(context: Any) -> None:
"""Check that the policy was not applied."""
# Support both direct assembler context and integration context
assembled = getattr(context, "assembled", None) or getattr(context, "llm_context", None)
assembled = getattr(context, "assembled", None) or getattr(
context, "llm_context", None
)
assert assembled is not None
assert "policy1" not in assembled.get("policies_applied", [])
@@ -402,7 +399,9 @@ def step_policy_multiple_scopes(context: Any) -> None:
context.policy_config.policies[0].scopes.append(scope)
@when("I apply the policy to context with multiple scopes: file_type {file_type} path {path}")
@when(
"I apply the policy to context with multiple scopes: file_type {file_type} path {path}"
)
def step_apply_policy_multiple_scopes(context: Any, file_type: str, path: str) -> None:
"""Apply policy to context with multiple scope values."""
context.test_context = {"file_type": file_type, "path": path}
@@ -35,9 +35,7 @@ def step_no_policy_config(context: Any) -> None:
@given("I have a policy configuration with {count:d} policy")
def step_have_policy_config(context: Any, count: int) -> None:
"""Create a policy configuration with specified number of policies."""
policies = [
ContextPolicyConfig(name=f"policy{i+1}") for i in range(count)
]
policies = [ContextPolicyConfig(name=f"policy{i + 1}") for i in range(count)]
context.policy_config = ViewPolicyConfiguration(
view_name="test_view",
policies=policies,
@@ -61,9 +59,7 @@ def step_have_raw_context(context: Any) -> None:
def step_prepare_llm_context(context: Any) -> None:
"""Prepare LLM context from raw context."""
context.raw_context = {"file_type": "python", "path": "src/module.py"}
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the LLM context should be the same as the raw context")
@@ -88,9 +84,7 @@ def step_have_policy_file(context: Any) -> None:
"view_name": "test_view",
"policies": [{"name": "policy1"}],
}
with tempfile.NamedTemporaryFile(
mode="w", suffix=".yaml", delete=False
) as tmp:
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as tmp:
yaml.dump(config_data, tmp)
context.config_path = tmp.name
@@ -156,9 +150,7 @@ def step_load_toml_policy_string(context: Any) -> None:
@when("I prepare LLM context for plan execution")
def step_prepare_llm_context_plan(context: Any) -> None:
"""Prepare LLM context for plan execution."""
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the LLM context should include applied policies")
@@ -245,9 +237,7 @@ def step_scope_rule(context: Any, value: str) -> None:
def step_prepare_context_file_type(context: Any, file_type: str) -> None:
"""Prepare LLM context with specific file type."""
context.raw_context = {"file_type": file_type}
context.llm_context = context.integration.prepare_llm_context(
context.raw_context
)
context.llm_context = context.integration.prepare_llm_context(context.raw_context)
@then("the policy should be applied")
+15 -15
View File
@@ -25,8 +25,8 @@ AGENT_PREFIXES = {
}
# Title format patterns
TRACKING_TITLE_PATTERN = re.compile(r'^\[AUTO-([A-Z-]+)\] (.+) \(Cycle (\d+)\)$')
ANNOUNCEMENT_TITLE_PATTERN = re.compile(r'^\[AUTO-([A-Z-]+)\] Announce: (.+)$')
TRACKING_TITLE_PATTERN = re.compile(r"^\[AUTO-([A-Z-]+)\] (.+) \(Cycle (\d+)\)$")
ANNOUNCEMENT_TITLE_PATTERN = re.compile(r"^\[AUTO-([A-Z-]+)\] Announce: (.+)$")
def validate_tracking_title(title: str) -> tuple[bool, str]:
@@ -95,15 +95,15 @@ def validate_automation_tracking_issue(issue_data: dict[str, Any]) -> list[str]:
errors = []
# Validate title
title = issue_data.get('title', '')
title = issue_data.get("title", "")
is_valid, message = validate_tracking_title(title)
if not is_valid:
errors.append(f"Title format error: {message}")
# Validate labels
labels = issue_data.get('labels', [])
labels = issue_data.get("labels", [])
label_names = [
label.get('name', '') if isinstance(label, dict) else str(label)
label.get("name", "") if isinstance(label, dict) else str(label)
for label in labels
]
@@ -111,12 +111,12 @@ def validate_automation_tracking_issue(issue_data: dict[str, Any]) -> list[str]:
errors.append("Missing required 'Automation Tracking' label")
# Validate body content (basic checks)
body = issue_data.get('body', '')
body = issue_data.get("body", "")
if not body.strip():
errors.append("Issue body cannot be empty")
# Check for common required elements in body
if '**Automated by CleverAgents Bot**' not in body:
if "**Automated by CleverAgents Bot**" not in body:
errors.append("Missing automation signature in body")
return errors
@@ -134,13 +134,13 @@ def get_tracking_issues_from_repo(owner: str, repo: str) -> list[dict[str, Any]]
def main() -> int:
"""Run the validation script."""
parser = argparse.ArgumentParser(description='Validate automation tracking issues')
parser.add_argument('--title', help='Validate a single title string')
parser.add_argument('--repo', help='Validate issues from repository (owner/repo)')
parser = argparse.ArgumentParser(description="Validate automation tracking issues")
parser.add_argument("--title", help="Validate a single title string")
parser.add_argument("--repo", help="Validate issues from repository (owner/repo)")
parser.add_argument(
'--validate-all',
action='store_true',
help='Run comprehensive validation examples',
"--validate-all",
action="store_true",
help="Run comprehensive validation examples",
)
args = parser.parse_args()
@@ -154,7 +154,7 @@ def main() -> int:
elif args.repo:
try:
owner, repo_name = args.repo.split('/', 1)
owner, repo_name = args.repo.split("/", 1)
get_tracking_issues_from_repo(owner, repo_name)
print(f"Repository validation for {args.repo} completed")
return 0
@@ -210,5 +210,5 @@ def main() -> int:
return 1
if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())
@@ -31,9 +31,7 @@ class ACMSContextAssembler:
if policy_config is None:
raise ValueError("policy_config must not be None")
self.policy_config = policy_config
self.enabled_policies = [
p for p in policy_config.policies if p.enabled
]
self.enabled_policies = [p for p in policy_config.policies if p.enabled]
def assemble_context(self, raw_context: dict[str, Any]) -> dict[str, Any]:
"""Assemble context using ACMS policies.
@@ -82,9 +80,7 @@ class ACMSContextAssembler:
return all(scope.matches(context) for scope in scopes)
def _apply_policy(
self, policy: Any, raw_context: dict[str, Any]
) -> dict[str, Any]:
def _apply_policy(self, policy: Any, raw_context: dict[str, Any]) -> dict[str, Any]:
"""Apply a policy to the raw context.
Args:
@@ -147,9 +143,7 @@ class PlanExecutionACMSIntegration:
if policy_config:
self.assembler = ACMSContextAssembler(policy_config)
def prepare_llm_context(
self, raw_context: dict[str, Any]
) -> dict[str, Any]:
def prepare_llm_context(self, raw_context: dict[str, Any]) -> dict[str, Any]:
"""Prepare context for LLM calls using ACMS assembly.
This method is the integration point between the plan execution