claude-dev-env 2.12.0 → 2.13.0
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/_shared/pr-loop/scripts/code_rules_gate.py +2 -3
- package/_shared/pr-loop/scripts/test_code_rules_gate.py +0 -26
- package/agents/CLAUDE.md +1 -2
- package/agents/pr-description-writer.md +11 -81
- package/bin/install.mjs +48 -9
- package/bin/install.prune.test.mjs +26 -0
- package/bin/install.settings-defaults.test.mjs +60 -33
- package/bin/install.test.mjs +2 -4
- package/commands/sr-loop.md +9 -5
- package/docs/CLAUDE.md +0 -1
- package/docs/references/CLAUDE.md +0 -1
- package/hooks/CLAUDE.md +1 -1
- package/hooks/blocking/CLAUDE.md +2 -27
- package/hooks/blocking/config/CLAUDE.md +1 -13
- package/hooks/blocking/conventional_pr_title_gate.py +1 -2
- package/hooks/blocking/send_user_file_open_locally_blocker.py +1 -1
- package/hooks/blocking/stop_dispatcher.py +4 -4
- package/hooks/blocking/test_bash_pre_tool_use_dispatcher.py +0 -3
- package/hooks/blocking/test_pre_tool_use_dispatcher.py +6 -7
- package/hooks/blocking/test_send_user_file_open_locally_blocker.py +4 -3
- package/hooks/blocking/test_shared_stdin_adoption.py +0 -2
- package/hooks/diagnostic/CLAUDE.md +3 -3
- package/hooks/diagnostic/hook_log_extractor.py +2 -36
- package/hooks/diagnostic/hook_log_stop_wrapper.py +6 -155
- package/hooks/diagnostic/test_hook_log_extractor.py +8 -21
- package/hooks/diagnostic/test_hook_log_stop_wrapper.py +3 -331
- package/hooks/git-hooks/git_hooks_constants/__init__.py +0 -6
- package/hooks/git-hooks/pre_push.py +3 -85
- package/hooks/git-hooks/test_pre_push.py +0 -130
- package/hooks/hooks.json +0 -35
- package/hooks/hooks_constants/CLAUDE.md +0 -9
- package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +0 -11
- package/hooks/hooks_constants/convergence_branch_constants.py +0 -1
- package/hooks/hooks_constants/fable_spawn_gate_constants.py +3 -4
- package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +0 -8
- package/hooks/hooks_constants/send_user_file_open_locally_blocker_constants.py +1 -6
- package/hooks/hooks_constants/stop_dispatcher_constants.py +0 -1
- package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +1 -26
- package/hooks/hooks_constants/test_pre_tool_use_dispatcher_constants.py +0 -5
- package/hooks/hooks_constants/test_stop_dispatcher_constants.py +0 -1
- package/hooks/lifecycle/CLAUDE.md +1 -3
- package/package.json +1 -1
- package/rules/CLAUDE.md +0 -2
- package/rules/gh-cli-conventions.md +0 -1
- package/rules/git-workflow.md +1 -3
- package/scripts/CLAUDE.md +0 -1
- package/scripts/_code_review_test_support.py +0 -95
- package/scripts/dev_env_scripts_constants/code_review_constants.py +9 -98
- package/scripts/dev_env_scripts_constants/test_code_review_constants.py +1 -44
- package/scripts/invoke_code_review.py +8 -451
- package/scripts/test_invoke_code_review.py +5 -61
- package/scripts/test_invoke_code_review_cli.py +1 -45
- package/scripts/test_invoke_code_review_contract.py +1 -118
- package/settings.json +1 -10
- package/skills/CLAUDE.md +8 -0
- package/skills/autoconverge/reference/CLAUDE.md +1 -1
- package/skills/autoconverge/reference/convergence.md +7 -7
- package/skills/autoconverge/reference/gotchas.md +3 -10
- package/skills/autoconverge/workflow/converge.contract.test.mjs +53 -1388
- package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +4 -3
- package/skills/autoconverge/workflow/converge.fix-recovery.test.mjs +33 -493
- package/skills/autoconverge/workflow/converge.merge-conflict.test.mjs +15 -97
- package/skills/autoconverge/workflow/converge.mjs +201 -238
- package/skills/autoconverge/workflow/converge.precatch.test.mjs +1 -1
- package/skills/bugteam/CONSTRAINTS.md +1 -1
- package/skills/bugteam/SKILL.md +9 -0
- package/skills/bugteam/reference/audit-and-teammates.md +10 -6
- package/skills/bugteam/test_skill_additions.py +9 -0
- package/skills/comments/SKILL.md +65 -0
- package/skills/descriptions/SKILL.md +51 -0
- package/skills/emergencies/SKILL.md +42 -0
- package/skills/imagegen/SKILL.md +21 -0
- package/skills/imagegen/scripts/config/__init__.py +1 -0
- package/skills/imagegen/scripts/config/constants.py +28 -0
- package/skills/imagegen/scripts/imagegen.py +45 -0
- package/skills/imagegen/scripts/imagegen_core.py +528 -0
- package/skills/imagegen/scripts/test_imagegen.py +204 -0
- package/skills/orchestrator/SKILL.md +2 -4
- package/skills/plan-to-pr/SKILL.md +6 -7
- package/skills/plan-to-pr/reference/final-validation-tasks.md +1 -1
- package/skills/plan-to-pr/reference/process-inventory.md +2 -2
- package/skills/plan-to-pr/reference/review-loop.md +2 -2
- package/skills/plan-to-pr/reference/run-record.schema.json +1 -1
- package/skills/plan-to-pr/reference/task-seeds.md +1 -1
- package/skills/plan-to-pr/reference/task-ticket.md +3 -4
- package/skills/plan-to-pr/scripts/config/constants.py +1 -2
- package/skills/plan-to-pr/scripts/test_validate_protocol.py +1 -1
- package/skills/plan-to-pr/test_skill_contract.py +2 -2
- package/skills/pr-converge/SKILL.md +13 -16
- package/skills/pr-converge/reference/progress-checklist.md +6 -5
- package/skills/pr-converge/reference/state-schema.md +1 -27
- package/skills/pr-loop-cloud-transport/SKILL.md +1 -1
- package/skills/pr-loop-cloud-transport/reference/identity-and-hooks.md +3 -3
- package/skills/pr-loop-lifecycle/SKILL.md +1 -1
- package/skills/pr-loop-lifecycle/reference/teardown-publish-permissions.md +1 -1
- package/skills/prototype/SKILL.md +4 -4
- package/skills/prototype/reference/honest-limitations.md +4 -4
- package/skills/prototype/reference/promotion-tasks.md +2 -2
- package/skills/prototype/workflows/promotion.md +4 -6
- package/skills/reviews/SKILL.md +85 -0
- package/skills/small-cl/SKILL.md +52 -0
- package/agents/code-verifier.md +0 -74
- package/docs/PR_DESCRIPTION_GUIDE.md +0 -157
- package/docs/references/code-review-enforcement.md +0 -132
- package/hooks/blocking/code_review_enforcement_config_bootstrap.py +0 -53
- package/hooks/blocking/code_review_gate_deny.py +0 -74
- package/hooks/blocking/code_review_pr_create_gate.py +0 -198
- package/hooks/blocking/code_review_push_gate.py +0 -145
- package/hooks/blocking/code_review_stamp_directory_write_blocker.py +0 -348
- package/hooks/blocking/code_review_stamp_store.py +0 -233
- package/hooks/blocking/code_review_stamp_write_blocker_parts/__init__.py +0 -7
- package/hooks/blocking/code_review_stamp_write_blocker_parts/conftest.py +0 -15
- package/hooks/blocking/code_review_stamp_write_blocker_parts/obfuscated_stamp_path_reference.py +0 -212
- package/hooks/blocking/code_review_stamp_write_blocker_parts/split_directory_change_into_stamp.py +0 -138
- package/hooks/blocking/code_review_stamp_write_blocker_parts/test_obfuscated_stamp_path_reference.py +0 -49
- package/hooks/blocking/code_review_stamp_write_blocker_parts/test_split_directory_change_into_stamp.py +0 -38
- package/hooks/blocking/code_verifier_spawn_preflight_gate.py +0 -483
- package/hooks/blocking/config/code_review_enforcement_constants.py +0 -143
- package/hooks/blocking/config/test_code_review_enforcement_constants.py +0 -166
- package/hooks/blocking/config/verified_commit_constants.py +0 -160
- package/hooks/blocking/config/verified_commit_context_constants.py +0 -21
- package/hooks/blocking/config/verified_commit_gate_output_constants.py +0 -14
- package/hooks/blocking/conftest.py +0 -123
- package/hooks/blocking/convergence_gate_blocker.py +0 -310
- package/hooks/blocking/pr_converge_bugteam_enforcer.py +0 -170
- package/hooks/blocking/pr_description_body_audit.py +0 -148
- package/hooks/blocking/pr_description_command_parser.py +0 -237
- package/hooks/blocking/pr_description_enforcer.py +0 -227
- package/hooks/blocking/pr_description_pr_number.py +0 -155
- package/hooks/blocking/pr_description_proof_of_work.py +0 -385
- package/hooks/blocking/pr_description_readability.py +0 -364
- package/hooks/blocking/reviewer_spawn_gate.py +0 -182
- package/hooks/blocking/test_code_review_enforcement_config_bootstrap.py +0 -62
- package/hooks/blocking/test_code_review_gate_deny.py +0 -54
- package/hooks/blocking/test_code_review_pr_create_gate.py +0 -199
- package/hooks/blocking/test_code_review_push_gate.py +0 -205
- package/hooks/blocking/test_code_review_stamp_directory_write_blocker.py +0 -199
- package/hooks/blocking/test_code_review_stamp_store.py +0 -205
- package/hooks/blocking/test_code_verifier_spawn_preflight_gate.py +0 -710
- package/hooks/blocking/test_code_verifier_tools_contract.py +0 -28
- package/hooks/blocking/test_convergence_gate_blocker.py +0 -428
- package/hooks/blocking/test_pr_converge_bugteam_enforcer.py +0 -311
- package/hooks/blocking/test_pr_converge_bugteam_enforcer_state_tolerance.py +0 -184
- package/hooks/blocking/test_pr_description_enforcer.py +0 -221
- package/hooks/blocking/test_pr_description_enforcer_body_audit.py +0 -247
- package/hooks/blocking/test_pr_description_enforcer_body_rules.py +0 -493
- package/hooks/blocking/test_pr_description_enforcer_command_parser.py +0 -366
- package/hooks/blocking/test_pr_description_enforcer_pr_number.py +0 -159
- package/hooks/blocking/test_pr_description_enforcer_proof_gate.py +0 -175
- package/hooks/blocking/test_pr_description_enforcer_readability.py +0 -443
- package/hooks/blocking/test_pr_description_proof_of_work.py +0 -313
- package/hooks/blocking/test_reviewer_spawn_gate.py +0 -230
- package/hooks/blocking/test_verdict_directory_write_blocker.py +0 -804
- package/hooks/blocking/test_verification_verdict_store.py +0 -974
- package/hooks/blocking/test_verified_commit_config_bootstrap.py +0 -67
- package/hooks/blocking/test_verified_commit_docs_delta.py +0 -176
- package/hooks/blocking/test_verified_commit_gate.py +0 -581
- package/hooks/blocking/test_verified_commit_gate_additional_context.py +0 -134
- package/hooks/blocking/test_verified_commit_message_accuracy_blocker.py +0 -131
- package/hooks/blocking/test_verifier_verdict_minter.py +0 -299
- package/hooks/blocking/tests/test_verified_commit_gate.py +0 -41
- package/hooks/blocking/verdict_directory_write_blocker.py +0 -687
- package/hooks/blocking/verification_verdict_store.py +0 -1039
- package/hooks/blocking/verified_commit_config_bootstrap.py +0 -63
- package/hooks/blocking/verified_commit_gate.py +0 -113
- package/hooks/blocking/verified_commit_gate_parts/CLAUDE.md +0 -28
- package/hooks/blocking/verified_commit_gate_parts/__init__.py +0 -1
- package/hooks/blocking/verified_commit_gate_parts/command_tokenization.py +0 -174
- package/hooks/blocking/verified_commit_gate_parts/deny_payload.py +0 -53
- package/hooks/blocking/verified_commit_gate_parts/deny_reason.py +0 -80
- package/hooks/blocking/verified_commit_gate_parts/directory_resolution.py +0 -170
- package/hooks/blocking/verified_commit_gate_parts/gated_invocations.py +0 -217
- package/hooks/blocking/verified_commit_gate_parts/tests/conftest.py +0 -10
- package/hooks/blocking/verified_commit_gate_parts/tests/test_command_tokenization.py +0 -94
- package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_payload.py +0 -17
- package/hooks/blocking/verified_commit_gate_parts/tests/test_deny_reason.py +0 -38
- package/hooks/blocking/verified_commit_gate_parts/tests/test_directory_resolution.py +0 -71
- package/hooks/blocking/verified_commit_gate_parts/tests/test_gated_invocations.py +0 -96
- package/hooks/blocking/verified_commit_message_accuracy_blocker.py +0 -167
- package/hooks/blocking/verifier_verdict_minter.py +0 -280
- package/hooks/hooks_constants/code_verifier_spawn_preflight_gate_constants.py +0 -64
- package/hooks/hooks_constants/convergence_gate_blocker_constants.py +0 -53
- package/hooks/hooks_constants/pr_converge_bugteam_enforcer_constants.py +0 -55
- package/hooks/hooks_constants/pr_converge_bugteam_enforcer_state.py +0 -67
- package/hooks/hooks_constants/pr_description_enforcer_constants.py +0 -167
- package/hooks/hooks_constants/pr_description_proof_of_work_constants.py +0 -107
- package/hooks/hooks_constants/reviewer_spawn_gate_constants.py +0 -41
- package/hooks/hooks_constants/test_pr_description_enforcer_constants.py +0 -292
- package/hooks/lifecycle/pr_converge_bugteam_skill_tracker.py +0 -198
- package/hooks/lifecycle/test_pr_converge_bugteam_skill_tracker.py +0 -283
- package/rules/proof-of-work-pr-comments.md +0 -22
- package/rules/verified-commit-gate-skip.md +0 -4
- package/scripts/Show-Asset.ps1 +0 -106
|
@@ -35,7 +35,6 @@ from dev_env_scripts_constants.code_review_constants import ( # noqa: E402
|
|
|
35
35
|
CLI_SESSION_MODEL_FLAG,
|
|
36
36
|
CODE_REVIEW_MODEL_ALIAS,
|
|
37
37
|
GIT_BINARY,
|
|
38
|
-
RECORD_STAMP_FLAG,
|
|
39
38
|
)
|
|
40
39
|
from dev_env_scripts_constants.grok_worker_constants import ( # noqa: E402
|
|
41
40
|
CLI_TIMEOUT_FLAG,
|
|
@@ -108,19 +107,6 @@ def write_dirty_tree(working_directory: Path) -> None:
|
|
|
108
107
|
dirty_file.write_text(DIRTY_FILE_CONTENTS, encoding="utf-8")
|
|
109
108
|
|
|
110
109
|
|
|
111
|
-
def run_record_stamp_cli(working_directory: Path, *, effort: str) -> int:
|
|
112
|
-
return invoker.main(
|
|
113
|
-
[
|
|
114
|
-
CWD_FLAG,
|
|
115
|
-
str(working_directory),
|
|
116
|
-
CLI_SESSION_MODEL_FLAG,
|
|
117
|
-
CODE_REVIEW_MODEL_ALIAS,
|
|
118
|
-
RECORD_STAMP_FLAG,
|
|
119
|
-
effort,
|
|
120
|
-
]
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
110
|
def claude_served(
|
|
125
111
|
*,
|
|
126
112
|
returncode: int = FIXTURE_CHAIN_RETURNCODE,
|
|
@@ -327,84 +313,3 @@ def install_seams(
|
|
|
327
313
|
EFFORT_LOW = "low"
|
|
328
314
|
REJECTED_ULTRA_EFFORT = "ultra"
|
|
329
315
|
SINGLE_PASS_CAP = 1
|
|
330
|
-
MISSING_STORE_FILE_NAME = "code_review_stamp_store_absent.py"
|
|
331
|
-
SURFACE_SOURCE = "def add(left: int, right: int) -> int:\n return left + right\n"
|
|
332
|
-
SURFACE_CHANGE_SOURCE = (
|
|
333
|
-
"def add(left: int, right: int) -> int:\n return left - right\n"
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
def _make_repo_with_change_surface(tmp_path: Path) -> Path:
|
|
338
|
-
origin_directory = tmp_path / "origin.git"
|
|
339
|
-
work_directory = tmp_path / "work"
|
|
340
|
-
_run_git(
|
|
341
|
-
"init",
|
|
342
|
-
"--bare",
|
|
343
|
-
"--initial-branch",
|
|
344
|
-
PINNED_INITIAL_BRANCH,
|
|
345
|
-
str(origin_directory),
|
|
346
|
-
)
|
|
347
|
-
_initialize_repository(work_directory)
|
|
348
|
-
(work_directory / "app.py").write_text(SURFACE_SOURCE, encoding="utf-8")
|
|
349
|
-
_run_git("add", "-A", working_directory=work_directory)
|
|
350
|
-
_run_git("commit", "-m", "base", working_directory=work_directory)
|
|
351
|
-
_run_git(
|
|
352
|
-
"remote",
|
|
353
|
-
"add",
|
|
354
|
-
"origin",
|
|
355
|
-
str(origin_directory),
|
|
356
|
-
working_directory=work_directory,
|
|
357
|
-
)
|
|
358
|
-
_run_git(
|
|
359
|
-
"push", "-u", "origin", PINNED_INITIAL_BRANCH, working_directory=work_directory
|
|
360
|
-
)
|
|
361
|
-
(work_directory / "app.py").write_text(SURFACE_CHANGE_SOURCE, encoding="utf-8")
|
|
362
|
-
return work_directory
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
def _isolate_home(monkeypatch: pytest.MonkeyPatch, fake_home: Path) -> None:
|
|
366
|
-
home_text = str(fake_home)
|
|
367
|
-
monkeypatch.setenv("HOME", home_text)
|
|
368
|
-
monkeypatch.setenv("USERPROFILE", home_text)
|
|
369
|
-
monkeypatch.delenv("HOMEDRIVE", raising=False)
|
|
370
|
-
monkeypatch.delenv("HOMEPATH", raising=False)
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
def prepared_surface_repo(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Path:
|
|
374
|
-
fake_home = tmp_path / "home"
|
|
375
|
-
fake_home.mkdir()
|
|
376
|
-
_isolate_home(monkeypatch, fake_home)
|
|
377
|
-
return _make_repo_with_change_surface(tmp_path)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
def _chain_clean_outcome() -> invoker.CodeReviewOutcome:
|
|
381
|
-
return invoker.CodeReviewOutcome(
|
|
382
|
-
mode=invoker.MODE_CHAIN,
|
|
383
|
-
served_command=FIXTURE_SERVED_COMMAND,
|
|
384
|
-
returncode=FIXTURE_CHAIN_RETURNCODE,
|
|
385
|
-
is_dirty_tree=True,
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
def stable_clean_review(**_review_keywords: object) -> invoker.CodeReviewOutcome:
|
|
390
|
-
return _chain_clean_outcome()
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
def surface_changing_review(
|
|
394
|
-
*, working_directory: Path, **_review_keywords: object
|
|
395
|
-
) -> invoker.CodeReviewOutcome:
|
|
396
|
-
write_dirty_tree(working_directory)
|
|
397
|
-
return _chain_clean_outcome()
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
class DriftingReview:
|
|
401
|
-
def __init__(self) -> None:
|
|
402
|
-
self.pass_count = 0
|
|
403
|
-
|
|
404
|
-
def __call__(
|
|
405
|
-
self, *, working_directory: Path, **_review_keywords: object
|
|
406
|
-
) -> invoker.CodeReviewOutcome:
|
|
407
|
-
self.pass_count += 1
|
|
408
|
-
drift_path = working_directory / f"fix_{self.pass_count}.txt"
|
|
409
|
-
drift_path.write_text(str(self.pass_count), encoding="utf-8")
|
|
410
|
-
return _chain_clean_outcome()
|
|
@@ -9,22 +9,14 @@
|
|
|
9
9
|
ok: ("blocker", "high", "medium", "low", "nit")
|
|
10
10
|
ALL_LOOP_TERMINALS
|
|
11
11
|
ok: ("clean", "nits_fixed", "advisor_blocked")
|
|
12
|
-
|
|
13
|
-
ok: "--record-stamp"
|
|
14
|
-
|
|
15
|
-
Effort tokens re-export the hooks enforcement constants (single source).
|
|
16
|
-
Scalar flags, JSON keys, mint-loop messages, finding severity vocabulary,
|
|
12
|
+
Effort tokens, scalar flags, JSON keys, finding severity vocabulary,
|
|
17
13
|
reviewed-head counting, and loop terminal resolution live here.
|
|
18
14
|
"""
|
|
19
15
|
|
|
20
16
|
from __future__ import annotations
|
|
21
17
|
|
|
22
|
-
import importlib.util
|
|
23
18
|
import os
|
|
24
|
-
import sys
|
|
25
19
|
from collections.abc import Mapping, Sequence
|
|
26
|
-
from pathlib import Path
|
|
27
|
-
from types import ModuleType
|
|
28
20
|
|
|
29
21
|
ROOT_EFFECTIVE_USER_ID: int = 0
|
|
30
22
|
"""Effective user id the review binary treats as root."""
|
|
@@ -51,47 +43,14 @@ IS_ROOT_CALLER: bool = _read_effective_user_id() == ROOT_EFFECTIVE_USER_ID
|
|
|
51
43
|
"""Whether this process runs as root, which limits the permission modes."""
|
|
52
44
|
|
|
53
45
|
|
|
54
|
-
def _load_enforcement_constants_module() -> ModuleType:
|
|
55
|
-
"""Load the hooks enforcement constants by explicit file path.
|
|
56
|
-
|
|
57
|
-
Binds a private module name so a foreign ``config`` package on
|
|
58
|
-
``sys.path`` cannot win the import and drift the effort token set.
|
|
59
|
-
"""
|
|
60
|
-
package_root_directory = Path(__file__).resolve().parent.parent.parent
|
|
61
|
-
constants_file_path = (
|
|
62
|
-
package_root_directory
|
|
63
|
-
/ "hooks"
|
|
64
|
-
/ "blocking"
|
|
65
|
-
/ "config"
|
|
66
|
-
/ "code_review_enforcement_constants.py"
|
|
67
|
-
)
|
|
68
|
-
module_name = "_code_review_enforcement_constants_for_scripts"
|
|
69
|
-
cached_module = sys.modules.get(module_name)
|
|
70
|
-
if cached_module is not None:
|
|
71
|
-
return cached_module
|
|
72
|
-
module_spec = importlib.util.spec_from_file_location(
|
|
73
|
-
module_name,
|
|
74
|
-
constants_file_path,
|
|
75
|
-
)
|
|
76
|
-
if module_spec is None or module_spec.loader is None:
|
|
77
|
-
raise ImportError(
|
|
78
|
-
f"could not load code-review enforcement constants from {constants_file_path}"
|
|
79
|
-
)
|
|
80
|
-
constants_module = importlib.util.module_from_spec(module_spec)
|
|
81
|
-
sys.modules[module_name] = constants_module
|
|
82
|
-
module_spec.loader.exec_module(constants_module)
|
|
83
|
-
return constants_module
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
_ENFORCEMENT_CONSTANTS = _load_enforcement_constants_module()
|
|
87
|
-
|
|
88
46
|
ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER: tuple[str, ...] = (
|
|
89
|
-
|
|
47
|
+
"low",
|
|
48
|
+
"medium",
|
|
49
|
+
"high",
|
|
50
|
+
"xhigh",
|
|
51
|
+
"max",
|
|
90
52
|
)
|
|
91
|
-
"""Effort tokens ordered
|
|
92
|
-
|
|
93
|
-
RECORD_STAMP_FLAG: str = _ENFORCEMENT_CONSTANTS.SANCTIONED_STAMP_MINTER_FLAG
|
|
94
|
-
"""CLI flag that forces chain mode and mints a clean stamp on a stable pass."""
|
|
53
|
+
"""Effort tokens ordered from the lowest supported effort to the highest."""
|
|
95
54
|
|
|
96
55
|
DEFAULT_CODE_REVIEW_EFFORT: str = "high"
|
|
97
56
|
"""Default effort when the caller omits the positional effort token."""
|
|
@@ -114,8 +73,7 @@ PERMISSION_MODE_BYPASS: str = "bypassPermissions"
|
|
|
114
73
|
PERMISSION_MODE_ACCEPT_EDITS: str = "acceptEdits"
|
|
115
74
|
"""Permission mode asked for when the caller is root.
|
|
116
75
|
|
|
117
|
-
The review binary refuses ``bypassPermissions`` outright for a root caller
|
|
118
|
-
so asking for it there means no review runs and no stamp is ever minted.
|
|
76
|
+
The review binary refuses ``bypassPermissions`` outright for a root caller.
|
|
119
77
|
"""
|
|
120
78
|
|
|
121
79
|
REVIEW_PERMISSION_MODE: str = (
|
|
@@ -160,16 +118,7 @@ HOST_PROFILE_ERROR_RETURNCODE: int = 1
|
|
|
160
118
|
"""Return code when host-profile detection raises ValueError at the CLI boundary."""
|
|
161
119
|
|
|
162
120
|
SUCCESSFUL_REVIEW_RETURNCODE: int = 0
|
|
163
|
-
"""Return code
|
|
164
|
-
|
|
165
|
-
RESULT_KEY_STAMP_MINTED: str = "stamp_minted"
|
|
166
|
-
"""JSON result key holding whether a clean stamp was written this run."""
|
|
167
|
-
|
|
168
|
-
RESULT_KEY_PASS_COUNT: str = "pass_count"
|
|
169
|
-
"""JSON result key holding how many review passes the mint loop ran."""
|
|
170
|
-
|
|
171
|
-
RESULT_KEY_BOUND_HASH: str = "bound_hash"
|
|
172
|
-
"""JSON result key holding the surface hash bound into a minted stamp, or null."""
|
|
121
|
+
"""Return code for a successful review invocation."""
|
|
173
122
|
|
|
174
123
|
CLI_EFFORT_METAVAR: str = "effort"
|
|
175
124
|
"""Argparse metavar for the positional effort token."""
|
|
@@ -180,21 +129,9 @@ CLI_EFFORT_HELP: str = (
|
|
|
180
129
|
)
|
|
181
130
|
"""Help text for the positional effort argument."""
|
|
182
131
|
|
|
183
|
-
CLI_RECORD_STAMP_HELP: str = (
|
|
184
|
-
"Force chain mode, loop a capped number of review passes, and mint a "
|
|
185
|
-
"clean stamp only when a pass exits 0 with a stable surface hash."
|
|
186
|
-
)
|
|
187
|
-
"""Help text for the --record-stamp flag."""
|
|
188
|
-
|
|
189
132
|
INVALID_EFFORT_RETURNCODE: int = 2
|
|
190
133
|
"""Return code when the caller passes an unknown or unsupported effort token."""
|
|
191
134
|
|
|
192
|
-
STAMP_DID_NOT_CONVERGE_RETURNCODE: int = 1
|
|
193
|
-
"""Return code when the mint loop hits its pass cap without a stable clean pass."""
|
|
194
|
-
|
|
195
|
-
MAXIMUM_STAMP_MINT_PASSES: int = 3
|
|
196
|
-
"""Cap on review passes under --record-stamp before the invoker gives up."""
|
|
197
|
-
|
|
198
135
|
EFFORT_TOKEN_LIST_SEPARATOR: str = ", "
|
|
199
136
|
"""Separator used when listing allowed effort tokens in error messages."""
|
|
200
137
|
|
|
@@ -204,32 +141,6 @@ INVALID_EFFORT_MESSAGE: str = (
|
|
|
204
141
|
)
|
|
205
142
|
"""Stderr template when the caller supplies an unknown or ultra effort token."""
|
|
206
143
|
|
|
207
|
-
STAMP_DID_NOT_CONVERGE_MESSAGE: str = (
|
|
208
|
-
"code-review stamp minting did not converge after {pass_count} passes "
|
|
209
|
-
"(surface kept changing or review return codes stayed non-zero); no stamp written"
|
|
210
|
-
)
|
|
211
|
-
"""Stderr template when the mint loop hits the pass cap without minting."""
|
|
212
|
-
|
|
213
|
-
STAMP_STORE_IMPORT_FAILURE_MESSAGE: str = (
|
|
214
|
-
"code-review stamp store could not be imported for --record-stamp: {error}"
|
|
215
|
-
)
|
|
216
|
-
"""Stderr template when --record-stamp cannot load the stamp store module."""
|
|
217
|
-
|
|
218
|
-
STAMP_STORE_MODULE_FILE_NAME: str = "code_review_stamp_store.py"
|
|
219
|
-
"""File name of the stamp store module under hooks/blocking."""
|
|
220
|
-
|
|
221
|
-
STAMP_STORE_MODULE_NAME: str = "code_review_stamp_store"
|
|
222
|
-
"""Import name of the stamp store module."""
|
|
223
|
-
|
|
224
|
-
STAMP_STORE_LIVE_SURFACE_HASH_NAME: str = "live_surface_hash"
|
|
225
|
-
"""Attribute name of the live surface-hash helper on the stamp store module."""
|
|
226
|
-
|
|
227
|
-
STAMP_STORE_RECORD_CLEAN_STAMP_NAME: str = "record_clean_stamp"
|
|
228
|
-
"""Attribute name of the stamp-mint helper on the stamp store module."""
|
|
229
|
-
|
|
230
|
-
STAMP_STORE_RESOLVE_REPO_ROOT_NAME: str = "resolve_repo_root"
|
|
231
|
-
"""Attribute name of the repo-root resolver on the stamp store module."""
|
|
232
|
-
|
|
233
144
|
SEVERITY_BLOCKER: str = "blocker"
|
|
234
145
|
"""Finding severity for a release-blocking defect."""
|
|
235
146
|
|
|
@@ -1,52 +1,9 @@
|
|
|
1
|
-
"""Behavioral tests for the host-aware code-review invoker constants module.
|
|
2
|
-
|
|
3
|
-
These assert the single-source wiring: the effort tokens and the record-stamp
|
|
4
|
-
flag the invoker exposes are the exact values the hooks enforcement module
|
|
5
|
-
holds, so a threshold change in one place cannot drift the other.
|
|
6
|
-
"""
|
|
1
|
+
"""Behavioral tests for the host-aware code-review invoker constants module."""
|
|
7
2
|
|
|
8
3
|
from __future__ import annotations
|
|
9
4
|
|
|
10
|
-
import importlib.util
|
|
11
|
-
from pathlib import Path
|
|
12
|
-
from types import ModuleType
|
|
13
|
-
|
|
14
5
|
from dev_env_scripts_constants import code_review_constants as review_constants
|
|
15
6
|
|
|
16
|
-
_PACKAGE_ROOT = Path(__file__).resolve().parent.parent.parent
|
|
17
|
-
_ENFORCEMENT_CONSTANTS_PATH = (
|
|
18
|
-
_PACKAGE_ROOT
|
|
19
|
-
/ "hooks"
|
|
20
|
-
/ "blocking"
|
|
21
|
-
/ "config"
|
|
22
|
-
/ "code_review_enforcement_constants.py"
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _load_enforcement_module() -> ModuleType:
|
|
27
|
-
module_spec = importlib.util.spec_from_file_location(
|
|
28
|
-
"code_review_enforcement_constants_under_test", _ENFORCEMENT_CONSTANTS_PATH
|
|
29
|
-
)
|
|
30
|
-
assert module_spec is not None
|
|
31
|
-
assert module_spec.loader is not None
|
|
32
|
-
enforcement_module = importlib.util.module_from_spec(module_spec)
|
|
33
|
-
module_spec.loader.exec_module(enforcement_module)
|
|
34
|
-
return enforcement_module
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def test_effort_tokens_reexport_the_enforcement_source() -> None:
|
|
38
|
-
enforcement_module = _load_enforcement_module()
|
|
39
|
-
assert review_constants.ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER == getattr(
|
|
40
|
-
enforcement_module, "ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER"
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def test_record_stamp_flag_matches_sanctioned_minter_flag() -> None:
|
|
45
|
-
enforcement_module = _load_enforcement_module()
|
|
46
|
-
assert review_constants.RECORD_STAMP_FLAG == getattr(
|
|
47
|
-
enforcement_module, "SANCTIONED_STAMP_MINTER_FLAG"
|
|
48
|
-
)
|
|
49
|
-
|
|
50
7
|
|
|
51
8
|
def test_default_effort_is_a_known_token() -> None:
|
|
52
9
|
assert (
|