Skip to content

Commit a680fb2

Browse files
Copilotmrjf
andauthored
Address review: consolidate PROGRAMS_DIR constant; remove dead if-False branch
Agent-Logs-Url: https://github.com/githubnext/autoloop/sessions/c6a28e1a-8d38-4b61-8f7e-ea0c55200db1 Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent b0bba6b commit a680fb2

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

.github/workflows/scripts/autoloop_scheduler.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
from datetime import datetime, timedelta, timezone
4646

4747
PROGRAMS_DIR = ".autoloop/programs"
48-
AUTOLOOP_DIR = ".autoloop/programs"
49-
TEMPLATE_FILE = os.path.join(AUTOLOOP_DIR, "example.md")
48+
TEMPLATE_FILE = os.path.join(PROGRAMS_DIR, "example.md")
5049

5150
# Repo-memory files are cloned to /tmp/gh-aw/repo-memory/{id}/ where {id}
5251
# is derived from the branch-name configured in the tools section
@@ -216,9 +215,9 @@ def read_program_state(program_name, repo_memory_dir=REPO_MEMORY_DIR):
216215

217216
def _bootstrap_template_if_missing():
218217
"""Create ``.autoloop/programs/example.md`` if the directory is missing."""
219-
if os.path.isdir(AUTOLOOP_DIR):
218+
if os.path.isdir(PROGRAMS_DIR):
220219
return
221-
os.makedirs(AUTOLOOP_DIR, exist_ok=True)
220+
os.makedirs(PROGRAMS_DIR, exist_ok=True)
222221
bt = chr(96) # backtick — keep gh-aw compiler happy if this ever gets inlined
223222
template = "\n".join([
224223
"<!-- AUTOLOOP:UNCONFIGURED -->",
@@ -279,8 +278,8 @@ def _scan_directory_programs():
279278

280279

281280
def _scan_bare_programs():
282-
"""Return paths of bare-markdown programs under ``AUTOLOOP_DIR``."""
283-
return sorted(glob.glob(os.path.join(AUTOLOOP_DIR, "*.md")))
281+
"""Return paths of bare-markdown programs under ``PROGRAMS_DIR``."""
282+
return sorted(glob.glob(os.path.join(PROGRAMS_DIR, "*.md")))
284283

285284

286285
def _fetch_issue_programs(repo, github_token):

tests/test_scheduler_e2e.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ def _run_scheduler(workdir, *, forced=None, repo="bogus.invalid/bogus"):
9999
os.makedirs(tmproot, exist_ok=True)
100100
env["TMPDIR"] = tmproot
101101

102-
# Wipe any stale output from a previous run within this workdir.
103-
out_dir = os.path.join(tmproot, "gh-aw") if False else "/tmp/gh-aw"
104-
out_path = os.path.join(out_dir, "autoloop.json")
102+
# The scheduler always writes /tmp/gh-aw/autoloop.json. We can't redirect
103+
# this via env vars without changing the script's contract, so tests share
104+
# that path and clean up the previous run's output before invoking again.
105+
out_path = "/tmp/gh-aw/autoloop.json"
105106
if os.path.exists(out_path):
106107
os.remove(out_path)
107108

workflows/scripts/autoloop_scheduler.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
from datetime import datetime, timedelta, timezone
4646

4747
PROGRAMS_DIR = ".autoloop/programs"
48-
AUTOLOOP_DIR = ".autoloop/programs"
49-
TEMPLATE_FILE = os.path.join(AUTOLOOP_DIR, "example.md")
48+
TEMPLATE_FILE = os.path.join(PROGRAMS_DIR, "example.md")
5049

5150
# Repo-memory files are cloned to /tmp/gh-aw/repo-memory/{id}/ where {id}
5251
# is derived from the branch-name configured in the tools section
@@ -216,9 +215,9 @@ def read_program_state(program_name, repo_memory_dir=REPO_MEMORY_DIR):
216215

217216
def _bootstrap_template_if_missing():
218217
"""Create ``.autoloop/programs/example.md`` if the directory is missing."""
219-
if os.path.isdir(AUTOLOOP_DIR):
218+
if os.path.isdir(PROGRAMS_DIR):
220219
return
221-
os.makedirs(AUTOLOOP_DIR, exist_ok=True)
220+
os.makedirs(PROGRAMS_DIR, exist_ok=True)
222221
bt = chr(96) # backtick — keep gh-aw compiler happy if this ever gets inlined
223222
template = "\n".join([
224223
"<!-- AUTOLOOP:UNCONFIGURED -->",
@@ -279,8 +278,8 @@ def _scan_directory_programs():
279278

280279

281280
def _scan_bare_programs():
282-
"""Return paths of bare-markdown programs under ``AUTOLOOP_DIR``."""
283-
return sorted(glob.glob(os.path.join(AUTOLOOP_DIR, "*.md")))
281+
"""Return paths of bare-markdown programs under ``PROGRAMS_DIR``."""
282+
return sorted(glob.glob(os.path.join(PROGRAMS_DIR, "*.md")))
284283

285284

286285
def _fetch_issue_programs(repo, github_token):

0 commit comments

Comments
 (0)