claude-dev-env 8.46.27 → 8.46.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,9 +30,9 @@ Search config for the exact value and a semantic match. Add timing to config/tim
30
30
 
31
31
  Run the named pytest node or command with the described input. A breach produces a rule finding; advisory checks write to stderr.
32
32
 
33
- - check_config_duplicate_path_anchor: two config constants pointing at the same path; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
33
+ - check_config_duplicate_path_anchor: two config constants pointing at the same path; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_config_duplicate_path_anchor.py::test_should_flag_reanchored_base_already_built_by_sibling` reports a named violation.
34
34
  - check_constants_outside_config: UPPER_SNAKE = 3 in a production module; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_config_path.py::test_should_produce_blocking_for_module_level_upper_snake_outside_config` reports a named violation.
35
- - check_constants_outside_config_advisory: a function-local UPPER_SNAKE constant; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a stderr advisory.
35
+ - check_constants_outside_config_advisory: a function-local UPPER_SNAKE constant; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_split_constants_config.py::test_advisory_should_flag_annotated_function_body_constant` reports a stderr advisory.
36
36
  - check_fstring_structural_literals: an f-string that embeds a URL path fragment; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_fstring_scan.py::test_should_flag_fstring_with_url_path` reports a named violation.
37
37
  - check_magic_values: a production function comparing a value with 2; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_magic_allowlist.py::test_check_magic_values_should_flag_literal_two_in_function_body` reports a named violation.
38
38
  - check_duplicated_format_patterns: the same f-string skeleton at three call sites; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_split_optional_params.py::test_should_advise_when_fstring_skeleton_appears_three_or_more_times` reports a stderr advisory.
@@ -46,15 +46,15 @@ Run the named pytest node or command with the described input. A breach produces
46
46
  - check_module_docstring_names_public_checks: a module summary omitting a public check; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_module_docstring_roster.py::test_should_flag_module_docstring_omitting_a_public_check` reports a named violation.
47
47
  - check_module_docstring_scope_omits_data_schema_constants: a module summary listing schema constants as behavior; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_module_docstring_data_schema_scope.py` reports a named violation.
48
48
  - check_imports_at_top: an ordinary import inside a function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_type_checking_scope.py::test_should_flag_runtime_import_inside_function_even_if_file_uses_type_checking` reports a named violation.
49
- - check_js_bare_flag_return_directive: a JavaScript return directive with an unexplained bare flag; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
50
- - check_js_resume_task_enumeration_coverage: a resume task branch missing an enumerated state; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
51
- - check_js_returns_object_schemaless_branch: sibling JavaScript return paths with an ad hoc object; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
52
- - check_js_sibling_return_object_key_drift: sibling return objects with different keys; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
53
- - check_library_print: a print call in library code; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
54
- - check_logging_adjacent_string_literals: adjacent string literals in a logger call; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
49
+ - check_js_bare_flag_return_directive: a JavaScript return directive with an unexplained bare flag; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_bare_flag_return_directive.py::test_flags_bare_down_directive_when_the_workflow_states_the_contract` reports a named violation.
50
+ - check_js_resume_task_enumeration_coverage: a resume task branch missing an enumerated state; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_resume_task_enumeration.py::should_flag_resume_branch_absent_from_spawn_enumeration` reports a named violation.
51
+ - check_js_returns_object_schemaless_branch: sibling JavaScript return paths with an ad hoc object; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_returns_object_schemaless.py::test_flags_schema_less_branch_under_returns_object_claim` reports a named violation.
52
+ - check_js_sibling_return_object_key_drift: sibling return objects with different keys; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_sibling_return_object_key_drift.py::test_flags_blocker_return_that_omits_one_documented_field` reports a named violation.
53
+ - check_library_print: a print call in library code; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_library_print.py::test_should_flag_print_call_in_library_module` reports a named violation.
54
+ - check_logging_adjacent_string_literals: adjacent string literals in a logger call; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_logging_adjacent_literals.py::test_should_flag_adjacent_literals_in_attribute_logger_call` reports a named violation.
55
55
  - check_logging_fstrings: an f-string passed to logger.info; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_logger_fstring.py::test_should_flag_logger_info_fstring` reports a named violation.
56
56
  - check_naive_datetime_construction: datetime.fromtimestamp without a timezone; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_naive_datetime.py::test_flags_fromtimestamp_without_timezone` reports a named violation.
57
- - check_windows_api_none: a Windows API call passed None for a required argument; `python -m pytest packages/claude-dev-env/hooks/blocking` reports a named violation.
57
+ - check_windows_api_none: a Windows API call passed None for a required argument; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_windows_api_none.py::test_should_flag_win32gui_call_passing_none` reports a named violation.
58
58
 
59
59
  ## Gotchas
60
60
 
@@ -0,0 +1,26 @@
1
+ """Tests for check_library_print."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from code_rules_enforcer import check_library_print
6
+
7
+ LIBRARY_FILE_PATH = "shared_utils/web_automation/sample.py"
8
+ CLI_FILE_PATH = "shared_utils/web_automation/sample_cli.py"
9
+ PRINTING_SOURCE = "def report_status(status_text: str) -> None:\n print(status_text)\n"
10
+
11
+
12
+ def test_should_flag_print_call_in_library_module() -> None:
13
+ issues = check_library_print(PRINTING_SOURCE, LIBRARY_FILE_PATH)
14
+ assert issues == [
15
+ "Line 2: Library print() - route through logger or accept an explicit stream parameter"
16
+ ]
17
+
18
+
19
+ def test_should_flag_sys_stderr_write_in_library_module() -> None:
20
+ writing_source = "import sys\n\nsys.stderr.write('done')\n"
21
+ issues = check_library_print(writing_source, LIBRARY_FILE_PATH)
22
+ assert issues == ["Line 3: sys.stderr.write - route through logger"]
23
+
24
+
25
+ def test_should_allow_print_call_in_cli_entry_point() -> None:
26
+ assert check_library_print(PRINTING_SOURCE, CLI_FILE_PATH) == []
@@ -0,0 +1,17 @@
1
+ """Tests for check_windows_api_none."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from code_rules_enforcer import check_windows_api_none
6
+
7
+
8
+ def test_should_flag_win32gui_call_passing_none() -> None:
9
+ source = "win32gui.SetWindowPos(window_handle, " + "None)\n"
10
+ assert check_windows_api_none(source) == [
11
+ "Line 1: win32gui call with None - use 0 for unused int params"
12
+ ]
13
+
14
+
15
+ def test_should_allow_win32gui_call_passing_zero() -> None:
16
+ source = "win32gui.SetWindowPos(window_handle, 0)\n"
17
+ assert check_windows_api_none(source) == []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.46.27",
3
+ "version": "8.46.29",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import importlib.util
5
+ import importlib.machinery
6
6
  import os
7
7
  import subprocess
8
+ import types
8
9
  from dataclasses import dataclass, field
9
10
  from datetime import datetime, timedelta, timezone
10
11
  from enum import Enum
@@ -63,11 +64,12 @@ def codex_usage_limit_signatures() -> tuple[str, ...]:
63
64
  ImportError: The marker module cannot be loaded.
64
65
  """
65
66
  constants_path = Path(__file__).resolve().parents[2] / "_shared" / "pr-loop" / "scripts" / "codex_review_scripts_constants" / "classifier_constants.py"
66
- specification = importlib.util.spec_from_file_location("account_broker_codex_classifier_constants", constants_path)
67
- if specification is None or specification.loader is None:
68
- raise ImportError(f"cannot load usage markers from {constants_path}")
69
- module = importlib.util.module_from_spec(specification)
70
- specification.loader.exec_module(module)
67
+ loader = importlib.machinery.SourceFileLoader("account_broker_codex_classifier_constants", str(constants_path))
68
+ module = types.ModuleType(loader.name)
69
+ try:
70
+ loader.exec_module(module)
71
+ except OSError as error:
72
+ raise ImportError(f"cannot load usage markers from {constants_path}") from error
71
73
  return module.ALL_USAGE_LIMIT_MARKERS
72
74
 
73
75
 
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import dataclasses
6
6
  from datetime import datetime, timedelta, timezone
7
+ from pathlib import Path
7
8
 
8
9
  import pytest
9
10
 
@@ -58,6 +59,18 @@ def test_codex_usage_limit_signatures_loads_classifier_markers() -> None:
58
59
  assert "http 429" in signatures
59
60
 
60
61
 
62
+ def test_codex_usage_limit_signatures_raises_import_error_when_markers_are_missing(
63
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path
64
+ ) -> None:
65
+ monkeypatch.setattr(broker_constants, "__file__", str(tmp_path / "scripts" / "constants" / "module.py"))
66
+
67
+ with pytest.raises(ImportError, match="cannot load usage markers from") as raised:
68
+ broker_constants.codex_usage_limit_signatures()
69
+
70
+ assert str(tmp_path) in str(raised.value)
71
+ assert isinstance(raised.value.__cause__, FileNotFoundError)
72
+
73
+
61
74
  def test_utc_time_text_converts_an_offset_timestamp() -> None:
62
75
  moment = datetime(2026, 10, 3, 7, 30, tzinfo=timezone(timedelta(hours=-4)))
63
76
 
@@ -103,6 +103,30 @@ def test_should_assign_each_enforcer_check_to_one_family() -> None:
103
103
  assert documented_checks == imported_checks
104
104
 
105
105
 
106
+ def _assert_proof_target_resolves(proof_label: str, proof_target: str) -> None:
107
+ module_text, _, test_name = proof_target.partition("::")
108
+ module_path = _REPOSITORY_ROOT / module_text
109
+ assert module_path.is_file(), proof_label
110
+ if test_name:
111
+ assert re.search(
112
+ rf"^def {re.escape(test_name)}\(",
113
+ module_path.read_text(encoding="utf-8"),
114
+ re.MULTILINE,
115
+ ), proof_label
116
+
117
+
118
+ def test_should_name_a_test_module_in_each_proof_command() -> None:
119
+ for each_family_path in _FAMILY_DIRECTORY.glob("*.md"):
120
+ family_text = each_family_path.read_text(encoding="utf-8")
121
+ all_proofs = re.findall(
122
+ r"^- (check_\w+):.*?`python -m pytest ([^`\s]+)", family_text, re.MULTILINE
123
+ )
124
+ for each_check, each_target in all_proofs:
125
+ _assert_proof_target_resolves(
126
+ f"{each_family_path.name}: {each_check} -> {each_target}", each_target
127
+ )
128
+
129
+
106
130
  def _collect_citation_texts() -> list[tuple[Path, str]]:
107
131
  all_citations: list[tuple[Path, str]] = []
108
132
  for each_root in _CITATION_ROOTS: