Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,24 @@ This command automatically regenerates each fixture’s `expected.*` file using
Think of it like Jest’s snapshot updates:

> _You write a fixture once, and snapshot mode keeps it healthy whenever the spec evolves._

# Exceptions
## Documentation-Only Patch Rule
-----------------------------
Documentation-only or comment-only patches are explicitly permitted when the architect clearly requests documentation improvements (e.g., TSDoc, README updates, inline comments). Such patches remain subject to all other rules: minimal, atomic, no forbidden paths, and no runtime behavior changes.


## Configuration & Non-Source File Safety Rule
-------------------------------------------
When a task requires modifying configuration, environment, workflow, or other normally-forbidden files, the architect MUST:

1. Explicitly list *every* configuration or non-source file that is permitted
to be modified for this task (e.g., .github/workflows/ci.yml,
config/staging.json, migrations/001-add-users.sql).

2. Reaffirm that all other configuration, environment, or non-source files
remain forbidden. No sibling files or directories are implicitly allowed.

This explicit-file-whitelist requirement ensures the planner, coder, and reviewer
operate with a deterministic and safe scope, preventing accidental or speculative
changes outside the architect’s intent.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"feasibility": "feasible",
"highLevelSummary": "Fix type mismatch in `src/main.ts` by assigning a number to `retries` instead of a string.",
"complexity": "low",
"pagesOrScreens": [],
"apis": [],
"dataModels": [],
"recommendedFileStructure": [
"src/main.ts"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
You are a senior software architect.

## Context
The build is failing with a TypeScript error:
`src/main.ts:10:5 - error TS2322: Type 'string' is not assignable to type 'number'.`

## Files
`src/main.ts`:
```ts
interface Config {
retries: number;
}

const config: Config = {
retries: "3" // Error here
};
```

## Task
Diagnose and describe the fix for this build error.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
verifyArchitect,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyArchitect(ctx, (spec) => {
const summary = spec.highLevelSummary.toLowerCase();
if (!summary.includes("type mismatch") && !summary.includes("number")) {
return { ok: false, reason: "Must mention type error fix" };
}
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/src/main.ts b/src/main.ts
index 1234567..8901234 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -4,5 +4,5 @@

const config: Config = {
- retries: "3" // Error here
+ retries: 3
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
You are a senior developer.

## Task
Fix the TS error in `src/main.ts`.

## Files
`src/main.ts`:
```ts
interface Config {
retries: number;
}

const config: Config = {
retries: "3" // Error here
};
```

## Constraints
- Return a unified diff.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
verifyCoder,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyCoder(ctx, (patch) => {
// Check that we are adding the number
if (!patch.includes("retries: 3")) return { ok: false, reason: "Must set number value" };

// Check that we are NOT adding the string (simple string check would match deleted line)
// So we look for the line starting with +
if (patch.includes('+ retries: "3"')) return { ok: false, reason: "Must not use string value" };

return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tasks": [
{
"id": "fix-type-error",
"type": "fix",
"description": "Change retries value from string '3' to number 3 in src/main.ts",
"complexity": "low",
"file": "src/main.ts",
"dependsOn": []
}
],
"ambiguities": [],
"invalidTaskCount": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
You are a tech lead dealing with a broken build.

## Context
Architect's Summary: "Fix type mismatch in `src/main.ts` by assigning a number to `retries` instead of a string."

## Files
`src/main.ts`:
```ts
interface Config {
retries: number;
}

const config: Config = {
retries: "3" // Error here
};
```

## Task
Plan the fix.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
verifyPlanner,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyPlanner(ctx, (out) => {
if (out.tasks.length !== 1) return { ok: false, reason: "Should have 1 task" };
if (out.tasks[0].file !== "src/main.ts") return { ok: false, reason: "Target file mismatch" };
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"decision": "approve",
"comments": [
{
"message": "Correct fix. Type mismatch resolved.",
"path": "src/main.ts",
"line": 5,
"blocking": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
You are a senior code reviewer.

## Task
Review the build fix.

## Patch
```diff
diff --git a/src/main.ts b/src/main.ts
index 1234567..8901234 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -4,5 +4,5 @@

const config: Config = {
- retries: "3" // Error here
+ retries: 3
};
```

## Considerations
- Does it fix the type error?
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
verifyReviewer,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyReviewer(ctx, (output) => {
if (output.decision !== "approve") return { ok: false, reason: "Should approve" };
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"feasibility": "feasible",
"highLevelSummary": "Fix race condition in `test/flaky.test.js` by awaiting the async `fetchData` call.",
"complexity": "low",
"pagesOrScreens": [],
"apis": [],
"dataModels": [],
"recommendedFileStructure": [
"test/flaky.test.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
You are a senior software architect.

## Context
The test `test/flaky.test.js` is flakey. It fails about 50% of the time.
It seems to be a race condition where the test checks for the result before the async operation completes.

## Files
`test/flaky.test.js`:
```js
test('fetches data', () => {
const data = fetchData();
expect(data).toBe('success');
});
```

## Task
Describe how to fix the test to be deterministic.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
verifyArchitect,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyArchitect(ctx, (spec) => {
const summary = spec.highLevelSummary.toLowerCase();
if (!summary.includes("await") && !summary.includes("async")) {
return { ok: false, reason: "Must mention async/await fix" };
}
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/test/flaky.test.js b/test/flaky.test.js
index 1234567..8901234 100644
--- a/test/flaky.test.js
+++ b/test/flaky.test.js
@@ -1,4 +1,4 @@
-test('fetches data', () => {
- const data = fetchData();
+test('fetches data', async () => {
+ const data = await fetchData();
expect(data).toBe('success');
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
You are a senior developer.

## Task
Fix the flaky test in `test/flaky.test.js`.

## Files
`test/flaky.test.js`:
```js
test('fetches data', () => {
const data = fetchData();
expect(data).toBe('success');
});
```

## Constraints
- Return a unified diff.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
verifyCoder,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyCoder(ctx, (patch) => {
if (!patch.includes("async")) return { ok: false, reason: "Must make test async" };
if (!patch.includes("await")) return { ok: false, reason: "Must await promise" };
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"tasks": [
{
"id": "fix-race-condition",
"type": "fix",
"description": "Update test/flaky.test.js to use async/await for fetchData",
"complexity": "low",
"file": "test/flaky.test.js",
"dependsOn": []
}
],
"ambiguities": [],
"invalidTaskCount": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
You are a tech lead dealing with a flaky test.

## Context
Architect's Summary: "Fix race condition in `test/flaky.test.js` by awaiting the async `fetchData` call."

## Files
`test/flaky.test.js`:
```js
test('fetches data', () => {
const data = fetchData();
expect(data).toBe('success');
});
```

## Task
Plan the fix.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {
verifyPlanner,
type VerifyCtx,
type VerifyResult,
} from "@kit/fixture-helpers";

export function verify(ctx: VerifyCtx): VerifyResult {
return verifyPlanner(ctx, (out) => {
if (out.tasks.length !== 1) return { ok: false, reason: "Should have 1 task" };
if (out.tasks[0].file !== "test/flaky.test.js") return { ok: false, reason: "Target file mismatch" };
return { ok: true };
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"decision": "approve",
"comments": [
{
"message": "Correct fix. Awaiting the promise ensures the test waits for completion.",
"path": "test/flaky.test.js",
"line": 1,
"blocking": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
You are a senior code reviewer.

## Task
Review the flaky test fix.

## Patch
```diff
diff --git a/test/flaky.test.js b/test/flaky.test.js
index 1234567..8901234 100644
--- a/test/flaky.test.js
+++ b/test/flaky.test.js
@@ -1,4 +1,4 @@
-test('fetches data', () => {
- const data = fetchData();
+test('fetches data', async () => {
+ const data = await fetchData();
expect(data).toBe('success');
});
```

## Considerations
- Does it fix the race condition?
Loading