fix(acms): restore explicit UKO re-exports, fix type annotations, clean lint directives
CI / unit_tests (pull_request) Has started running
CI / lint (pull_request) Failing after 53s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m33s
CI / integration_tests (pull_request) Has started running
CI / build (pull_request) Successful in 33s
CI / helm (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 30s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
CI / unit_tests (pull_request) Has started running
CI / lint (pull_request) Failing after 53s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m33s
CI / integration_tests (pull_request) Has started running
CI / build (pull_request) Successful in 33s
CI / helm (pull_request) Successful in 29s
CI / push-validation (pull_request) Successful in 30s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
Restore explicit 'from cleveragents.acms.uko import (...)' block in __init__.py so that acms_skeleton_compressor.py can import CODE_DETAIL_LEVEL_MAP etc. Fix invalid dict[str, callable] annotation in robot helper to use collections.abc.Callable[[], None]. Remove unused noqa directives (E501, C901) now that ruff rules are stricter. ISSUES CLOSED: #9583
This commit is contained in:
@@ -12,7 +12,7 @@ def step_create_budget_enforcer_with_max_file_size(
|
||||
context: object, size: int
|
||||
) -> None:
|
||||
"""Create a fresh budget enforcer with specified max_file_size."""
|
||||
context.budget_enforcer = BudgetEnforcer(max_file_size=size, max_total_size=10000) # noqa: E501
|
||||
context.budget_enforcer = BudgetEnforcer(max_file_size=size, max_total_size=10000)
|
||||
context.file_counter = 0
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def step_create_budget_enforcer_with_max_total_size(
|
||||
enforcer's constraint since both Background steps run sequentially.
|
||||
"""
|
||||
_max_file_size: int
|
||||
if hasattr(context, "budget_enforcer") and context.budget_enforcer is not None: # noqa: E501
|
||||
if hasattr(context, "budget_enforcer") and context.budget_enforcer is not None:
|
||||
_max_file_size = context.budget_enforcer.max_file_size
|
||||
else:
|
||||
_max_file_size = 10000
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from collections.abc import Callable
|
||||
|
||||
|
||||
def _test_file_within_limit() -> None:
|
||||
@@ -241,7 +241,7 @@ def _test_assembled_context() -> None:
|
||||
print("assembled-context-ok")
|
||||
|
||||
|
||||
_TESTS: dict[str, callable] = {
|
||||
_TESTS: dict[str, Callable[[], None]] = {
|
||||
"file-within-limit": _test_file_within_limit,
|
||||
"file-exceeds-limit": _test_file_exceeds_limit,
|
||||
"total-size-cutoff": _test_total_size_cutoff,
|
||||
@@ -255,7 +255,7 @@ _TESTS: dict[str, callable] = {
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__": # noqa: C901
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2 or sys.argv[1] not in _TESTS:
|
||||
print(
|
||||
f"Usage: {sys.argv[0]} <{'|'.join(sorted(_TESTS))}>",
|
||||
|
||||
@@ -19,9 +19,56 @@ from cleveragents.acms.index import (
|
||||
IndexEntry,
|
||||
TierLevel,
|
||||
)
|
||||
|
||||
# Re-export UKO vocabulary symbols for convenience
|
||||
_uko_exports: list[str] = list(_uko.__all__)
|
||||
from cleveragents.acms.uko import (
|
||||
CODE_DETAIL_LEVEL_MAP,
|
||||
FUNC_DETAIL_LEVEL_MAP,
|
||||
JAVA_DETAIL_LEVELS,
|
||||
JAVA_VOCABULARY,
|
||||
OO_DETAIL_LEVEL_MAP,
|
||||
PROC_DETAIL_LEVEL_MAP,
|
||||
PYTHON_DETAIL_LEVELS,
|
||||
PYTHON_VOCABULARY,
|
||||
RUST_DETAIL_LEVELS,
|
||||
RUST_VOCABULARY,
|
||||
TYPESCRIPT_DETAIL_LEVELS,
|
||||
TYPESCRIPT_VOCABULARY,
|
||||
DetailLevelMapBuilder,
|
||||
DuplicateVocabularyError,
|
||||
JavaAnnotation,
|
||||
JavaCheckedException,
|
||||
JavaClass,
|
||||
JavaInterface,
|
||||
JavaMethod,
|
||||
Layer2Dependency,
|
||||
ParadigmVocabulary,
|
||||
ProvenanceInfo,
|
||||
PythonClass,
|
||||
PythonDecorator,
|
||||
PythonFunction,
|
||||
PythonModule,
|
||||
PythonTypeStub,
|
||||
RustDeriveAttribute,
|
||||
RustFunction,
|
||||
RustImpl,
|
||||
RustStruct,
|
||||
RustTrait,
|
||||
TypeScriptClass,
|
||||
TypeScriptFunction,
|
||||
TypeScriptInterface,
|
||||
TypeScriptModule,
|
||||
UKOClass,
|
||||
UKOProperty,
|
||||
UKOVocabulary,
|
||||
VocabularyClass,
|
||||
VocabularyProperty,
|
||||
VocabularyRegistry,
|
||||
build_detail_level_map,
|
||||
build_effective_map,
|
||||
get_func_vocabulary,
|
||||
get_oo_vocabulary,
|
||||
get_proc_vocabulary,
|
||||
resolve_detail_level,
|
||||
)
|
||||
|
||||
# Index model exports
|
||||
_index_exports: list[str] = [
|
||||
@@ -39,4 +86,5 @@ _budget_exports: list[str] = [
|
||||
"ContextFile",
|
||||
]
|
||||
|
||||
__all__: list[str] = _budget_exports + _uko_exports + _index_exports
|
||||
# Full __all__ includes uko symbols (already bound as explicit imports) + index + budget
|
||||
__all__: list[str] = [*_uko.__all__, *_index_exports, *_budget_exports]
|
||||
|
||||
@@ -115,7 +115,10 @@ class BudgetEnforcer:
|
||||
file_obj = ContextFile(name=name, content=content)
|
||||
|
||||
# Check max_file_size constraint
|
||||
assert file_obj.size is not None # always set by __post_init__
|
||||
if file_obj.size is None:
|
||||
raise RuntimeError(
|
||||
f"Internal error: {name} has no size; budget enforcement logic error"
|
||||
)
|
||||
if file_obj.size > self.max_file_size:
|
||||
violation = BudgetViolation(
|
||||
violation_type="max_file_size",
|
||||
|
||||
Reference in New Issue
Block a user