FORGE-F013 Resolve testtask by task ID or branch

This commit is contained in:
rob
2026-11-18 16:43:25 +00:00
parent 30f6a69df5
commit 0d6761972d
8 changed files with 154 additions and 13 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
Read `docs/PROJECT_OVERVIEW.md`, `CURRENT_STATE.md`, `DECISIONS.md`, `TASKS.md`, and `HANDOFF.md` before task work. Inspect Git status and relevant code. Under Captain's FORGE-008 direction, work directly on `codex` and commit scoped Forge changes there until Captain says otherwise; do not create task branches or worktrees as routine setup. Preserve existing worktrees, unrelated changes, and legacy skills. Task IDs use `FORGE-F###`; record implementation, validation, limitations, and handoff. Only mark a task complete after human acceptance. Never commit secrets. Do not modify external projects, production infrastructure, or installed skills as part of foundation work. Read `docs/PROJECT_OVERVIEW.md`, `CURRENT_STATE.md`, `DECISIONS.md`, `TASKS.md`, and `HANDOFF.md` before task work. Inspect Git status and relevant code. Under Captain's FORGE-008 direction, work directly on `codex` and commit scoped Forge changes there until Captain says otherwise; do not create task branches or worktrees as routine setup. Preserve existing worktrees, unrelated changes, and legacy skills. Task IDs use `FORGE-F###`; record implementation, validation, limitations, and handoff. Only mark a task complete after human acceptance. Never commit secrets. Do not modify external projects, production infrastructure, or installed skills as part of foundation work.
Script commands: `scripts/create-chatgpt-snapshot.sh` creates a current-worktree ZIP under ignored `snapshots/`; inspect contents before sharing. `scripts/testtask.sh FORGE-F###` is the task-ID entry point, currently provisioned but blocked because Forge has no application runtime or manual-test hook. Script commands: `scripts/create-chatgpt-snapshot.sh` creates a current-worktree ZIP under ignored `snapshots/`; inspect contents before sharing. `scripts/testtask.sh <task-id|branch-name>` resolves an existing task branch and worktree, then reports that manual testing remains blocked because Forge has no application runtime or manual-test hook.
+2
View File
@@ -3,3 +3,5 @@
FORGE-F001, FORGE-F002, FORGE-F006, and FORGE-F007 were human accepted and are present on `codex`. F003 and F004 candidates are integrated locally with external validation and acceptance pending. The Captain-authorised F004 lifecycle follow-up from `codex-forge-f004-lifecycle` was integrated into `codex` at `727a64e` after combined Forge checks; it extends F002's accepted context contract without reopening F002. FORGE-F011 is a planned visual design quality follow-up to F003; image-to-editable-Penpot reconstruction remains unproven and requires investigation. F006 provides an independent Flask/React template package and generator, with SQLite, PostgreSQL, MySQL, and MariaDB migrations verified in disposable Docker containers. Windows generation remains untested. The original bootstrap repository remains available; no external retirement was performed. Explicit business/personal profile configuration is implemented. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present; one skill directory remains reserved. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. No cross-template generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and integrated MCP, but this session has no Penpot connector/browser. JJ's hands-on and Windows workflow has not been tested. Decisions FORGE-001 through FORGE-011 remain accepted. FORGE-008 authorises direct `codex` work generally; Captain explicitly requested isolation for the F004 lifecycle follow-up. FORGE-F001, FORGE-F002, FORGE-F006, and FORGE-F007 were human accepted and are present on `codex`. F003 and F004 candidates are integrated locally with external validation and acceptance pending. The Captain-authorised F004 lifecycle follow-up from `codex-forge-f004-lifecycle` was integrated into `codex` at `727a64e` after combined Forge checks; it extends F002's accepted context contract without reopening F002. FORGE-F011 is a planned visual design quality follow-up to F003; image-to-editable-Penpot reconstruction remains unproven and requires investigation. F006 provides an independent Flask/React template package and generator, with SQLite, PostgreSQL, MySQL, and MariaDB migrations verified in disposable Docker containers. Windows generation remains untested. The original bootstrap repository remains available; no external retirement was performed. Explicit business/personal profile configuration is implemented. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present; one skill directory remains reserved. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. No cross-template generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and integrated MCP, but this session has no Penpot connector/browser. JJ's hands-on and Windows workflow has not been tested. Decisions FORGE-001 through FORGE-011 remain accepted. FORGE-008 authorises direct `codex` work generally; Captain explicitly requested isolation for the F004 lifecycle follow-up.
FORGE-F012's editor-connection preflight and recovery guidance were fast-forward integrated into local `codex` at `075e2f3` after Captain authorisation and combined checks. Its isolated worktree `/tmp/bortstack-forge-f012` remains preserved; human acceptance is pending. The Captain explicitly requested isolation for F012; FORGE-008 remains the general direct-`codex` policy. No live Penpot behavior is claimed by this documentation change. FORGE-F012's editor-connection preflight and recovery guidance were fast-forward integrated into local `codex` at `075e2f3` after Captain authorisation and combined checks. Its isolated worktree `/tmp/bortstack-forge-f012` remains preserved; human acceptance is pending. The Captain explicitly requested isolation for F012; FORGE-008 remains the general direct-`codex` policy. No live Penpot behavior is claimed by this documentation change.
FORGE-F013 is an isolated candidate at `/tmp/bortstack-forge-f013` to resolve `testtask` input by task ID or branch. The script still reports the missing Forge runtime after successful resolution. Validation passed on the candidate; integration and human acceptance remain pending.
+2
View File
@@ -13,3 +13,5 @@ Next action: Keep F004 open for JJ's Windows, Docker, provider and conversationa
FORGE-F011 preparation (2026-11-17): On `codex` from `934e62c`, the prior planning pass inspected repository records and clean checkout, ran the context task-ID audit, and found no F011 collision. It added context records only; no skill implementation, application code, Penpot file, or external project changed. F011 remains Planned. FORGE-F011 preparation (2026-11-17): On `codex` from `934e62c`, the prior planning pass inspected repository records and clean checkout, ran the context task-ID audit, and found no F011 collision. It added context records only; no skill implementation, application code, Penpot file, or external project changed. F011 remains Planned.
FORGE-F012 integration (2026-11-18): Captain requested an isolated worktree for Penpot editor connection reliability, overriding FORGE-008 for this task only, then authorised commit and merge. Branch `codex-forge-f012` at `/tmp/bortstack-forge-f012` started from `68432c2`; implementation commit `a9350ac` and record commit `075e2f3` were fast-forward integrated into local `codex` at `075e2f3`. The design skill and Penpot reference distinguish MCP availability, editor connection, and target-verified inspection; the latter gates edits. Recovery preserves the last confirmed design and checks uncertain writes before retrying. The isolated branch and combined `codex` each passed 20 tests, skill validation, installer dry-run, and task ID audit; the diff check passed. No Penpot design, external project, installed skill, or production infrastructure changed. Live editor/browser and Windows validation remain unverified. Human acceptance is required before F012 closes; its worktree remains preserved. No push occurred. FORGE-F012 integration (2026-11-18): Captain requested an isolated worktree for Penpot editor connection reliability, overriding FORGE-008 for this task only, then authorised commit and merge. Branch `codex-forge-f012` at `/tmp/bortstack-forge-f012` started from `68432c2`; implementation commit `a9350ac` and record commit `075e2f3` were fast-forward integrated into local `codex` at `075e2f3`. The design skill and Penpot reference distinguish MCP availability, editor connection, and target-verified inspection; the latter gates edits. Recovery preserves the last confirmed design and checks uncertain writes before retrying. The isolated branch and combined `codex` each passed 20 tests, skill validation, installer dry-run, and task ID audit; the diff check passed. No Penpot design, external project, installed skill, or production infrastructure changed. Live editor/browser and Windows validation remain unverified. Human acceptance is required before F012 closes; its worktree remains preserved. No push occurred.
FORGE-F013 candidate (2026-11-18): Branch `codex-forge-f013` at `/tmp/bortstack-forge-f013`, based on `30f6a69`, targets `codex`. `testtask.sh` now accepts a task ID or exact local branch name and reports the resolved task, branch and existing worktree before the same blocked-runtime exit. It performs no Git mutation. Usage and context reference were updated. On the isolated candidate, 21 tests, skill validation, installer dry-run, task ID audit and diff check passed; a live F013 invocation resolved correctly and exited 3 because Forge has no runtime. Windows and runtime manual testing remain unverified. Captain requested results before merging, so integration and human acceptance remain pending. No push occurred.
+7
View File
@@ -118,6 +118,13 @@ Implementation: The design skill and Penpot operations reference now require a t
Validation (isolated branch and combined `codex`, 2026-11-18): 20 unittest tests passed on both trees, including three focused connection-contract checks; the skill validator accepted all three implemented packages; installer dry-run included `bortstack-design`; task ID audit and `git diff --check` passed. Captain authorised the fast-forward integration. Manual Penpot/browser validation and Windows behavior remain unverified; this task does not close F003's existing external acceptance gates. Next action: obtain human acceptance before marking F012 Complete. The task worktree remains preserved. Validation (isolated branch and combined `codex`, 2026-11-18): 20 unittest tests passed on both trees, including three focused connection-contract checks; the skill validator accepted all three implemented packages; installer dry-run included `bortstack-design`; task ID audit and `git diff --check` passed. Captain authorised the fast-forward integration. Manual Penpot/browser validation and Windows behavior remain unverified; this task does not close F003's existing external acceptance gates. Next action: obtain human acceptance before marking F012 Complete. The task worktree remains preserved.
## FORGE-F013 — Resolve testtask by Task ID or Branch
Status: Testing; isolated candidate, integration pending. Owner: Codex. Baseline: `30f6a69`; branch/worktree: `codex-forge-f013` at `/tmp/bortstack-forge-f013`; target: `codex`. The Captain requested isolation and a validation report before merging, as a task-specific exception to FORGE-008.
Scope: Resolve an existing task ID, including legacy IDs, or an exact local branch name to one task, branch, and worktree. Detect unknown and ambiguous references and missing worktrees. Preserve Forge's blocked manual-test result without creating worktrees, switching branches, or adding a runtime. Update usage and add focused tests. Human acceptance remains pending.
Implementation and validation (2026-11-18): `testtask.sh` delegates read-only lookup to `resolve_testtask.py`; task headings and local branch/worktree inventory are checked before the unchanged blocked-runtime outcome. Tests cover both formats, historical IDs, unknown and malformed input, ambiguous task/branch references, and a missing worktree. On the isolated candidate, 21 tests passed, all three skills validated, installer dry-run passed, task ID audit and diff check passed. A live `testtask.sh FORGE-F013` resolved the current task and exited 3 with the expected blocked-runtime message. Windows and a manual-test runtime remain unverified. Next action: Captain reviews these results before any merge.
## Scheduling ## Scheduling
Start with F002. F003 and F004 can follow F002 independently; F006 can proceed after F001. F007 follows F002. F005 follows F002, F006, and F007. F008 follows F006. F010 follows F002 and F004. F011 builds on F003 without closing its separate acceptance checks. F009 remains deferred until after F005. Dependency readiness does not authorise implementation. Start with F002. F003 and F004 can follow F002 independently; F006 can proceed after F001. F007 follows F002. F005 follows F002, F006, and F007. F008 follows F006. F010 follows F002 and F004. F011 builds on F003 without closing its separate acceptance checks. F009 remains deferred until after F005. Dependency readiness does not authorise implementation.
+83
View File
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""Read-only task, branch and worktree lookup for Forge testtask."""
import re
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
HEADING = re.compile(r"^## ([A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+)\s+[—-]", re.M)
LABEL = re.compile(r"(?:Task )?[Bb]ranch(?:/worktree)?:\s*`([^`]+)`")
USAGE = "Usage: scripts/testtask.sh <task-id|branch-name>"
def git(*args):
return subprocess.check_output(["git", "-C", str(ROOT), *args], text=True).strip()
def records():
content = (ROOT / "docs/TASKS.md").read_text(encoding="utf-8")
headings = list(HEADING.finditer(content))
result = {}
for i, match in enumerate(headings):
end = headings[i + 1].start() if i + 1 < len(headings) else len(content)
result.setdefault(match.group(1), []).append(content[match.end():end])
return result
def task_branches(task_id, section, branches):
slug = task_id.lower()
found = {branch for branch in branches if re.search(rf"(^|[-/]){re.escape(slug)}($|[-/])", branch.lower())}
found.update(branch for branch in LABEL.findall(section) if branch in branches)
return found
def error(message):
print(f"testtask: {message}", file=sys.stderr)
return 2
def main(args):
if args == ["--help"]:
print(USAGE)
print("Resolve an existing task and worktree; Forge has no application runtime or manual-test hook.")
return 0
if len(args) != 1 or not args[0] or args[0].startswith("-"):
print(USAGE, file=sys.stderr)
return 2
identifier = args[0]
tasks = records()
branches = set(git("for-each-ref", "--format=%(refname:short)", "refs/heads").splitlines())
if identifier in tasks:
if len(tasks[identifier]) != 1:
return error(f"ambiguous task ID {identifier}: multiple task records")
task_id = identifier
matches = task_branches(task_id, tasks[task_id][0], branches)
if not matches:
return error(f"task {task_id} has no recorded local task branch")
if len(matches) != 1:
return error(f"ambiguous task {task_id}: branches {', '.join(sorted(matches))}")
branch = next(iter(matches))
elif identifier in branches:
branch = identifier
matches = [task_id for task_id, sections in tasks.items() if any(branch in task_branches(task_id, section, branches) for section in sections)]
if not matches:
return error(f"branch {branch} has no corresponding task record")
if len(matches) != 1 or len(tasks[matches[0]]) != 1:
return error(f"ambiguous branch {branch}: task records {', '.join(sorted(matches))}")
task_id = matches[0]
else:
return error(f"unknown task ID or branch: {identifier}")
paths = []
for block in git("worktree", "list", "--porcelain").split("\n\n"):
lines = block.splitlines()
if f"branch refs/heads/{branch}" not in lines:
continue
path = next((Path(line[9:]) for line in lines if line.startswith("worktree ")), None)
if path and path.is_dir():
paths.append(path)
if not paths:
return error(f"task {task_id} on branch {branch} has no existing worktree")
if len(paths) != 1:
return error(f"ambiguous branch {branch}: multiple worktrees")
print(f"task: {task_id}\nbranch: {branch}\nworktree: {paths[0]}")
print("testtask is provisioned but blocked: Forge has no application runtime or task-specific manual-test hook.", file=sys.stderr)
return 3
if __name__ == "__main__":
raise SystemExit(main(sys.argv[1:]))
+2 -11
View File
@@ -1,13 +1,4 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
if [ "${1:-}" = "--help" ]; then script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
echo 'Usage: scripts/testtask.sh FORGE-F###' exec python3 "$script_dir/resolve_testtask.py" "$@"
echo 'Forge currently has no application runtime or manual-test hook.'
exit 0
fi
case "${1:-}" in
FORGE-F[0-9][0-9][0-9]) ;;
*) echo 'Usage: scripts/testtask.sh FORGE-F###' >&2; exit 2 ;;
esac
echo 'testtask is provisioned but blocked: Forge has no application runtime or task-specific manual-test hook.' >&2
exit 3
@@ -4,6 +4,6 @@ Inspect repository scripts and `AGENTS.md` before use. Preserve a working local
`scripts/create-chatgpt-snapshot.sh` creates a portable ZIP from the **intended source worktree**, including staged, unstaged, and permitted untracked changes. It excludes Git metadata, test worktrees, old snapshots, dependencies, caches, builds, local databases, `.env*`, keys, and credentials. Audit archive contents before sharing. Report path, source branch, and uncommitted state. `scripts/create-chatgpt-snapshot.sh` creates a portable ZIP from the **intended source worktree**, including staged, unstaged, and permitted untracked changes. It excludes Git metadata, test worktrees, old snapshots, dependencies, caches, builds, local databases, `.env*`, keys, and credentials. Audit archive contents before sharing. Report path, source branch, and uncommitted state.
`scripts/testtask.sh <repository-task-id>` prepares or invokes a disposable manual-test candidate for the given task. Determine supported arguments from the repository's script or `--help`. Its candidate must match the source branch's tracked changes and permitted untracked files without forcing a commit or checking the same branch out twice. A stale candidate must be refreshed after edits. Runtime startup, readiness, ports, and cleanup are project-specific. Missing engine or runtime means **provisioned but blocked**, not operational. Never delete unfinished work or unrelated containers. `scripts/testtask.sh <repository-task-id|branch-name>` prepares or invokes a disposable manual-test candidate for the given task when the repository supports both forms. Determine supported arguments from the repository's script or `--help`; historical task IDs remain valid. Resolve the identifier to one task, branch, and existing worktree; report unknown, ambiguous, or missing-worktree cases without guessing. Its candidate must match the source branch's tracked changes and permitted untracked files without forcing a commit or checking the same branch out twice. A stale candidate must be refreshed after edits. Runtime startup, readiness, ports, and cleanup are project-specific. Missing engine or runtime means **provisioned but blocked**, not operational. Never delete unfinished work or unrelated containers.
For new projects, provision both entry points and adapt testtask to the actual stack. For retrofits, inspect and retain working scripts. Keep test artifacts out of Git. Record actual validation and remaining dependencies in handoff. For new projects, provision both entry points and adapt testtask to the actual stack. For retrofits, inspect and retain working scripts. Keep test artifacts out of Git. Record actual validation and remaining dependencies in handoff.
+56
View File
@@ -0,0 +1,56 @@
"""Exercise both testtask identifiers without starting a runtime."""
import subprocess
import tempfile
import unittest
from pathlib import Path
SOURCE = Path(__file__).resolve().parents[1]
def run(*args, cwd=None):
return subprocess.run(args, cwd=cwd, capture_output=True, text=True)
class TesttaskTests(unittest.TestCase):
def test_resolution_and_errors(self):
with tempfile.TemporaryDirectory() as temp:
repo = Path(temp) / "repo"
repo.mkdir()
(repo / "scripts").mkdir()
(repo / "docs").mkdir()
for name in ("testtask.sh", "resolve_testtask.py"):
(repo / "scripts" / name).write_bytes((SOURCE / "scripts" / name).read_bytes())
tasks = repo / "docs/TASKS.md"
tasks.write_text("## TASK-001 — Legacy\nBranch/worktree: `feature-task-001`\n")
self.assertEqual(run("git", "init", "-q", str(repo)).returncode, 0)
run("git", "add", ".", cwd=repo)
run("git", "-c", "user.name=Test", "-c", "user.email=test@example.org", "commit", "-qm", "base", cwd=repo)
worktree = Path(temp) / "task tree"
self.assertEqual(run("git", "worktree", "add", "-qb", "feature-task-001", str(worktree), cwd=repo).returncode, 0)
script = str(repo / "scripts/testtask.sh")
for identifier in ("TASK-001", "feature-task-001"):
with self.subTest(identifier=identifier):
result = run("sh", script, identifier)
self.assertEqual(result.returncode, 3)
self.assertIn("task: TASK-001", result.stdout)
self.assertIn("branch: feature-task-001", result.stdout)
self.assertIn(f"worktree: {worktree}", result.stdout)
self.assertIn("no application runtime", result.stderr)
for args, expected in (((), "Usage:"), (("not-a-task",), "unknown"), (("TASK-001", "extra"), "Usage:")):
with self.subTest(args=args):
result = run("sh", script, *args)
self.assertEqual(result.returncode, 2)
self.assertIn(expected, result.stderr)
run("git", "worktree", "remove", str(worktree), cwd=repo)
result = run("sh", script, "TASK-001")
self.assertEqual(result.returncode, 2)
self.assertIn("no existing worktree", result.stderr)
run("git", "branch", "feature-task-001-review", cwd=repo)
result = run("sh", script, "TASK-001")
self.assertEqual(result.returncode, 2)
self.assertIn("ambiguous task", result.stderr)
tasks.write_text(tasks.read_text() + "## TASK-002 — Other\nBranch/worktree: `feature-task-001`\n")
result = run("sh", script, "feature-task-001")
self.assertEqual(result.returncode, 2)
self.assertIn("ambiguous branch", result.stderr)
if __name__ == "__main__":
unittest.main()