jleechanorg-pr-automation 0.1.1__py3-none-any.whl → 0.2.45__py3-none-any.whl

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 (46) hide show
  1. jleechanorg_pr_automation/STORAGE_STATE_TESTING_PROTOCOL.md +326 -0
  2. jleechanorg_pr_automation/__init__.py +64 -9
  3. jleechanorg_pr_automation/automation_safety_manager.py +306 -95
  4. jleechanorg_pr_automation/automation_safety_wrapper.py +13 -19
  5. jleechanorg_pr_automation/automation_utils.py +87 -65
  6. jleechanorg_pr_automation/check_codex_comment.py +7 -1
  7. jleechanorg_pr_automation/codex_branch_updater.py +21 -9
  8. jleechanorg_pr_automation/codex_config.py +70 -3
  9. jleechanorg_pr_automation/jleechanorg_pr_monitor.py +1954 -234
  10. jleechanorg_pr_automation/logging_utils.py +86 -0
  11. jleechanorg_pr_automation/openai_automation/__init__.py +3 -0
  12. jleechanorg_pr_automation/openai_automation/codex_github_mentions.py +1111 -0
  13. jleechanorg_pr_automation/openai_automation/debug_page_content.py +88 -0
  14. jleechanorg_pr_automation/openai_automation/oracle_cli.py +364 -0
  15. jleechanorg_pr_automation/openai_automation/test_auth_restoration.py +244 -0
  16. jleechanorg_pr_automation/openai_automation/test_codex_comprehensive.py +355 -0
  17. jleechanorg_pr_automation/openai_automation/test_codex_integration.py +254 -0
  18. jleechanorg_pr_automation/orchestrated_pr_runner.py +516 -0
  19. jleechanorg_pr_automation/tests/__init__.py +0 -0
  20. jleechanorg_pr_automation/tests/test_actionable_counting_matrix.py +84 -86
  21. jleechanorg_pr_automation/tests/test_attempt_limit_logic.py +124 -0
  22. jleechanorg_pr_automation/tests/test_automation_marker_functions.py +175 -0
  23. jleechanorg_pr_automation/tests/test_automation_over_running_reproduction.py +9 -11
  24. jleechanorg_pr_automation/tests/test_automation_safety_limits.py +91 -79
  25. jleechanorg_pr_automation/tests/test_automation_safety_manager_comprehensive.py +53 -53
  26. jleechanorg_pr_automation/tests/test_codex_actor_matching.py +1 -1
  27. jleechanorg_pr_automation/tests/test_fixpr_prompt.py +54 -0
  28. jleechanorg_pr_automation/tests/test_fixpr_return_value.py +140 -0
  29. jleechanorg_pr_automation/tests/test_graphql_error_handling.py +26 -26
  30. jleechanorg_pr_automation/tests/test_model_parameter.py +317 -0
  31. jleechanorg_pr_automation/tests/test_orchestrated_pr_runner.py +697 -0
  32. jleechanorg_pr_automation/tests/test_packaging_integration.py +127 -0
  33. jleechanorg_pr_automation/tests/test_pr_filtering_matrix.py +246 -193
  34. jleechanorg_pr_automation/tests/test_pr_monitor_eligibility.py +354 -0
  35. jleechanorg_pr_automation/tests/test_pr_targeting.py +102 -7
  36. jleechanorg_pr_automation/tests/test_version_consistency.py +51 -0
  37. jleechanorg_pr_automation/tests/test_workflow_specific_limits.py +202 -0
  38. jleechanorg_pr_automation/tests/test_workspace_dispatch_missing_dir.py +119 -0
  39. jleechanorg_pr_automation/utils.py +81 -56
  40. jleechanorg_pr_automation-0.2.45.dist-info/METADATA +864 -0
  41. jleechanorg_pr_automation-0.2.45.dist-info/RECORD +45 -0
  42. jleechanorg_pr_automation-0.1.1.dist-info/METADATA +0 -222
  43. jleechanorg_pr_automation-0.1.1.dist-info/RECORD +0 -23
  44. {jleechanorg_pr_automation-0.1.1.dist-info → jleechanorg_pr_automation-0.2.45.dist-info}/WHEEL +0 -0
  45. {jleechanorg_pr_automation-0.1.1.dist-info → jleechanorg_pr_automation-0.2.45.dist-info}/entry_points.txt +0 -0
  46. {jleechanorg_pr_automation-0.1.1.dist-info → jleechanorg_pr_automation-0.2.45.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Packaging integration tests to catch package structure issues.
4
+
5
+ These tests verify that the package can be imported as it would be
6
+ when installed via pip, not just when run from the source directory.
7
+
8
+ This would have caught the missing __init__.py bug in openai_automation/
9
+ """
10
+
11
+ import subprocess
12
+ import sys
13
+ import os
14
+ import pytest
15
+ import jleechanorg_pr_automation
16
+ from jleechanorg_pr_automation.openai_automation import codex_github_mentions
17
+
18
+
19
+ class TestPackagingIntegration:
20
+ """Test that package structure works for pip installations."""
21
+
22
+ def test_openai_automation_module_import(self):
23
+ """
24
+ Test that openai_automation can be imported as a proper submodule.
25
+
26
+ This catches missing __init__.py files that would break pip installs.
27
+ Uses the same import path that --codex-update uses.
28
+ """
29
+ # This is what happens when user runs: python3 -m jleechanorg_pr_automation.openai_automation.codex_github_mentions
30
+ # It requires proper package structure with __init__.py files
31
+
32
+ # Import moved to top level to comply with standards
33
+ assert codex_github_mentions is not None, "Module import returned None"
34
+
35
+ def test_openai_automation_module_execution(self):
36
+ """
37
+ Test that openai_automation module can be executed with -m flag.
38
+
39
+ This is the actual command used by --codex-update in jleechanorg_pr_monitor.py
40
+ """
41
+ # This simulates what happens in jleechanorg_pr_monitor.py:1340
42
+ result = subprocess.run(
43
+ [
44
+ sys.executable,
45
+ "-m",
46
+ "jleechanorg_pr_automation.openai_automation.codex_github_mentions",
47
+ "--help"
48
+ ],
49
+ capture_output=True,
50
+ text=True,
51
+ timeout=10
52
+ )
53
+
54
+ assert result.returncode == 0, (
55
+ f"Module execution failed with return code {result.returncode}\n"
56
+ f"STDOUT: {result.stdout}\n"
57
+ f"STDERR: {result.stderr}\n"
58
+ f"This usually means __init__.py is missing in openai_automation/"
59
+ )
60
+
61
+ # Verify help output contains expected content
62
+ assert "--limit" in result.stdout or "--help" in result.stdout, (
63
+ f"Help output doesn't contain expected flags. Got: {result.stdout}"
64
+ )
65
+
66
+ def test_openai_automation_has_init_file(self):
67
+ """
68
+ Directly verify that __init__.py exists in openai_automation.
69
+
70
+ This is a sanity check to catch the issue at the file system level.
71
+ """
72
+ # Imports moved to top level
73
+
74
+ # Get the package directory
75
+ package_dir = os.path.dirname(jleechanorg_pr_automation.__file__)
76
+ openai_automation_dir = os.path.join(package_dir, "openai_automation")
77
+ init_file = os.path.join(openai_automation_dir, "__init__.py")
78
+
79
+ assert os.path.exists(openai_automation_dir), (
80
+ f"openai_automation directory not found at {openai_automation_dir}"
81
+ )
82
+
83
+ assert os.path.isfile(init_file), (
84
+ f"Missing __init__.py in openai_automation directory!\n"
85
+ f"Expected file at: {init_file}\n"
86
+ f"Without this file, the directory cannot be imported as a Python module.\n"
87
+ f"This breaks: python3 -m jleechanorg_pr_automation.openai_automation.codex_github_mentions"
88
+ )
89
+
90
+
91
+ class TestPackageStructure:
92
+ """Verify overall package structure is correct."""
93
+
94
+ def test_all_package_dirs_have_init(self):
95
+ """
96
+ Verify all package directories have __init__.py files.
97
+
98
+ This prevents future packaging bugs.
99
+ """
100
+ # Imports moved to top level
101
+
102
+ package_root = os.path.dirname(jleechanorg_pr_automation.__file__)
103
+
104
+ # Find all directories that contain Python files
105
+ package_dirs = set()
106
+ for root, dirs, files in os.walk(package_root):
107
+ # Skip test directories and __pycache__
108
+ if "__pycache__" in root or ".pytest_cache" in root:
109
+ continue
110
+
111
+ # If directory contains .py files, it should have __init__.py
112
+ has_python_files = any(f.endswith(".py") for f in files)
113
+ if has_python_files and root != package_root:
114
+ package_dirs.add(root)
115
+
116
+ missing_init = []
117
+ for pkg_dir in package_dirs:
118
+ init_file = os.path.join(pkg_dir, "__init__.py")
119
+ if not os.path.isfile(init_file):
120
+ rel_path = os.path.relpath(pkg_dir, package_root)
121
+ missing_init.append(rel_path)
122
+
123
+ assert not missing_init, (
124
+ f"Found package directories without __init__.py:\n" +
125
+ "\n".join(f" - {d}" for d in missing_init) +
126
+ "\n\nAll directories containing Python files must have __init__.py to be importable as modules."
127
+ )