---
title: "Would You Merge This?"
description: "Inspect four recorded runs, trace the outcomes a trustworthy factory needs, and prepare the local starter repository."
canonical_url: "https://vercel.com/academy/creating-a-software-factory/would-you-merge-this"
md_url: "https://vercel.com/academy/creating-a-software-factory/would-you-merge-this.md"
docset_id: "vercel-academy"
doc_version: "1.0"
last_updated: "2026-08-29T01:48:00.491Z"
content_type: "lesson"
course: "creating-a-software-factory"
course_title: "Creating a Software Factory"
prerequisites:  []
---

<agent-instructions>
Vercel Academy — structured learning, not reference docs.
Lessons are sequenced.
Adapt commands to the human's actual environment (OS, package manager, shell, editor) — detect from project context or ask, don't assume.
The lesson shows one path; if the human's project diverges, adapt concepts to their setup.
Preserve the learning goal over literal steps.
Quizzes are pedagogical — engage, don't spoil.
Quiz answers are included for your reference.
</agent-instructions>

# Would You Merge This?

# Would you merge this?

Four agent-authored changes reach the review queue together. You still have to decide what is safe.

```text
Uppercase channel names fail   → fix
Clarify webhook retries        → ask a question
Empty messages are delivered   → stop
Add delivery priority          → wait for a person
```

Not every request should become a pull request. The next action depends on the available evidence and the uncertainty that remains.

## Give the Factory Four Honest Exits

Build a command that traces four issues through four different factory outcomes.

## Hands-on Exercise 1.1

### Create your course repository

The [course starter](https://github.com/vercel-labs/academy-software-factory) has two branches:

- `main` is the starter branch you will modify throughout the course.
- `solution` contains the completed project for reference. Complete the exercises on `main`.

Two repositories appear in the workflow:

| Repository                             | Purpose                                                                                                    |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `vercel-labs/academy-software-factory` | The upstream course template and reference branches.                                                       |
| Your personal fork                     | The repository the factory clones, changes on `factory/*` branches, and opens draft pull requests against. |

Create your GitHub copy and Vercel project:

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Facademy-software-factory\&project-name=signalworks-software-factory\&repository-name=signalworks-software-factory)

The button creates a repository in your GitHub account and connects it to a Vercel project. If you prefer to fork manually, fork the starter on GitHub and import that fork into a new Vercel project.

Clone **your copy**, then confirm that it is on `main`:

```bash
git clone https://github.com/YOUR_GITHUB_NAME/signalworks-software-factory.git
cd signalworks-software-factory
git switch main
pnpm install
```

The project starts small:

```text
agent/                         # eve agent, channels, policies, and stations
fixtures/issues/               # prompts for the four course cases
fixtures/runs/                 # recorded outcomes used before live model calls
packages/notification-sdk/     # sample TypeScript product the factory maintains
evals/                         # regression evaluations added in Section 5
```

### Trace the four outcomes

Read each issue before its recording. Predict where it should finish and what evidence would change your answer.

Now add the trace command to `package.json`:

```json title="package.json"
{
  "scripts": {
    "trace": "node scripts/trace-work-order.mjs"
  }
}
```

Keep the existing scripts. The shortened object shows the new entry only.

Create `scripts/trace-work-order.mjs`. Load every JSON recording instead of hard-coding one issue:

```js title="scripts/trace-work-order.mjs"
import { readdir, readFile } from "node:fs/promises";

const runsUrl = new URL("../fixtures/runs/", import.meta.url);
const files = (await readdir(runsUrl))
  .filter((file) => file.endsWith(".json"))
  .sort();

for (const file of files) {
  const run = JSON.parse(await readFile(new URL(file, runsUrl), "utf8"));
  console.log(`${run.workOrderId}: ${run.issue.title} [${run.outcome}]`);

  for (const [index, event] of run.events.entries()) {
    const step = String(index + 1).padStart(2, "0");
    const station = event.station.toUpperCase().padEnd(12);
    console.log(`${step} ${station} ${event.status}`);
    console.log(`   ${event.summary}`);
  }

  console.log();
}
```

`import.meta.url` keeps the fixture path relative to the script.

Before running it, inspect `issue-44.json`. Routing accepts a plausible bug; investigation disproves it.

Run the trace now:

```bash
pnpm trace
```

The output should show four outcomes:

```text
issue-42: Uppercase channel names fail [fix]
issue-43: Clarify webhook retries [clarify]
issue-44: Empty messages are delivered [reject-premise]
issue-45: Add delivery priority [human-judgment]
```

Find the earliest divergence. The unclear request stops at routing, the false premise reaches investigation, and the public API request waits after specification.

\*\*Note: Move one boundary\*\*

Change issue 45's final status from `awaiting-approval` to `building`, then run the trace again. What decision has the factory silently taken away from the reviewer? Restore the recording when you finish.

\*\*Warning: Only one issue appears\*\*

Read the directory with `readdir(runsUrl)` and loop over every `.json` file. A path to `issue-42.json` preserves the old single-case version.

\*\*Warning: The trace order changes\*\*

Call `.sort()` after filtering the filenames so the trace order is deterministic.

## Try It

Verify the local project:

```bash
pnpm validate
```

`pnpm validate` should finish with zero diagnostics. Section 3 connects the services immediately before the first live invocation.

## Commit

```bash
git add package.json scripts/trace-work-order.mjs
git commit -m "feat(factory): trace four outcomes"
```

## Done-When

- [ ] `pnpm trace` prints all four work orders
- [ ] The unclear request stops before investigation
- [ ] The false premise stops after repository evidence arrives
- [ ] The public API request pauses before implementation
- [ ] The recordings show only independently verified work reaching draft pull request approval
- [ ] `pnpm validate` reports zero diagnostics

The first factory success changed zero files. Now we can give every future decision a durable record.

## Solution

The exercise contains the complete `package.json` entry and `scripts/trace-work-order.mjs`. Your result should match the four headings in **Trace the four outcomes**.


---

[Full course index](/academy/llms.txt) · [Sitemap](/academy/sitemap.md)
