claude-dev-env 8.46.29 → 8.46.31
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.
- package/docs/code-rules/core-principles-and-config.md +1 -1
- package/docs/code-rules/design-and-structure.md +1 -1
- package/docs/code-rules/enforcement-surfaces.md +1 -1
- package/docs/code-rules/lint-enforced-rules.md +2 -2
- package/docs/code-rules/naming-and-types.md +5 -5
- package/docs/code-rules/tdd-and-proof.md +4 -4
- package/hooks/blocking/test_code_rules_enforcer_e2e_test_naming.py +24 -0
- package/package.json +1 -1
- package/scripts/dev_env_scripts_constants/account_broker_constants.py +7 -1
- package/scripts/dev_env_scripts_constants/shared_tree_constants.py +6 -0
- package/scripts/dev_env_scripts_constants/test_account_broker_constants.py +78 -0
- package/scripts/tests/test_code_rules_index.py +7 -7
|
@@ -42,7 +42,7 @@ Run the named pytest node or command with the described input. A breach produces
|
|
|
42
42
|
- check_inline_tuple_string_magic: an inline tuple of two snake-case labels; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_inline_tuple_string_magic.py::test_should_flag_inline_snake_case_tuple_pair_inside_function` reports a named violation.
|
|
43
43
|
- check_join_separator_string_magic: a literal delimiter passed to join in a function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_join_separator_magic.py::test_should_flag_literal_delimiter_join_separator_in_function_body` reports a named violation.
|
|
44
44
|
- check_string_literal_magic: an environment-variable name literal in a function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_string_magic.py::test_should_flag_env_var_name_string_in_function_body` reports a named violation.
|
|
45
|
-
- check_whitespace_indentation_magic: a
|
|
45
|
+
- check_whitespace_indentation_magic: a twelve-space indentation literal returned from a function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_whitespace_indentation_magic.py::test_flags_twelve_space_indent_constant` reports a line-numbered violation.
|
|
46
46
|
|
|
47
47
|
## Gotchas
|
|
48
48
|
|
|
@@ -26,7 +26,7 @@ A member loop catches a declared ItemBlocked type inside the loop, records the m
|
|
|
26
26
|
|
|
27
27
|
Run the named pytest node or command with the described input. A breach produces a rule finding; advisory checks write to stderr.
|
|
28
28
|
|
|
29
|
-
- check_function_length: a function
|
|
29
|
+
- check_function_length: a function at the blocking length threshold; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_function_length.py::test_should_block_at_sixty_lines` reports a blocking violation naming the function.
|
|
30
30
|
- check_blast_radius_declared: a raise inside a loop body with no declared handler; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_blast_radius.py::test_should_report_a_loop_raise_with_pending_blast_radius_declaration` reports an advisory. A RunFatal raise or an ItemBlocked raise inside a loop passes.
|
|
31
31
|
- check_duplicate_function_body_across_files: one function body copied into a sibling module; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_duplicate_body.py::test_should_flag_function_copied_from_sibling` reports a named violation.
|
|
32
32
|
- check_unused_optional_parameters: an optional parameter with one fixed value at every call site; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_split_optional_params.py::test_should_flag_optional_param_never_varied_in_file` reports a named violation.
|
|
@@ -20,7 +20,7 @@ Lint reports patterns; prompt context carries judgment about SRP, right-sized de
|
|
|
20
20
|
|
|
21
21
|
Run the named pytest node or command with the described input. A breach produces a rule finding; advisory checks write to stderr.
|
|
22
22
|
|
|
23
|
-
- check_unanchored_command_dispatch: a command regex that matches a verb inside another command; `python -m pytest packages/claude-dev-env/hooks/blocking/
|
|
23
|
+
- check_unanchored_command_dispatch: a command regex that matches a verb inside another command; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_command_dispatch.py::test_flags_unanchored_multi_word_command_pattern` reports a named violation.
|
|
24
24
|
- check_same_file_inline_duplicate_body: a helper body copied inline into a caller; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_same_file_inline_duplicate.py::test_should_flag_helper_whose_body_is_inlined_in_another_function` reports a named violation.
|
|
25
25
|
- check_zero_payload_function_alias: a pass-through alias forwarding the same arguments; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_zero_payload_alias.py::test_should_flag_pass_through_alias_forwarding_same_parameters` reports a named violation.
|
|
26
26
|
|
|
@@ -38,13 +38,13 @@ Run the named pytest node or command with the described input. A breach produces
|
|
|
38
38
|
|
|
39
39
|
- check_class_docstring_names_public_methods: a class summary omitting its public methods; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_class_docstring_methods.py::test_should_flag_single_line_docstring_omitting_two_public_methods` reports a named violation.
|
|
40
40
|
- check_docstring_args_match_signature: an Args entry absent from the signature; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_args_signature.py::test_should_flag_documented_arg_not_in_signature` reports a named violation.
|
|
41
|
-
- check_docstring_documents_unreferenced_parameter: a documented parameter unused in the body; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_unreferenced_param.py` reports a named violation.
|
|
41
|
+
- check_docstring_documents_unreferenced_parameter: a documented parameter unused in the body; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_unreferenced_param.py::test_should_flag_documented_parameter_never_referenced` reports a named violation.
|
|
42
42
|
- check_docstring_format: a public function with parameters and no Args section; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_format.py::test_should_flag_public_function_with_params_missing_args_section` reports a named violation.
|
|
43
43
|
- check_docstring_names_undefined_constant: a docstring naming an undefined constant; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_undefined_constant.py::test_flags_docstring_naming_constant_the_module_never_defines` reports a named violation.
|
|
44
44
|
- check_docstring_prose_wall_without_illustration: a prose-wall docstring with no example; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_prose_wall_illustration.py::test_should_flag_prose_wall_with_no_illustration` reports a named violation.
|
|
45
45
|
- check_docstring_runon_sentence: a long run-on docstring sentence; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_docstring_runon_sentence.py::test_should_flag_run_lifecycle_module_docstring_wall` reports a named violation.
|
|
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
|
-
- 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.
|
|
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::test_flags_user_facing_summary_over_data_schema_constants` 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
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
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.
|
|
@@ -39,13 +39,13 @@ Run the named pytest node or command with the described input. A breach produces
|
|
|
39
39
|
- check_parameter_annotations: a public parameter without an annotation; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_annotations.py::test_should_flag_parameter_without_annotation` reports a named violation.
|
|
40
40
|
- check_return_annotations: a function without a return annotation; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_annotations.py::test_should_flag_function_without_return_annotation` reports a named violation.
|
|
41
41
|
- check_unused_known_pytest_fixture_parameters: a test declaring tmp_path and never reading it; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_annotations.py::test_should_flag_unused_known_fixture_parameter_in_test_file` reports a named violation.
|
|
42
|
-
- check_banned_identifiers: a
|
|
43
|
-
- check_banned_noun_word_boundary: a public function
|
|
42
|
+
- check_banned_identifiers: a local binding named result; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_banned_identifier.py::test_should_flag_result_assignment` reports a named violation.
|
|
43
|
+
- check_banned_noun_word_boundary: a public function name holding a banned noun; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_banned_noun_word.py::test_should_flag_function_definition_with_data_word_in_name` reports a named violation.
|
|
44
44
|
- check_banned_prefixes: a function named handle_event; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py::test_should_flag_handle_prefixed_function` reports a named violation.
|
|
45
45
|
- check_boolean_naming: a boolean assignment named enabled; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_naming_pattern.py::test_should_flag_boolean_assignment_without_is_prefix` reports a named violation.
|
|
46
|
-
- check_js_banned_identifiers: a JavaScript declaration named
|
|
47
|
-
- check_js_boolean_naming: a boolean JavaScript declaration named
|
|
48
|
-
- check_collection_prefix: a
|
|
46
|
+
- check_js_banned_identifiers: a JavaScript declaration named data; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_conventions.py::test_flags_banned_identifier_declaration` reports a named violation.
|
|
47
|
+
- check_js_boolean_naming: a boolean JavaScript declaration named hardeningPrOpened; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_js_conventions.py::test_flags_unprefixed_boolean_let_declaration` reports a named violation.
|
|
48
|
+
- check_collection_prefix: a set parameter named numbers; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_collection_prefix.py::test_should_flag_bare_set_parameter_without_all_prefix` reports a named violation.
|
|
49
49
|
- check_loop_variable_naming: a loop variable named user; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_split_naming.py::test_check_loop_variable_naming_flags_missing_each_prefix` reports a named violation.
|
|
50
50
|
- check_polarity_name_contradiction: an is_allowed binding assigned from is_forbidden; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_polarity_name_contradiction.py::test_should_flag_allowed_target_assigned_from_forbidden_callee` reports a named violation.
|
|
51
51
|
- check_referenced_underscore_loop_variable: a loop variable named _user that its body reads; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_referenced_underscore_loop.py::test_should_flag_referenced_underscore_loop_variable_in_conftest` reports a named violation.
|
|
@@ -29,7 +29,7 @@ The TDD loop is the default for bug fixes and new behavior. A prototype may prec
|
|
|
29
29
|
|
|
30
30
|
Run the named pytest node or command with the described input. A breach produces a rule finding; advisory checks write to stderr.
|
|
31
31
|
|
|
32
|
-
- check_e2e_test_naming:
|
|
32
|
+
- check_e2e_test_naming: a spec test name containing online; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_e2e_test_naming.py::test_should_flag_online_word_in_spec_test_name` reports a line-numbered violation.
|
|
33
33
|
- check_public_function_missing_paired_test: a new public function absent from its established suite; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_paired_test.py::test_flags_public_function_absent_from_established_suite` reports a named violation.
|
|
34
34
|
- check_test_file_omits_module_public_function: an established test module omitting a public function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_paired_test.py::test_flags_module_public_function_when_test_suite_omits_it` reports a named violation.
|
|
35
35
|
- check_constant_equality_tests: a test asserting a constant equals its literal; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_constant_equality.py::test_should_flag_test_asserting_constant_equals_literal` reports a named violation.
|
|
@@ -38,9 +38,9 @@ Run the named pytest node or command with the described input. A breach produces
|
|
|
38
38
|
- check_skip_decorators_in_tests: a skipped pytest test function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_skip_decorators.py::test_should_flag_pytest_mark_skip_on_test_function` reports a named violation.
|
|
39
39
|
- check_stale_test_name_target: a test name still naming a removed function; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_stale_test_name.py::test_flags_renamed_away_target_in_test_name` reports a named violation.
|
|
40
40
|
- check_vacuous_cleanup_assertion_tests: a cleanup test with no created temporary file; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_vacuous_cleanup_assertion.py::test_should_flag_glob_emptiness_cleanup_test_without_temp_creation` reports a named violation.
|
|
41
|
-
- check_tests_use_isolated_filesystem_paths: a test writing to a shared user-home path; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_tests_isolate_home_temp.py` reports a named violation.
|
|
42
|
-
- check_dead_test_module_constant: an unused private constant in a test module; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_test_layout.py` reports a named violation.
|
|
43
|
-
- check_unused_test_helper_parameter: a test helper parameter its body never reads; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_test_layout.py` reports a named violation.
|
|
41
|
+
- check_tests_use_isolated_filesystem_paths: a test writing to a shared user-home path; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_tests_isolate_home_temp.py::test_should_flag_path_home_in_test_without_fixture` reports a named violation.
|
|
42
|
+
- check_dead_test_module_constant: an unused private constant in a test module; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_test_layout.py::test_should_flag_dead_private_constant_in_test_file` reports a named violation.
|
|
43
|
+
- check_unused_test_helper_parameter: a test helper parameter its body never reads; `python -m pytest packages/claude-dev-env/hooks/blocking/test_code_rules_enforcer_test_layout.py::test_should_flag_unused_private_helper_parameter` reports a named violation.
|
|
44
44
|
|
|
45
45
|
## Gotchas
|
|
46
46
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Tests for check_e2e_test_naming."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from code_rules_enforcer import check_e2e_test_naming
|
|
6
|
+
|
|
7
|
+
SPEC_FILE_PATH = "tests/e2e/checkout.spec.ts"
|
|
8
|
+
COMPONENT_TEST_FILE_PATH = "src/checkout.test.ts"
|
|
9
|
+
ONLINE_TEST_SOURCE = "test('submits the order when online', async () => {});\n"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_should_flag_online_word_in_spec_test_name() -> None:
|
|
13
|
+
assert check_e2e_test_naming(ONLINE_TEST_SOURCE, SPEC_FILE_PATH) == [
|
|
14
|
+
"Line 1: Test name contains online/offline - file scope defines this"
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_should_allow_spec_test_name_without_network_state() -> None:
|
|
19
|
+
source = "test('submits the order', async () => {});\n"
|
|
20
|
+
assert check_e2e_test_naming(source, SPEC_FILE_PATH) == []
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_should_skip_file_that_is_not_a_spec() -> None:
|
|
24
|
+
assert check_e2e_test_naming(ONLINE_TEST_SOURCE, COMPONENT_TEST_FILE_PATH) == []
|
package/package.json
CHANGED
|
@@ -29,6 +29,12 @@ from dev_env_scripts_constants.codex_account_constants import (
|
|
|
29
29
|
TIER_LUNA,
|
|
30
30
|
TIER_NORMAL,
|
|
31
31
|
)
|
|
32
|
+
from dev_env_scripts_constants.shared_tree_constants import (
|
|
33
|
+
CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH,
|
|
34
|
+
CONSTANTS_PACKAGE_ANCHOR_DEPTH,
|
|
35
|
+
PR_LOOP_DIRECTORY_NAME,
|
|
36
|
+
)
|
|
37
|
+
from shared_tree_paths import resolve_shared_scripts_directory
|
|
32
38
|
|
|
33
39
|
ALL_CLAUDE_FLOORS = {
|
|
34
40
|
"main_weekly_used_ceiling": MAIN_WEEKLY_USED_CEILING_PERCENT,
|
|
@@ -63,7 +69,7 @@ def codex_usage_limit_signatures() -> tuple[str, ...]:
|
|
|
63
69
|
Raises:
|
|
64
70
|
ImportError: The marker module cannot be loaded.
|
|
65
71
|
"""
|
|
66
|
-
constants_path =
|
|
72
|
+
constants_path = resolve_shared_scripts_directory(__file__, os.environ, PR_LOOP_DIRECTORY_NAME, CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH, CONSTANTS_PACKAGE_ANCHOR_DEPTH) / CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH
|
|
67
73
|
loader = importlib.machinery.SourceFileLoader("account_broker_codex_classifier_constants", str(constants_path))
|
|
68
74
|
module = types.ModuleType(loader.name)
|
|
69
75
|
try:
|
|
@@ -14,6 +14,12 @@ PROCESS_TREE_KILL_MODULE_FILENAME: str = "process_tree_kill.py"
|
|
|
14
14
|
|
|
15
15
|
ADVISOR_DIRECTORY_NAME: str = "advisor"
|
|
16
16
|
|
|
17
|
+
PR_LOOP_DIRECTORY_NAME: str = "pr-loop"
|
|
18
|
+
|
|
19
|
+
CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH: str = "codex_review_scripts_constants/classifier_constants.py"
|
|
20
|
+
|
|
21
|
+
CONSTANTS_PACKAGE_ANCHOR_DEPTH: int = 2
|
|
22
|
+
|
|
17
23
|
TIER_MODEL_IDS_MODULE_FILENAME: str = "tier_model_ids.py"
|
|
18
24
|
|
|
19
25
|
AGENTS_DIRECTORY_SUFFIX: str = ".agents"
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
|
+
import importlib
|
|
7
|
+
import importlib.util
|
|
8
|
+
import os
|
|
9
|
+
import shutil
|
|
10
|
+
import sys
|
|
11
|
+
import types
|
|
6
12
|
from datetime import datetime, timedelta, timezone
|
|
7
13
|
from pathlib import Path
|
|
8
14
|
|
|
@@ -27,6 +33,8 @@ from dev_env_scripts_constants.codex_account_constants import (
|
|
|
27
33
|
NORMAL_TIER_MINIMUM_PERCENT_LEFT,
|
|
28
34
|
)
|
|
29
35
|
|
|
36
|
+
TEMP_TREE_MARKER = "marker-only-in-the-temp-install-tree"
|
|
37
|
+
|
|
30
38
|
|
|
31
39
|
def test_should_keep_claude_floors_tied_to_the_account_ceilings() -> None:
|
|
32
40
|
assert ALL_CLAUDE_FLOORS == {
|
|
@@ -88,3 +96,73 @@ def test_parse_utc_time_converts_an_offset_timestamp() -> None:
|
|
|
88
96
|
|
|
89
97
|
assert parsed is not None
|
|
90
98
|
assert parsed.isoformat() == "2026-10-03T11:30:00+00:00"
|
|
99
|
+
|
|
100
|
+
def _create_directory_link(*, from_link: Path, to_target: Path) -> None:
|
|
101
|
+
if sys.platform.startswith("win32"):
|
|
102
|
+
importlib.import_module("_winapi").CreateJunction(
|
|
103
|
+
str(to_target), str(from_link)
|
|
104
|
+
)
|
|
105
|
+
return
|
|
106
|
+
os.symlink(to_target, from_link, target_is_directory=True)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _build_install_layout(home: Path) -> tuple[Path, Path]:
|
|
110
|
+
agents_constants_directory = (
|
|
111
|
+
home / ".agents" / "scripts" / "dev_env_scripts_constants"
|
|
112
|
+
)
|
|
113
|
+
agents_constants_directory.mkdir(parents=True)
|
|
114
|
+
shutil.copy(
|
|
115
|
+
Path(broker_constants.__file__),
|
|
116
|
+
agents_constants_directory / "account_broker_constants.py",
|
|
117
|
+
)
|
|
118
|
+
classifier_directory = (
|
|
119
|
+
home
|
|
120
|
+
/ ".claude"
|
|
121
|
+
/ "_shared"
|
|
122
|
+
/ "pr-loop"
|
|
123
|
+
/ "scripts"
|
|
124
|
+
/ "codex_review_scripts_constants"
|
|
125
|
+
)
|
|
126
|
+
classifier_directory.mkdir(parents=True)
|
|
127
|
+
(classifier_directory / "classifier_constants.py").write_text(
|
|
128
|
+
f"ALL_USAGE_LIMIT_MARKERS = ({TEMP_TREE_MARKER!r},)\n", encoding="utf-8"
|
|
129
|
+
)
|
|
130
|
+
_create_directory_link(
|
|
131
|
+
from_link=home / ".claude" / "scripts", to_target=home / ".agents" / "scripts"
|
|
132
|
+
)
|
|
133
|
+
linked_module = (
|
|
134
|
+
home
|
|
135
|
+
/ ".claude"
|
|
136
|
+
/ "scripts"
|
|
137
|
+
/ "dev_env_scripts_constants"
|
|
138
|
+
/ "account_broker_constants.py"
|
|
139
|
+
)
|
|
140
|
+
agents_module = agents_constants_directory / "account_broker_constants.py"
|
|
141
|
+
return linked_module, agents_module
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _load_module_from(
|
|
145
|
+
module_file: Path, module_name: str, monkeypatch: pytest.MonkeyPatch
|
|
146
|
+
) -> types.ModuleType:
|
|
147
|
+
specification = importlib.util.spec_from_file_location(module_name, module_file)
|
|
148
|
+
assert specification is not None and specification.loader is not None
|
|
149
|
+
module = importlib.util.module_from_spec(specification)
|
|
150
|
+
monkeypatch.setitem(sys.modules, module_name, module)
|
|
151
|
+
specification.loader.exec_module(module)
|
|
152
|
+
return module
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@pytest.mark.parametrize("entry_point", ("through_scripts_link", "through_agents_path"))
|
|
156
|
+
def test_codex_usage_limit_signatures_finds_shared_tree_beside_the_scripts_link(
|
|
157
|
+
entry_point: str, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
158
|
+
) -> None:
|
|
159
|
+
monkeypatch.delenv("CLAUDE_CONFIG_DIR", raising=False)
|
|
160
|
+
linked_module, agents_module = _build_install_layout(tmp_path / "home")
|
|
161
|
+
module_file = (
|
|
162
|
+
linked_module if entry_point == "through_scripts_link" else agents_module
|
|
163
|
+
)
|
|
164
|
+
installed_constants = _load_module_from(
|
|
165
|
+
module_file, f"installed_account_broker_constants_{entry_point}", monkeypatch
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
assert installed_constants.codex_usage_limit_signatures() == (TEMP_TREE_MARKER,)
|
|
@@ -107,15 +107,15 @@ def _assert_proof_target_resolves(proof_label: str, proof_target: str) -> None:
|
|
|
107
107
|
module_text, _, test_name = proof_target.partition("::")
|
|
108
108
|
module_path = _REPOSITORY_ROOT / module_text
|
|
109
109
|
assert module_path.is_file(), proof_label
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
assert test_name, proof_label
|
|
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
116
|
|
|
117
117
|
|
|
118
|
-
def
|
|
118
|
+
def test_should_name_a_pytest_node_in_each_proof_command() -> None:
|
|
119
119
|
for each_family_path in _FAMILY_DIRECTORY.glob("*.md"):
|
|
120
120
|
family_text = each_family_path.read_text(encoding="utf-8")
|
|
121
121
|
all_proofs = re.findall(
|