Keyrxng

Command Start/Stop: Assignee manager for issues

Ubiquity OS · 2024 · Start and stop work from issue comments with wallet and limits enforcement; workerized, tested, and CI-ready.

So what?
<1d turnaround delivery
Role
Engineer
Year
2024
Stack
TypeScript, GitHub API (Octokit), Supabase, Cloudflare Workers, GitHub Actions, Jest
Read narrative
<1d turnaround delivery

Problem

Hunters needed a simple way to start/stop work from issue comments without risking unintended XP penalties. The system also had to enforce prerequisites (e.g., registered wallet) and limits.

Approach

System diagram

flowchart LR
  Client[Client Comment] --> Webhook[GitHub Webhook]
  Webhook --> Kernel[UbiquityOS Kernel]
  Kernel --> Parser[Command Parser]
  Parser --> Validation[Validation Layer]
  Validation --> DB[Supabase Database]
  DB --> Assignment[Assignment Logic]
  Assignment --> Response[GitHub API Response]

Outcome

Constraints

Design choices

Proof

Code excerpt — core start/stop branching with wallet guard

// handlers (trimmed)
if (command === "start") {
  if (!userWallet && config.startRequiresWallet) {
    throw new Error("Wallet required to start tasks");
  }
  await assignUserToIssue(context, issue, user);
} else if (command === "stop") {
  await unassignUserFromIssue(context, issue, user);
  await closeLinkedPullRequests(context, issue, user);
}

Code excerpt — Supabase helper for wallet lookup

export async function getUserWallet(userId: number): Promise<string | null> {
  const { data, error } = await supabase
    .from("wallets")
    .select("address")
    .eq("user_id", userId)
    .single();
  if (error || !data) return null;
  return data.address;
}

CI and review evidence — workflow and coverage (trimmed)

All checks passed. Corepack/yarn version aligned; coverage reported.
Merged with multi-review iteration.

References