Coverage for src/domain/validation/__init__.py: 100%

1"""Validation package for mala post-commit validation.

2

3 This package provides validation runners for clean-room validation

4 in temporary git worktrees:

5

6- SpecValidationRunner: Modern API using ValidationSpec + ValidationContext (RECOMMENDED)

7

8 For new code, use SpecValidationRunner with ValidationSpec and injected dependencies:

9

10 from src.domain.validation import SpecValidationRunner, build_validation_spec

11

12 runner = SpecValidationRunner(

13 repo_path,

14 env_config=env_config,

15 command_runner=command_runner,

16 lock_manager=lock_manager,

17 )

18 spec = build_validation_spec(repo_path, scope=ValidationScope.PER_ISSUE, ...)

19 result = await runner.run_spec(spec, context)

20"""

21

22 from .coverage import (

23 CoverageResult,

24 CoverageStatus,

25 check_coverage_threshold,

26 parse_and_check_coverage,

27 parse_coverage_xml,

28)

29 from .e2e import (

30 E2EConfig as E2ERunnerConfig,

31 E2EPrereqResult,

32 E2EResult,

33 E2ERunner,

34 E2EStatus,

35 check_e2e_prereqs,

36)

37 from .helpers import (

38 annotate_issue,

39 decode_timeout_output,

40 format_step_output,

41 get_ready_issue_id,

42 init_fixture_repo,

43 tail,

44 write_fixture_repo,

45)

46 from .result import ValidationResult, ValidationStepResult

47 from .runner import (

48 SpecValidationRunner,

49)

50 from .spec import (

51 CommandKind,

52 CoverageConfig,

53 E2EConfig,

54 IssueResolution,

55 ResolutionOutcome,

56 ValidationArtifacts,

57 ValidationCommand,

58 ValidationContext,

59 ValidationScope,

60 ValidationSpec,

61 build_validation_spec,

62 classify_change,

63)

64 from .validation_gating import (

65 get_config_files_changed,

66 get_matching_code_files,

67 get_setup_files_changed,

68 should_invalidate_lint_cache,

69 should_invalidate_setup_cache,

70 should_trigger_validation,

71)

72 from .worktree import (

73 WorktreeConfig,

74 WorktreeContext,

75 WorktreeResult,

76 WorktreeState,

77 cleanup_stale_worktrees,

78 create_worktree,

79 remove_worktree,

80)

81

82 __all__ = [

83 # Spec types

84 "CommandKind",

85 "CoverageConfig",

86 # Coverage

87 "CoverageResult",

88 "CoverageStatus",

89 # E2E

90 "E2EConfig",

91 "E2EPrereqResult",

92 "E2EResult",

93 "E2ERunner",

94 "E2ERunnerConfig",

95 "E2EStatus",

96 "IssueResolution",

97 "ResolutionOutcome",

98 # Runners

99 "SpecValidationRunner",

100 "ValidationArtifacts",

101 "ValidationCommand",

102 "ValidationContext",

103 # Result types

104 "ValidationResult",

105 "ValidationScope",

106 "ValidationSpec",

107 "ValidationStepResult",

108 # Worktree

109 "WorktreeConfig",

110 "WorktreeContext",

111 "WorktreeResult",

112 "WorktreeState",

113 # Helpers (public)

114 "annotate_issue",

115 "build_validation_spec",

116 "check_coverage_threshold",

117 "check_e2e_prereqs",

118 "classify_change",

119 "cleanup_stale_worktrees",

120 "create_worktree",

121 "decode_timeout_output",

122 "format_step_output",

123 # Validation gating

124 "get_config_files_changed",

125 "get_matching_code_files",

126 "get_ready_issue_id",

127 "get_setup_files_changed",

128 "init_fixture_repo",

129 "parse_and_check_coverage",

130 "parse_coverage_xml",

131 "remove_worktree",

132 "should_invalidate_lint_cache",

133 "should_invalidate_setup_cache",

134 "should_trigger_validation",

135 "tail",

136 "write_fixture_repo",

137]