syntopica-codeality-py 0.2.2__tar.gz → 0.2.4__tar.gz

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.
Files changed (204) hide show
  1. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/CHANGELOG.md +42 -7
  2. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/PKG-INFO +31 -1
  3. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/README.md +30 -0
  4. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/codeality-py.toml +1 -0
  5. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/pyproject.toml +1 -1
  6. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/codeality-py.toml +3 -0
  7. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/pyproject-sections.toml +7 -2
  8. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/baseline_config.py +6 -0
  9. syntopica_codeality_py-0.2.4/src/codeality_py/config/environment_test_budget.py +36 -0
  10. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/load_config.py +13 -0
  11. syntopica_codeality_py-0.2.4/src/codeality_py/gate/budget_note.py +13 -0
  12. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/build_stage_result.py +2 -0
  13. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/gate_result.py +4 -1
  14. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/gate_stages.py +7 -0
  15. syntopica_codeality_py-0.2.4/src/codeality_py/gate/over_budget_detail.py +25 -0
  16. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/run_gate.py +1 -1
  17. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/run_stage.py +15 -1
  18. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/stage.py +4 -0
  19. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/stage_result.py +2 -0
  20. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/stage_status.py +2 -0
  21. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/render_gate_report.py +6 -0
  22. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/stage_document.py +2 -0
  23. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/test_file_patterns.py +1 -1
  24. syntopica_codeality_py-0.2.4/tests/commands/test_gate_command.py +19 -0
  25. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/config/test_load_config.py +50 -0
  26. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/gate/test_gate_stages.py +29 -0
  27. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/gate/test_run_gate.py +61 -0
  28. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/init/test_plan_init.py +23 -0
  29. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/init/test_render_asset.py +10 -9
  30. syntopica_codeality_py-0.2.4/tests/report/test_render_gate_report.py +45 -0
  31. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/roles/test_matches_glob.py +1 -1
  32. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/uv.lock +1 -1
  33. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/.gitignore +0 -0
  34. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/LICENSE +0 -0
  35. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/mypy.ini +0 -0
  36. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/ruff.toml +0 -0
  37. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/__init__.py +0 -0
  38. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/codeality-py-ci.yml +0 -0
  39. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/importlinter.ini +0 -0
  40. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/mypy.ini +0 -0
  41. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/assets/ruff.toml +0 -0
  42. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/__init__.py +0 -0
  43. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/baseline_file.py +0 -0
  44. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/classified_findings.py +0 -0
  45. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/classify_findings.py +0 -0
  46. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/finding_context.py +0 -0
  47. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/fingerprint.py +0 -0
  48. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/fingerprint_context.py +0 -0
  49. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/read_baseline.py +0 -0
  50. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/baseline/write_baseline.py +0 -0
  51. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/cli.py +0 -0
  52. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/__init__.py +0 -0
  53. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/baseline_check_command.py +0 -0
  54. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/baseline_command.py +0 -0
  55. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/baseline_update_command.py +0 -0
  56. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/check_command.py +0 -0
  57. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/checked_project.py +0 -0
  58. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/gate_command.py +0 -0
  59. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/init_command.py +0 -0
  60. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/commands/project_option.py +0 -0
  61. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/__init__.py +0 -0
  62. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/check_schema_version.py +0 -0
  63. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/config_error.py +0 -0
  64. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/default_generated_globs.py +0 -0
  65. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/discover_source_roots.py +0 -0
  66. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/discover_test_roots.py +0 -0
  67. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/limits.py +0 -0
  68. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/module_role.py +0 -0
  69. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/override.py +0 -0
  70. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/parse_overrides.py +0 -0
  71. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/parse_roles.py +0 -0
  72. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/parse_rule_codes.py +0 -0
  73. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/pyproject_layout_hints.py +0 -0
  74. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/read_config_document.py +0 -0
  75. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/reject_duplicate_role_claims.py +0 -0
  76. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/config/reject_unknown_keys.py +0 -0
  77. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/__init__.py +0 -0
  78. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/check_project.py +0 -0
  79. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/check_result.py +0 -0
  80. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/check_source_file.py +0 -0
  81. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/fingerprint_findings.py +0 -0
  82. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/engine/rule_registry.py +0 -0
  83. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/__init__.py +0 -0
  84. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/gate/stage_kind.py +0 -0
  85. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/__init__.py +0 -0
  86. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/add_missing_rules.py +0 -0
  87. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/apply_init.py +0 -0
  88. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/current_branch.py +0 -0
  89. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/first_party_packages.py +0 -0
  90. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/has_ruff_table.py +0 -0
  91. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/managed_asset_files.py +0 -0
  92. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/managed_file.py +0 -0
  93. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/merge_pyproject_sections.py +0 -0
  94. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/merge_quality_group.py +0 -0
  95. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/merge_ruff_config.py +0 -0
  96. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_asset_file.py +0 -0
  97. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_disposition.py +0 -0
  98. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_init.py +0 -0
  99. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_pyproject.py +0 -0
  100. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_ruff.py +0 -0
  101. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/plan_shadowed_ruff.py +0 -0
  102. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/python_floor_minor.py +0 -0
  103. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/read_asset.py +0 -0
  104. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/read_requires_python.py +0 -0
  105. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/render_asset.py +0 -0
  106. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/render_nested_workflow.py +0 -0
  107. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/repository_root.py +0 -0
  108. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/init/workflow_target.py +0 -0
  109. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/model/__init__.py +0 -0
  110. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/model/finding.py +0 -0
  111. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/model/location.py +0 -0
  112. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/model/rule_code.py +0 -0
  113. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/model/severity.py +0 -0
  114. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/__init__.py +0 -0
  115. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/infrastructure_error.py +0 -0
  116. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/parse_source_file.py +0 -0
  117. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/read_source_text.py +0 -0
  118. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/source_file.py +0 -0
  119. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/parsing/syntax_error_finding.py +0 -0
  120. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/__init__.py +0 -0
  121. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/exit_code.py +0 -0
  122. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/finding_document.py +0 -0
  123. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/findings_summary.py +0 -0
  124. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/render_json_report.py +0 -0
  125. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/report/render_text_report.py +0 -0
  126. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/__init__.py +0 -0
  127. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/assign_module_role.py +0 -0
  128. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/compile_glob.py +0 -0
  129. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/matches_any_pattern.py +0 -0
  130. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/roles/matches_glob.py +0 -0
  131. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/__init__.py +0 -0
  132. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/barrel_only_init.py +0 -0
  133. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/count_code_lines.py +0 -0
  134. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/data_unit_findings.py +0 -0
  135. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/docstring_line_spans.py +0 -0
  136. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/file_matches_unit.py +0 -0
  137. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/grab_bag_names.py +0 -0
  138. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_allowed_barrel_statement.py +0 -0
  139. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_column_list.py +0 -0
  140. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_docstring_statement.py +0 -0
  141. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_sql_literal.py +0 -0
  142. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_static_dunder_assignment.py +0 -0
  143. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/is_type_checking_block.py +0 -0
  144. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/joined_string_text.py +0 -0
  145. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/looks_like_sql.py +0 -0
  146. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/max_file_lines.py +0 -0
  147. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/no_grab_bag_names.py +0 -0
  148. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/no_inline_sql.py +0 -0
  149. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/one_primary_unit.py +0 -0
  150. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/ordinary_unit_findings.py +0 -0
  151. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/sql_subject.py +0 -0
  152. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/rules/unit_finding.py +0 -0
  153. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/__init__.py +0 -0
  154. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/apply_suppressions.py +0 -0
  155. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/build_suppression.py +0 -0
  156. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/covering_suppression.py +0 -0
  157. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/is_overridden.py +0 -0
  158. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/parse_suppression_line.py +0 -0
  159. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/parse_suppressions.py +0 -0
  160. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/suppression/suppression.py +0 -0
  161. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/traversal/__init__.py +0 -0
  162. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/traversal/collect_source_files.py +0 -0
  163. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/traversal/default_excludes.py +0 -0
  164. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/traversal/gitignore_matcher.py +0 -0
  165. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/traversal/walk_root.py +0 -0
  166. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/__init__.py +0 -0
  167. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/coalesce_overloads.py +0 -0
  168. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/coalesce_singledispatch.py +0 -0
  169. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/collect_declarations.py +0 -0
  170. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/count_primary_declarations.py +0 -0
  171. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/declaration.py +0 -0
  172. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/declaration_for.py +0 -0
  173. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/declaration_kind.py +0 -0
  174. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/decorator_name.py +0 -0
  175. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/decorator_names.py +0 -0
  176. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/is_main_guard.py +0 -0
  177. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/is_private_local_handler.py +0 -0
  178. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/legacy_type_alias.py +0 -0
  179. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/literal_string_names.py +0 -0
  180. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/merge_stray_letters.py +0 -0
  181. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/named_declaration.py +0 -0
  182. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/overload_family_length.py +0 -0
  183. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/resolve_exported_names.py +0 -0
  184. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/to_snake_case.py +0 -0
  185. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/src/codeality_py/units/top_level_statements.py +0 -0
  186. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/baseline/test_classify_findings.py +0 -0
  187. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/commands/test_baseline_command.py +0 -0
  188. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/commands/test_check_command.py +0 -0
  189. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/config/test_pyproject_layout_hints.py +0 -0
  190. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/conftest.py +0 -0
  191. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/init/test_merge_ruff_config.py +0 -0
  192. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/model/test_finding.py +0 -0
  193. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/model/test_rule_code.py +0 -0
  194. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/parsing/test_parse_source_file.py +0 -0
  195. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/roles/test_assign_module_role.py +0 -0
  196. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_barrel_only_init.py +0 -0
  197. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_file_matches_unit.py +0 -0
  198. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_max_file_lines.py +0 -0
  199. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_no_grab_bag_names.py +0 -0
  200. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_no_inline_sql.py +0 -0
  201. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/rules/test_one_primary_unit.py +0 -0
  202. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/test_cli_version.py +0 -0
  203. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/traversal/test_collect_source_files.py +0 -0
  204. {syntopica_codeality_py-0.2.2 → syntopica_codeality_py-0.2.4}/tests/units/test_to_snake_case.py +0 -0
@@ -4,6 +4,41 @@ All notable changes to `syntopica-codeality-py` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.2.4
8
+
9
+ ### Added
10
+
11
+ - `CODEALITY_PY_TEST_BUDGET_SECONDS` overrides `test-budget-seconds` for one
12
+ run. The budget is a regression guard tuned to the developer's machine, and a
13
+ suite that takes 75 s there took 292-347 s on GitHub's 4-core runners, where
14
+ Python 3.11 and 3.13 fall back to coverage's slow tracer (spectalive/qlctool,
15
+ 2026-09-25); the only fix was to raise the committed number and blunt the
16
+ guard everywhere. Unset or empty, nothing changes; a value that is not a
17
+ positive integer is a configuration error (exit 2).
18
+ - The pytest stage says which budget applied and where it came from: its text
19
+ line ends in `[budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS]`, a passing
20
+ stage's detail carries the same note, the over-budget header names the source,
21
+ and `gate --json` gains `budget_seconds` and `budget_source` on every stage
22
+ (`null` when unbudgeted).
23
+
24
+ ## 0.2.3
25
+
26
+ ### Added
27
+
28
+ - `test-budget-seconds` in `codeality-py.toml`: the gate reports the pytest
29
+ stage as `over-budget` when the suite passes but takes longer, and the detail
30
+ carries pytest's slowest-durations table and the suite-time procedure. A
31
+ consumer's suite had grown to 31 minutes with every gate green; one profiling
32
+ pass found a checker re-parsing the same file 620 951 times per run
33
+ (2026-09-22). Unset, the suite is unbudgeted, so no existing gate changes
34
+ colour on upgrade.
35
+ - The pytest stage always runs with `--durations=10`, so the measurement is in
36
+ the output before anyone asks for it.
37
+ - `init` scaffolds `pytest-xdist` with `addopts = "-ra -n auto"` and a
38
+ `test-budget-seconds = 300` in `codeality-py.toml`: a suite written parallel
39
+ from its first test stays isolated. A project with its own `[tool.pytest]`
40
+ table keeps it, as before.
41
+
7
42
  ## 0.2.2
8
43
 
9
44
  ### Changed
@@ -59,7 +94,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
59
94
  - `init --ci` in a project nested inside a repository writes the workflow at the
60
95
  repository root, named `quality-<project>.yml`, with every step running from
61
96
  the project directory. GitHub reads workflows only from the root, so the file
62
- scaffolded inside `tools/qlctool` was never picked up.
97
+ scaffolded inside `tools/nested-tool` was never picked up.
63
98
 
64
99
  ## 0.1.10
65
100
 
@@ -104,7 +139,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
104
139
  `[tool.ruff]`. Ruff reads one configuration per directory, so the file wins
105
140
  outright and the table is never read - silently. The pair builds itself over
106
141
  time: init writes the file when no table exists, and a table arrives later.
107
- Found in DJCenterDeluxe, which spent a release linting against a config nobody
142
+ Found in consumer-a, which spent a release linting against a config nobody
108
143
  read; once the shadow was removed, 1707 findings resolved to 6 real ones.
109
144
 
110
145
  ### Changed
@@ -122,7 +157,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
122
157
  - `init` no longer adds the quality dependency group to a project whose
123
158
  `requires-python` floor is below 3.11: the group carries
124
159
  `syntopica-codeality-py`, and declaring it there makes every uv resolution
125
- unsatisfiable. Found adopting the baseline in `djplayerdeluxe`, which declares
160
+ unsatisfiable. Found adopting the baseline in `consumer-b`, which declares
126
161
  `>=3.8` for its Raspberry Pi target.
127
162
 
128
163
  ## 0.1.6
@@ -131,7 +166,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
131
166
 
132
167
  - `[audit] ignore-vulns` in `codeality-py.toml`: accepted advisories, each
133
168
  expected to carry a written reason, reach pip-audit as `--ignore-vuln` flags.
134
- Found adopting the baseline in `clawd-pet`, where platformio 6.x pins
169
+ Found adopting the baseline in `consumer-c`, where platformio 6.x pins
135
170
  starlette below the patched release and the gate had no way to accept the
136
171
  documented risk.
137
172
  - `init` records the discovered `import-package`, so coverage measures the
@@ -149,7 +184,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
149
184
 
150
185
  - Root discovery now reads the layout a `pyproject.toml` already declares -
151
186
  pytest's `pythonpath` and `testpaths`, hatch's wheel `packages` - before
152
- guessing from directories. Found adopting the baseline in `clawd-pet`, a
187
+ guessing from directories. Found adopting the baseline in `consumer-c`, a
153
188
  firmware host whose Python lives under `host/src` where directory scanning
154
189
  sees nothing.
155
190
  - The test per-file-ignores pattern is `**/tests/**`, so it also reaches nested
@@ -203,7 +238,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
203
238
  identifies itself, a naming rule (`BPY002`, `BPY003`) identifies its symbol,
204
239
  and everything else uses the offending line's content plus an occurrence
205
240
  counter, so it survives edits elsewhere in the file. Found adopting the
206
- baseline in DJCenterDeluxe, where 155 findings recorded as only 91 entries.
241
+ baseline in consumer-a, where 155 findings recorded as only 91 entries.
207
242
 
208
243
  ## 0.1.1
209
244
 
@@ -213,7 +248,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
213
248
  separator and `**` crosses it. They were matched with `fnmatch`, whose `*`
214
249
  crosses separators, so a role or override written for the scripts in a
215
250
  repository root silently claimed every file in the tree. Found while adopting
216
- the baseline in DJCenterDeluxe, where `entrypoint = ["*.py"]` matched all 106
251
+ the baseline in consumer-a, where `entrypoint = ["*.py"]` matched all 106
217
252
  files instead of the 40 at the root and hid 25 real `BPY002` findings.
218
253
 
219
254
  ## 0.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: syntopica-codeality-py
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Structural linter and config scaffolder for Python: atomic files, placement, size caps, no inline SQL
5
5
  Project-URL: Homepage, https://github.com/syntopica/codeality
6
6
  Project-URL: Issues, https://github.com/syntopica/codeality/issues
@@ -82,6 +82,36 @@ rather than skipping it.
82
82
  | `BPY005` | `barrel-only-init` | `__init__.py` holds imports, `__all__` and nothing else. |
83
83
  | `BPY006` | `no-inline-sql` | SQL lives in resource files, not in string literals. |
84
84
 
85
+ ## Suite time budget
86
+
87
+ ```toml
88
+ # codeality-py.toml
89
+ test-budget-seconds = 300
90
+ ```
91
+
92
+ Past the budget a passing suite is a finding: the pytest stage reports
93
+ `over-budget`, exits 1, and its detail carries the slowest tests. The
94
+ procedure - profile, make the unit under test cheaper, parallelise, serialise
95
+ what must stay shared - is in
96
+ [docs/standards/testing.md](https://github.com/syntopica/codeality/blob/main/docs/standards/testing.md#suite-time-budget).
97
+
98
+ The budget is tuned to the machine the suite is developed on. A slower
99
+ environment, such as a CI runner, sets its own for the run instead of raising
100
+ the committed number for everyone:
101
+
102
+ ```yaml
103
+ # .github/workflows/quality.yml
104
+ env:
105
+ CODEALITY_PY_TEST_BUDGET_SECONDS: '600'
106
+ ```
107
+
108
+ When `CODEALITY_PY_TEST_BUDGET_SECONDS` is set it replaces
109
+ `test-budget-seconds`; unset or empty, it changes nothing. A value that is not a
110
+ positive integer is a configuration error (exit 2), never silently ignored. The
111
+ pytest stage names the budget it was held to and where it came from -
112
+ `budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS` - in its text line, its
113
+ detail, and the `budget_seconds` and `budget_source` fields of `gate --json`.
114
+
85
115
  ## Exit codes
86
116
 
87
117
  | Code | Meaning |
@@ -39,6 +39,36 @@ rather than skipping it.
39
39
  | `BPY005` | `barrel-only-init` | `__init__.py` holds imports, `__all__` and nothing else. |
40
40
  | `BPY006` | `no-inline-sql` | SQL lives in resource files, not in string literals. |
41
41
 
42
+ ## Suite time budget
43
+
44
+ ```toml
45
+ # codeality-py.toml
46
+ test-budget-seconds = 300
47
+ ```
48
+
49
+ Past the budget a passing suite is a finding: the pytest stage reports
50
+ `over-budget`, exits 1, and its detail carries the slowest tests. The
51
+ procedure - profile, make the unit under test cheaper, parallelise, serialise
52
+ what must stay shared - is in
53
+ [docs/standards/testing.md](https://github.com/syntopica/codeality/blob/main/docs/standards/testing.md#suite-time-budget).
54
+
55
+ The budget is tuned to the machine the suite is developed on. A slower
56
+ environment, such as a CI runner, sets its own for the run instead of raising
57
+ the committed number for everyone:
58
+
59
+ ```yaml
60
+ # .github/workflows/quality.yml
61
+ env:
62
+ CODEALITY_PY_TEST_BUDGET_SECONDS: '600'
63
+ ```
64
+
65
+ When `CODEALITY_PY_TEST_BUDGET_SECONDS` is set it replaces
66
+ `test-budget-seconds`; unset or empty, it changes nothing. A value that is not a
67
+ positive integer is a configuration error (exit 2), never silently ignored. The
68
+ pytest stage names the budget it was held to and where it came from -
69
+ `budget 600s from CODEALITY_PY_TEST_BUDGET_SECONDS` - in its text line, its
70
+ detail, and the `budget_seconds` and `budget_source` fields of `gate --json`.
71
+
42
72
  ## Exit codes
43
73
 
44
74
  | Code | Meaning |
@@ -4,6 +4,7 @@ source-roots = ["src"]
4
4
  test-roots = ["tests"]
5
5
  import-package = "codeality_py"
6
6
  coverage-threshold = 80
7
+ test-budget-seconds = 60
7
8
 
8
9
  [limits]
9
10
  max-file-lines = 150
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "syntopica-codeality-py"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "Structural linter and config scaffolder for Python: atomic files, placement, size caps, no inline SQL"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -4,6 +4,9 @@ source-roots = ["src"]
4
4
  test-roots = ["tests"]
5
5
  respect-gitignore = true
6
6
  coverage-threshold = 80
7
+ # The gate reports the pytest stage as over-budget past this many seconds.
8
+ # A suite that grows past it gets profiled, not more hardware.
9
+ test-budget-seconds = 300
7
10
 
8
11
  [limits]
9
12
  max-file-lines = 150
@@ -6,12 +6,16 @@
6
6
  known_first_party = ["CHANGE_ME"]
7
7
 
8
8
  [tool.deptry.per_rule_ignores]
9
- DEP002 = []
9
+ # pytest-xdist is a pytest plugin, loaded by the -n in addopts, never imported.
10
+ DEP002 = ["pytest-xdist"]
10
11
  # Test tooling legitimately lives in a dev group and is imported only by tests.
11
12
  DEP004 = ["pytest", "pytest_asyncio", "pytest_cov"]
12
13
 
14
+ # One worker per core from the first test, so the suite is written isolated:
15
+ # a test that needs a shared port, file or process serialises on a lock in the
16
+ # code that uses it, never by ordering. `-n 0` runs in-process for a debugger.
13
17
  [tool.pytest.ini_options]
14
- addopts = "-ra"
18
+ addopts = "-ra -n auto"
15
19
  testpaths = ["tests"]
16
20
 
17
21
  [tool.coverage.run]
@@ -30,5 +34,6 @@ quality = [
30
34
  "pip-audit>=2.7,<3",
31
35
  "pytest>=8,<10",
32
36
  "pytest-cov>=5,<8",
37
+ "pytest-xdist>=3,<4",
33
38
  "ruff>=0.15,<1",
34
39
  ]
@@ -25,3 +25,9 @@ class BaselineConfig:
25
25
  import_package: str | None = None
26
26
  coverage_threshold: int = 0
27
27
  audit_ignore_vulns: tuple[str, ...] = ()
28
+ # Seconds the pytest stage may take before the gate reports it. Zero
29
+ # leaves the suite unbudgeted.
30
+ test_budget_seconds: int = 0
31
+ # Where that budget came from: the configuration file, or the environment
32
+ # variable that overrides it for one machine. Reported beside the budget.
33
+ test_budget_source: str = "codeality-py.toml"
@@ -0,0 +1,36 @@
1
+ """Read the per-environment override of ``test-budget-seconds``."""
2
+
3
+ from collections.abc import Mapping
4
+
5
+ from codeality_py.config.config_error import ConfigError
6
+
7
+ TEST_BUDGET_ENV_VAR = "CODEALITY_PY_TEST_BUDGET_SECONDS"
8
+
9
+
10
+ def environment_test_budget(environ: Mapping[str, str]) -> int | None:
11
+ """Return the budget the environment sets, or None when it sets none.
12
+
13
+ ``test-budget-seconds`` is a regression guard tuned to the machine the
14
+ suite is developed on, and one number cannot hold for every machine: a
15
+ suite that takes 75 s locally took 292-347 s on GitHub's 4-core runners,
16
+ where Python 3.11 and 3.13 fall back to coverage's slow tracer
17
+ (spectalive/qlctool, 2026-09-25). Raising the committed number would blunt
18
+ the guard everywhere, so the environment that is slower says so for
19
+ itself. A value that is not a positive integer is refused rather than
20
+ ignored: a mistyped override that silently kept the committed budget, or
21
+ a zero that silently removed it, is the failure the gate exists to catch.
22
+ """
23
+ raw = environ.get(TEST_BUDGET_ENV_VAR, "").strip()
24
+ if not raw:
25
+ return None
26
+ try:
27
+ seconds = int(raw)
28
+ except ValueError as error:
29
+ raise ConfigError(
30
+ f"{TEST_BUDGET_ENV_VAR} must be a positive integer of seconds, found {raw!r}"
31
+ ) from error
32
+ if seconds <= 0:
33
+ raise ConfigError(
34
+ f"{TEST_BUDGET_ENV_VAR} must be a positive integer of seconds, found {raw!r}"
35
+ )
36
+ return seconds
@@ -1,5 +1,6 @@
1
1
  """Read and validate ``codeality-py.toml`` for one project."""
2
2
 
3
+ import os
3
4
  from pathlib import Path
4
5
 
5
6
  from codeality_py.config.baseline_config import BaselineConfig
@@ -9,6 +10,10 @@ from codeality_py.config.check_schema_version import (
9
10
  )
10
11
  from codeality_py.config.discover_source_roots import discover_source_roots
11
12
  from codeality_py.config.discover_test_roots import discover_test_roots
13
+ from codeality_py.config.environment_test_budget import (
14
+ TEST_BUDGET_ENV_VAR,
15
+ environment_test_budget,
16
+ )
12
17
  from codeality_py.config.limits import Limits
13
18
  from codeality_py.config.parse_overrides import parse_overrides
14
19
  from codeality_py.config.parse_roles import parse_roles
@@ -25,6 +30,7 @@ _TOP_LEVEL_KEYS = {
25
30
  "sql-resource-globs",
26
31
  "import-package",
27
32
  "coverage-threshold",
33
+ "test-budget-seconds",
28
34
  "limits",
29
35
  "audit",
30
36
  "roles",
@@ -45,6 +51,7 @@ def load_config(project_root: Path) -> BaselineConfig:
45
51
  audit = document.get("audit", {})
46
52
  reject_unknown_keys(audit, _AUDIT_KEYS, "[audit]")
47
53
  source_roots = tuple(document.get("source-roots", ())) or discover_source_roots(project_root)
54
+ budget_override = environment_test_budget(os.environ)
48
55
  return BaselineConfig(
49
56
  project_root=project_root,
50
57
  schema_version=SUPPORTED_SCHEMA_VERSION,
@@ -61,4 +68,10 @@ def load_config(project_root: Path) -> BaselineConfig:
61
68
  import_package=document.get("import-package"),
62
69
  coverage_threshold=int(document.get("coverage-threshold", 0)),
63
70
  audit_ignore_vulns=tuple(audit.get("ignore-vulns", ())),
71
+ test_budget_seconds=(
72
+ budget_override
73
+ if budget_override is not None
74
+ else int(document.get("test-budget-seconds", 0))
75
+ ),
76
+ test_budget_source=TEST_BUDGET_ENV_VAR if budget_override is not None else CONFIG_FILENAME,
64
77
  )
@@ -0,0 +1,13 @@
1
+ """Say which time budget a stage was held to, and where it came from."""
2
+
3
+
4
+ def budget_note(budget_seconds: float, budget_source: str) -> str:
5
+ """Return ``budget 600s from <source>``, or nothing for an unbudgeted stage.
6
+
7
+ The budget can come from the configuration file or from an environment
8
+ variable that overrides it on one machine, so a log that shows only the
9
+ number leaves the reader guessing which of the two was in force.
10
+ """
11
+ if budget_seconds <= 0.0:
12
+ return ""
13
+ return f"budget {budget_seconds:g}s from {budget_source}"
@@ -17,4 +17,6 @@ def build_stage_result(
17
17
  exit_code=exit_code,
18
18
  duration_seconds=round(elapsed, 3),
19
19
  detail=detail,
20
+ budget_seconds=stage.budget_seconds,
21
+ budget_source=stage.budget_source,
20
22
  )
@@ -6,6 +6,9 @@ from codeality_py.gate.stage_result import StageResult
6
6
  from codeality_py.gate.stage_status import StageStatus
7
7
  from codeality_py.report.exit_code import ExitCode
8
8
 
9
+ # A suite past its budget exits like any other finding: it is one.
10
+ _FINDINGS = (StageStatus.FINDINGS, StageStatus.OVER_BUDGET)
11
+
9
12
 
10
13
  @dataclass(frozen=True, slots=True)
11
14
  class GateResult:
@@ -18,6 +21,6 @@ class GateResult:
18
21
  blocking = [stage for stage in self.stages if stage.kind.value == "required"]
19
22
  if any(stage.status is StageStatus.FAILED_TO_RUN for stage in blocking):
20
23
  return ExitCode.INFRASTRUCTURE
21
- if any(stage.status is StageStatus.FINDINGS for stage in blocking):
24
+ if any(stage.status in _FINDINGS for stage in blocking):
22
25
  return ExitCode.FINDINGS
23
26
  return ExitCode.OK
@@ -12,6 +12,10 @@ def gate_stages(config: BaselineConfig) -> tuple[Stage, ...]:
12
12
  Coverage is collected rather than merely configured. pip-audit audits the
13
13
  installed environment, which the CI workflow builds with "uv sync
14
14
  --locked", so what is audited is exactly what the lockfile pins.
15
+
16
+ pytest reports its slowest tests every run, so a suite that goes over its
17
+ budget hands the reader the measurement in the same output, and a suite
18
+ creeping towards it is visible before it gets there.
15
19
  """
16
20
  roots = [*config.source_roots, *config.test_roots]
17
21
  package = config.import_package or config.source_roots[0]
@@ -44,7 +48,10 @@ def gate_stages(config: BaselineConfig) -> tuple[Stage, ...]:
44
48
  f"--cov={package}",
45
49
  "--cov-report=term-missing",
46
50
  f"--cov-fail-under={config.coverage_threshold}",
51
+ "--durations=10",
47
52
  ),
53
+ budget_seconds=float(config.test_budget_seconds),
54
+ budget_source=config.test_budget_source if config.test_budget_seconds else "",
48
55
  ),
49
56
  Stage("pyrefly", StageKind.SHADOW, ("pyrefly", "check")),
50
57
  )
@@ -0,0 +1,25 @@
1
+ """What the report says about a stage that passed too slowly."""
2
+
3
+ from codeality_py.gate.stage import Stage
4
+
5
+ # The suite-time procedure: profile the slowest tests, make the unit under
6
+ # test cheaper, then parallelise, then serialise what must stay shared.
7
+ PROCEDURE_URL = (
8
+ "https://github.com/syntopica/codeality/blob/main/docs/standards/testing.md#suite-time-budget"
9
+ )
10
+
11
+
12
+ def over_budget_detail(stage: Stage, elapsed: float, output: str) -> str:
13
+ """Return the detail for a stage that succeeded past its budget.
14
+
15
+ It carries the last part of the stage's own output, which for pytest run
16
+ with ``--durations`` is the table of the slowest tests, so the reader
17
+ starts from the measurement rather than from the exit code.
18
+ """
19
+ header = (
20
+ f"{stage.name} passed in {elapsed:.1f}s, over its budget of "
21
+ f"{stage.budget_seconds:g}s (from {stage.budget_source}). "
22
+ f"Profile before adding hardware: {PROCEDURE_URL}"
23
+ )
24
+ tail = output[-2000:].strip()
25
+ return f"{header}\n{tail}" if tail else header
@@ -7,7 +7,7 @@ from codeality_py.gate.run_stage import run_stage
7
7
  from codeality_py.gate.stage_kind import StageKind
8
8
  from codeality_py.gate.stage_status import StageStatus
9
9
 
10
- _BLOCKED = (StageStatus.FINDINGS, StageStatus.FAILED_TO_RUN)
10
+ _BLOCKED = (StageStatus.FINDINGS, StageStatus.OVER_BUDGET, StageStatus.FAILED_TO_RUN)
11
11
 
12
12
 
13
13
  def run_gate(config: BaselineConfig, fail_fast: bool) -> GateResult:
@@ -5,7 +5,9 @@ import subprocess
5
5
  import time
6
6
  from pathlib import Path
7
7
 
8
+ from codeality_py.gate.budget_note import budget_note
8
9
  from codeality_py.gate.build_stage_result import build_stage_result
10
+ from codeality_py.gate.over_budget_detail import over_budget_detail
9
11
  from codeality_py.gate.stage import Stage
10
12
  from codeality_py.gate.stage_kind import StageKind
11
13
  from codeality_py.gate.stage_result import StageResult
@@ -48,5 +50,17 @@ def run_stage(stage: Stage, project_root: Path) -> StageResult:
48
50
  output = "\n".join(
49
51
  part.strip() for part in (completed.stdout, completed.stderr) if part.strip()
50
52
  )
51
- detail = "" if completed.returncode == 0 else output[-2000:]
53
+ # A passing budgeted stage names the budget it was held to and where
54
+ # that came from, so a CI log shows whether an override was in force.
55
+ detail = (
56
+ budget_note(stage.budget_seconds, stage.budget_source)
57
+ if completed.returncode == 0
58
+ else output[-2000:]
59
+ )
60
+ # A suite that passes but takes longer than it may is a finding of its
61
+ # own: the tail of its output holds pytest's slowest-durations table,
62
+ # which is where fixing it starts.
63
+ if status is StageStatus.PASSED and 0.0 < stage.budget_seconds < elapsed:
64
+ status = StageStatus.OVER_BUDGET
65
+ detail = over_budget_detail(stage, elapsed, output)
52
66
  return build_stage_result(stage, status, completed.returncode, elapsed, detail)
@@ -12,3 +12,7 @@ class Stage:
12
12
  name: str
13
13
  kind: StageKind
14
14
  command: tuple[str, ...]
15
+ # Seconds the stage may take and still pass. Zero means unbudgeted.
16
+ budget_seconds: float = 0.0
17
+ # Where the budget came from, so a report can say which one applied.
18
+ budget_source: str = ""
@@ -17,3 +17,5 @@ class StageResult:
17
17
  exit_code: int
18
18
  duration_seconds: float
19
19
  detail: str = ""
20
+ budget_seconds: float = 0.0
21
+ budget_source: str = ""
@@ -8,5 +8,7 @@ class StageStatus(StrEnum):
8
8
 
9
9
  PASSED = "passed"
10
10
  FINDINGS = "findings"
11
+ # The command succeeded and took longer than the stage's budget.
12
+ OVER_BUDGET = "over-budget"
11
13
  FAILED_TO_RUN = "failed-to-run"
12
14
  SKIPPED_NOT_APPLICABLE = "skipped-not-applicable"
@@ -2,6 +2,7 @@
2
2
 
3
3
  import json
4
4
 
5
+ from codeality_py.gate.budget_note import budget_note
5
6
  from codeality_py.gate.gate_result import GateResult
6
7
  from codeality_py.report.stage_document import stage_document
7
8
 
@@ -17,5 +18,10 @@ def render_gate_report(result: GateResult, as_json: bool) -> str:
17
18
  return "\n".join(
18
19
  f"{stage.status.value:>22} {stage.name:<12} "
19
20
  f"{stage.duration_seconds:>7.2f}s {' '.join(stage.command)}"
21
+ + (
22
+ f" [{note}]"
23
+ if (note := budget_note(stage.budget_seconds, stage.budget_source))
24
+ else ""
25
+ )
20
26
  for stage in result.stages
21
27
  )
@@ -13,4 +13,6 @@ def stage_document(stage: StageResult) -> dict[str, object]:
13
13
  "exit_code": stage.exit_code,
14
14
  "duration_seconds": stage.duration_seconds,
15
15
  "detail": stage.detail,
16
+ "budget_seconds": stage.budget_seconds or None,
17
+ "budget_source": stage.budget_source or None,
16
18
  }
@@ -1,6 +1,6 @@
1
1
  """Patterns that identify a test module.
2
2
 
3
- ``waveform_test.py`` in djplayerdeluxe is missed by a ``test_*.py``-only rule,
3
+ ``waveform_test.py`` in consumer-b is missed by a ``test_*.py``-only rule,
4
4
  so the suffix form is part of the default set.
5
5
  """
6
6
 
@@ -0,0 +1,19 @@
1
+ """gate refuses a bad configuration before running any stage."""
2
+
3
+ from pathlib import Path
4
+
5
+ import pytest
6
+ from click.testing import CliRunner
7
+
8
+ from codeality_py.cli import cli
9
+
10
+
11
+ def test_a_bad_budget_variable_is_a_configuration_error_not_a_crash(
12
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
13
+ ) -> None:
14
+ (tmp_path / "src").mkdir()
15
+ monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "ten minutes")
16
+ result = CliRunner().invoke(cli, ["gate", "--project", str(tmp_path)])
17
+ assert result.exit_code == 2
18
+ assert result.exception is None or isinstance(result.exception, SystemExit)
19
+ assert "configuration error: CODEALITY_PY_TEST_BUDGET_SECONDS" in result.output
@@ -86,3 +86,53 @@ def test_an_unknown_rule_code_in_an_override_is_fatal(tmp_path: Path) -> None:
86
86
  )
87
87
  with pytest.raises(ConfigError, match="unknown rule code"):
88
88
  load_config(tmp_path)
89
+
90
+
91
+ def test_the_suite_is_unbudgeted_unless_the_project_says_otherwise(
92
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
93
+ ) -> None:
94
+ monkeypatch.delenv("CODEALITY_PY_TEST_BUDGET_SECONDS", raising=False)
95
+ (tmp_path / "src").mkdir()
96
+ assert load_config(tmp_path).test_budget_seconds == 0
97
+
98
+
99
+ def test_the_test_budget_is_read(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
100
+ monkeypatch.delenv("CODEALITY_PY_TEST_BUDGET_SECONDS", raising=False)
101
+ _write(tmp_path, "schema-version = 1\ntest-budget-seconds = 300\n")
102
+ config = load_config(tmp_path)
103
+ assert config.test_budget_seconds == 300
104
+ assert config.test_budget_source == "codeality-py.toml"
105
+
106
+
107
+ def test_the_environment_overrides_the_test_budget(
108
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
109
+ ) -> None:
110
+ """2026-09-25: spectalive/qlctool's suite takes 75 s on the developer's
111
+ machine and 292-347 s on GitHub's 4-core runners, where 3.11 and 3.13 fall
112
+ back to coverage's slow tracer. One committed number cannot guard both.
113
+ """
114
+ monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "600")
115
+ _write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
116
+ config = load_config(tmp_path)
117
+ assert config.test_budget_seconds == 600
118
+ assert config.test_budget_source == "CODEALITY_PY_TEST_BUDGET_SECONDS"
119
+
120
+
121
+ def test_an_empty_budget_variable_changes_nothing(
122
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
123
+ ) -> None:
124
+ monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", "")
125
+ _write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
126
+ config = load_config(tmp_path)
127
+ assert config.test_budget_seconds == 120
128
+ assert config.test_budget_source == "codeality-py.toml"
129
+
130
+
131
+ @pytest.mark.parametrize("value", ["ten", "1.5", "0", "-30"])
132
+ def test_a_budget_variable_that_is_not_a_positive_integer_is_fatal(
133
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, value: str
134
+ ) -> None:
135
+ monkeypatch.setenv("CODEALITY_PY_TEST_BUDGET_SECONDS", value)
136
+ _write(tmp_path, "schema-version = 1\ntest-budget-seconds = 120\n")
137
+ with pytest.raises(ConfigError, match="CODEALITY_PY_TEST_BUDGET_SECONDS"):
138
+ load_config(tmp_path)
@@ -67,3 +67,32 @@ def test_a_missing_required_tool_still_fails_to_run(tmp_path: Path) -> None:
67
67
  result = run_stage(stage, tmp_path)
68
68
  assert result.status is StageStatus.FAILED_TO_RUN
69
69
  assert result.exit_code == 127
70
+
71
+
72
+ def test_pytest_reports_its_slowest_tests_on_every_run() -> None:
73
+ """The measurement a slow suite is fixed from is in the output already."""
74
+ config = BaselineConfig(project_root=Path("/p"), import_package="demo")
75
+ assert "--durations=10" in _commands(config)["pytest"]
76
+
77
+
78
+ def test_the_test_budget_reaches_the_pytest_stage_and_no_other() -> None:
79
+ config = BaselineConfig(project_root=Path("/p"), test_budget_seconds=300)
80
+ budgets = {stage.name: stage.budget_seconds for stage in gate_stages(config)}
81
+ assert budgets["pytest"] == 300.0
82
+ assert all(budget == 0.0 for name, budget in budgets.items() if name != "pytest")
83
+
84
+
85
+ def test_the_pytest_stage_carries_where_its_budget_came_from() -> None:
86
+ config = BaselineConfig(
87
+ project_root=Path("/p"),
88
+ test_budget_seconds=600,
89
+ test_budget_source="CODEALITY_PY_TEST_BUDGET_SECONDS",
90
+ )
91
+ sources = {stage.name: stage.budget_source for stage in gate_stages(config)}
92
+ assert sources["pytest"] == "CODEALITY_PY_TEST_BUDGET_SECONDS"
93
+ assert all(source == "" for name, source in sources.items() if name != "pytest")
94
+
95
+
96
+ def test_an_unbudgeted_pytest_stage_names_no_source() -> None:
97
+ config = BaselineConfig(project_root=Path("/p"))
98
+ assert {stage.name: stage.budget_source for stage in gate_stages(config)}["pytest"] == ""