0.1.1: the reviewer has no built-in name
- Board text, timelines, the sign-in page and notifications use the name in reviewer.json; nothing says Pandu any more. - Examples and docs use the brand: reviewer "Labuh", bot "labuh-bot", mentions "@labuh". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
14
README.md
14
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**Every deploy request in one harbour. An agent checks it, a person gives the Gas.**
|
**Every deploy request in one harbour. An agent checks it, a person gives the Gas.**
|
||||||
|
|
||||||
Labuh turns merge and deploy requests on GitLab into boats in a harbour. Label an MR `labuh` and a reviewer agent (Pandu, by default) reads it, says GO or NO-GO with evidence you can open, and answers questions in the MR thread. The approver sees every request on one board, on a laptop or a phone, and taps **Gas**: Labuh merges, follows the deploy pipeline, and tells the team when it docked.
|
Labuh turns merge and deploy requests on GitLab into boats in a harbour. Label an MR `labuh` and a reviewer agent (named in `reviewer.json`; the examples call it Labuh) reads it, says GO or NO-GO with evidence you can open, and answers questions in the MR thread. The approver sees every request on one board, on a laptop or a phone, and taps **Gas**: Labuh merges, follows the deploy pipeline, and tells the team when it docked.
|
||||||
|
|
||||||
- **Nothing gets lost.** Every request has a place and a state, instead of a message somewhere in a chat.
|
- **Nothing gets lost.** Every request has a place and a state, instead of a message somewhere in a chat.
|
||||||
- **Evidence before Gas.** Each finding points at a file and line, a pipeline job or a rubric rule, checked by Labuh before anyone sees it.
|
- **Evidence before Gas.** Each finding points at a file and line, a pipeline job or a rubric rule, checked by Labuh before anyone sees it.
|
||||||
@@ -24,7 +24,7 @@ Labuh adds nothing GitLab has to enforce: merge permission stays the gate, so if
|
|||||||
|
|
||||||
| | |
|
| | |
|
||||||
|---|---|
|
|---|---|
|
||||||
| **Agent review** | Each labelled MR is reviewed against your rubric, the repository and (optionally) your team's notes. A new commit updates the same verdict comment; `@pandu why?` in the thread gets an answer. |
|
| **Agent review** | Each labelled MR is reviewed against your rubric, the repository and (optionally) your team's notes. A new commit updates the same verdict comment; `@labuh why?` in the thread gets an answer. |
|
||||||
| **Checked evidence** | The reviewer answers in a fixed shape. Labuh checks every reference (the line exists at that commit, the job belongs to that pipeline, the rule is in the rubric) and applies hard rules the model can't override: a red pipeline or a moved head is never GO. A malformed answer is retried once, then shown as "needs a manual check". |
|
| **Checked evidence** | The reviewer answers in a fixed shape. Labuh checks every reference (the line exists at that commit, the job belongs to that pipeline, the rule is in the rubric) and applies hard rules the model can't override: a red pipeline or a moved head is never GO. A malformed answer is retried once, then shown as "needs a manual check". |
|
||||||
| **The harbour** | One lane per environment (Prod, Staging), three zones: **Dicek**, **Siap gas**, **Beres**. Boats glide between them; the oldest finished boats sail out when the berth is full. |
|
| **The harbour** | One lane per environment (Prod, Staging), three zones: **Dicek**, **Siap gas**, **Beres**. Boats glide between them; the oldest finished boats sail out when the berth is full. |
|
||||||
| **Gas, Tunda, Tolak** | Gas merges the exact commit that was reviewed, after 15 seconds to change your mind. Tunda (hold) and Tolak (reject) take a note the MR thread sees; a rejected MR can be closed from the board. |
|
| **Gas, Tunda, Tolak** | Gas merges the exact commit that was reviewed, after 15 seconds to change your mind. Tunda (hold) and Tolak (reject) take a note the MR thread sees; a rejected MR can be closed from the board. |
|
||||||
@@ -58,7 +58,7 @@ The board speaks Indonesian (ajuan = request, dermaga = environment, berlabuh =
|
|||||||
|
|
||||||
- A GitLab project on gitlab.com and three accounts for Labuh (service accounts work on the Free tier):
|
- A GitLab project on gitlab.com and three accounts for Labuh (service accounts work on the Free tier):
|
||||||
- **a reader** (Reporter) for polling;
|
- **a reader** (Reporter) for polling;
|
||||||
- **the reviewer's bot** (Reporter), named like the reviewer so `@pandu` mentions reach it;
|
- **the reviewer's bot** (Reporter), named like the reviewer so `@labuh` mentions reach it;
|
||||||
- **a merge account** that may merge into your target branches (Maintainer for protected ones). It is used only after an approver's action.
|
- **a merge account** that may merge into your target branches (Maintainer for protected ones). It is used only after an approver's action.
|
||||||
- A **GitLab OAuth application** for the board: scope `read_api`, redirect `https://<your board>/auth/callback`.
|
- A **GitLab OAuth application** for the board: scope `read_api`, redirect `https://<your board>/auth/callback`.
|
||||||
- **Codex** access for the reviewer (an API key for a server).
|
- **Codex** access for the reviewer (an API key for a server).
|
||||||
@@ -102,11 +102,11 @@ docker compose run --rm hub node src/hub-cli.ts check-bot
|
|||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Three containers start: the **hub**, the **reviewer** (Pandu) and the **board**. The board listens on port 4810; put it behind your TLS proxy at the `publicUrl` you configured. The reviewer has no published port. `data/` holds the store (`.work/hub/labuh.db`) and the checkouts, the `reviewer-codex` volume holds Pandu's Codex login and threads: back both up, and run only one Hub per store.
|
Three containers start: the **hub**, the **reviewer** and the **board**. The board listens on port 4810; put it behind your TLS proxy at the `publicUrl` you configured. The reviewer has no published port. `data/` holds the store (`.work/hub/labuh.db`) and the checkouts, the `reviewer-codex` volume holds the reviewer's Codex login and threads: back both up, and run only one Hub per store.
|
||||||
|
|
||||||
Team notes for the reviewer (`knowledge` in `reviewer.json`) are mounted read-only into the hub and the reviewer at the same path; see the commented lines in `compose.yaml`.
|
Team notes for the reviewer (`knowledge` in `reviewer.json`) are mounted read-only into the hub and the reviewer at the same path; see the commented lines in `compose.yaml`.
|
||||||
|
|
||||||
Start with `"mode": "shadow"` and `"gas": {"mode": "dry"}`: Pandu's comments go to `data/.work/hub/outbox/` and Gas only rehearses. Switch to `live` when the reviews look right.
|
Start with `"mode": "shadow"` and `"gas": {"mode": "dry"}`: the reviewer's comments go to `data/.work/hub/outbox/` and Gas only rehearses. Switch to `live` when the reviews look right.
|
||||||
|
|
||||||
### Run it on a laptop
|
### Run it on a laptop
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ On macOS the tokens can live in the Keychain instead of the environment: `labuh-
|
|||||||
|
|
||||||
## Using Labuh
|
## Using Labuh
|
||||||
|
|
||||||
**Developers** label their MR `labuh`, read Pandu's comment, push fixes, and ask `@pandu` in the thread. The board shows them the same harbour, without the buttons.
|
**Developers** label their MR `labuh`, read the reviewer's comment, push fixes, and ask it in the thread (`@labuh` in the examples). The board shows them the same harbour, without the buttons.
|
||||||
|
|
||||||
**Approvers** open the board (or tap the link in a notification), read the verdict and findings, and choose:
|
**Approvers** open the board (or tap the link in a notification), read the verdict and findings, and choose:
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ In Docker, prefix with `docker compose run --rm hub node src/hub-cli.ts …` (or
|
|||||||
|
|
||||||
- gitlab.com only; one reviewer per hub; polling, no webhooks yet.
|
- gitlab.com only; one reviewer per hub; polling, no webhooks yet.
|
||||||
- Linked MRs (a frontend that needs its backend first) are not tracked yet.
|
- Linked MRs (a frontend that needs its backend first) are not tracked yet.
|
||||||
- Labuh does not run post-deploy commands; Pandu lists them for a person.
|
- Labuh does not run post-deploy commands; the reviewer lists them for a person.
|
||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
const BUSY_REFRESH_MS = 5000;
|
const BUSY_REFRESH_MS = 5000;
|
||||||
const META = {
|
const META = {
|
||||||
checking: { zone: 'cek', flag: '#7FA9C4', aria: 'sedang dicek', word: 'Dicek dulu', bg: '#E1EDF1', ink: '#1F4B5E', icon: 'dots' },
|
checking: { zone: 'cek', flag: '#7FA9C4', aria: 'sedang dicek', word: 'Dicek dulu', bg: '#E1EDF1', ink: '#1F4B5E', icon: 'dots' },
|
||||||
fix: { zone: 'cek', flag: '#D9654B', aria: 'ditahan Pandu', word: 'Tahan', bg: '#F8DDD5', ink: '#9A2E1A', icon: 'stop' },
|
fix: { zone: 'cek', flag: '#D9654B', aria: 'ditahan reviewer', word: 'Tahan', bg: '#F8DDD5', ink: '#9A2E1A', icon: 'stop' },
|
||||||
blocked: { zone: 'cek', flag: '#9AA5A8', aria: 'nunggu MR lain', word: 'Nunggu', bg: '#EEF1F0', ink: '#3E4E53', icon: 'link' },
|
blocked: { zone: 'cek', flag: '#9AA5A8', aria: 'nunggu MR lain', word: 'Nunggu', bg: '#EEF1F0', ink: '#3E4E53', icon: 'link' },
|
||||||
manual: { zone: 'cek', flag: '#B7AE9C', aria: 'perlu dicek manual', word: 'Cek manual', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
manual: { zone: 'cek', flag: '#B7AE9C', aria: 'perlu dicek manual', word: 'Cek manual', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
||||||
parked: { zone: 'cek', flag: '#B7AE9C', aria: 'ditunda', word: 'Ditunda', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
parked: { zone: 'cek', flag: '#B7AE9C', aria: 'ditunda', word: 'Ditunda', bg: '#F1EBDF', ink: '#5C5440', icon: 'pause' },
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- reviewer
|
- reviewer
|
||||||
|
|
||||||
# Pandu: Codex app-server, reached only by the Hub. It holds no GitLab token and sees the
|
# The reviewer: Codex app-server, reached only by the Hub. It holds no GitLab token and sees the
|
||||||
# checkouts read-only; the container is its sandbox, and every command it wants to run is
|
# checkouts read-only; the container is its sandbox, and every command it wants to run is
|
||||||
# still put to the Hub's allowlist first.
|
# still put to the Hub's allowlist first.
|
||||||
reviewer:
|
reviewer:
|
||||||
|
|||||||
14
docs/SPEC.md
14
docs/SPEC.md
@@ -9,7 +9,7 @@ This file is the single source of truth. Decisions in §3 are settled; changing
|
|||||||
|
|
||||||
**Problem.** Merge and deploy requests from many developers arrive through chat. Blocker discussions scatter between chat and MR comments, and at peak hour nobody can see which requests are waiting.
|
**Problem.** Merge and deploy requests from many developers arrive through chat. Blocker discussions scatter between chat and MR comments, and at peak hour nobody can see which requests are waiting.
|
||||||
|
|
||||||
**Labuh** turns them into a harbour: every request is a boat. An agent reviewer (Pandu by default) checks each one and says why it may or may not sail, with evidence. A person gives the final **Gas**; Labuh merges, follows the deploy, and says when it docked.
|
**Labuh** turns them into a harbour: every request is a boat. An agent reviewer, named by each install, checks each one and says why it may or may not sail, with evidence. A person gives the final **Gas**; Labuh merges, follows the deploy, and says when it docked.
|
||||||
|
|
||||||
- No request is forgotten or scattered.
|
- No request is forgotten or scattered.
|
||||||
- The review runs without waiting for the approver, so developers fix issues before the approver is free.
|
- The review runs without waiting for the approver, so developers fix issues before the approver is free.
|
||||||
@@ -26,7 +26,7 @@ Every feature must serve at least one:
|
|||||||
|
|
||||||
### v0.1 in one sentence
|
### v0.1 in one sentence
|
||||||
|
|
||||||
Label an MR `labuh`: Pandu reviews it within minutes, the approver sees it as a boat on the board, taps Gas, and the boat sails and docks when the deploy is green.
|
Label an MR `labuh`: the reviewer reviews it within minutes, the approver sees it as a boat on the board, taps Gas, and the boat sails and docks when the deploy is green.
|
||||||
|
|
||||||
## 2. How it fits together
|
## 2. How it fits together
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ Label an MR `labuh`: Pandu reviews it within minutes, the approver sees it as a
|
|||||||
│ SQLite store
|
│ SQLite store
|
||||||
approver ── board (browser, phone) ── Gas / Tunda / Tolak / Rilis ──► store ◄────────┤
|
approver ── board (browser, phone) ── Gas / Tunda / Tolak / Rilis ──► store ◄────────┤
|
||||||
│
|
│
|
||||||
Pandu (Codex app-server, read-only) ◄───────┘
|
reviewer (Codex app-server, read-only) ◄───────┘
|
||||||
Telegram group ◄── notifications
|
Telegram group ◄── notifications
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ Label an MR `labuh`: Pandu reviews it within minutes, the approver sees it as a
|
|||||||
- Polling, not webhooks: it only needs outbound access.
|
- Polling, not webhooks: it only needs outbound access.
|
||||||
|
|
||||||
### Brand
|
### Brand
|
||||||
Terms: ajuan (request), dermaga (environment), antrean (queue), berlabuh (docked). Reviewer persona: Pandu (harbour pilot). Palette: paper `#F6F2EA`, ink `#172B33`, teal `#1F6F78`, buoy `#E8A33D`. UI text is Indonesian.
|
Terms: ajuan (request), dermaga (environment), antrean (queue), berlabuh (docked). The reviewer has no built-in name: each install names it in `reviewer.json`, and examples use the brand, Labuh. Palette: paper `#F6F2EA`, ink `#172B33`, teal `#1F6F78`, buoy `#E8A33D`. UI text is Indonesian.
|
||||||
|
|
||||||
## 4. Non-goals
|
## 4. Non-goals
|
||||||
|
|
||||||
@@ -104,8 +104,8 @@ Each milestone ends with a story the owner acts out; it is done when the story w
|
|||||||
|
|
||||||
| Milestone | Story | Status |
|
| Milestone | Story | Status |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| **0. Pandu can review** | Point Pandu at a real MR from a terminal: a verdict that passes the output contract, evidence that opens, a follow-up in the same thread, a disallowed command refused. | Done |
|
| **0. A review from the terminal** | Point the reviewer at a real MR from a terminal: a verdict that passes the output contract, evidence that opens, a follow-up in the same thread, a disallowed command refused. | Done |
|
||||||
| **1. Pandu reviews on its own** | Label an MR: a verdict comment appears within minutes and updates on push; a mention gets an answer; a broken output ends in "reviewer error"; a restart loses nothing. | Done |
|
| **1. Reviews on its own** | Label an MR: a verdict comment appears within minutes and updates on push; a mention gets an answer; a broken output ends in "reviewer error"; a restart loses nothing. | Done |
|
||||||
| **2. I see the harbour** | Sign in with GitLab and see the real ajuan as boats, on the laptop and the phone; open a finding's evidence; a developer sees the same board read-only. | Done |
|
| **2. I see the harbour** | Sign in with GitLab and see the real ajuan as boats, on the laptop and the phone; open a finding's evidence; a developer sees the same board read-only. | Done |
|
||||||
| **3. Gas, and it berlabuh** | Gas from the phone: it merges, sails and docks when the deploy is green; Tunda and Tolak reach the MR; a failed deploy pings; releases are proposed and tagged. | Done |
|
| **3. Gas, and it berlabuh** | Gas from the phone: it merges, sails and docks when the deploy is green; Tunda and Tolak reach the MR; a failed deploy pings; releases are proposed and tagged. | Done |
|
||||||
| **4. Pairs and the whole team** | Linked MRs (frontend + backend): a NO-GO on one holds the other; every team sends deploy requests through Labuh for a week. | Next |
|
| **4. Pairs and the whole team** | Linked MRs (frontend + backend): a NO-GO on one holds the other; every team sends deploy requests through Labuh for a week. | Next |
|
||||||
@@ -118,7 +118,7 @@ Detailed when it starts. Known shape: `depends_on` stored as data; a NO-GO propa
|
|||||||
|
|
||||||
1. Where the reviewer's per-ajuan notes are written in the team's knowledge base.
|
1. Where the reviewer's per-ajuan notes are written in the team's knowledge base.
|
||||||
2. Who owns the rubric content, and where it lives.
|
2. Who owns the rubric content, and where it lives.
|
||||||
3. Post-deploy commands (for example `php artisan …`): proposed as manual CI jobs that Labuh starts after Gas, not commands Pandu runs.
|
3. Post-deploy commands (for example `php artisan …`): proposed as manual CI jobs that Labuh starts after Gas, not commands the reviewer runs.
|
||||||
4. Webhooks once the board has a public route.
|
4. Webhooks once the board has a public route.
|
||||||
|
|
||||||
## 8. Decision changes
|
## 8. Decision changes
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"label": "labuh",
|
"label": "labuh",
|
||||||
"projects": ["your-group/your-repo"],
|
"projects": ["your-group/your-repo"],
|
||||||
"deployBy": {},
|
"deployBy": {},
|
||||||
"botUsername": "pandu-bot",
|
"botUsername": "labuh-bot",
|
||||||
"gas": { "mode": "dry", "graceSeconds": 15 },
|
"gas": { "mode": "dry", "graceSeconds": 15 },
|
||||||
"notify": { "telegramChatId": null, "boardUrl": "https://labuh.example.com", "remindHours": 4 }
|
"notify": { "telegramChatId": null, "boardUrl": "https://labuh.example.com", "remindHours": 4 }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "labuh",
|
"name": "labuh",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Every deploy request in one harbour: an agent reviews it, a person gives the Gas.",
|
"description": "Every deploy request in one harbour: an agent reviews it, a person gives the Gas.",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "Pandu",
|
"name": "Labuh",
|
||||||
"runtime": "codex-app-server",
|
"runtime": "codex-app-server",
|
||||||
"codexBin": "codex",
|
"codexBin": "codex",
|
||||||
"model": "gpt-6.1-sol",
|
"model": "gpt-6.1-sol",
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ export function createBoard(store: Store, cfg: BoardConfig, projects: string[],
|
|||||||
const viewer = viewerOf(req);
|
const viewer = viewerOf(req);
|
||||||
if (!viewer) {
|
if (!viewer) {
|
||||||
if (url.pathname.startsWith('/api/')) return json(res, 401, { error: 'sign in' });
|
if (url.pathname.startsWith('/api/')) return json(res, 401, { error: 'sign in' });
|
||||||
return page(res, 401, 'Labuh', 'Antrean deploy dan review Pandu. Masuk dengan akun GitLab yang punya akses ke repo-nya.', '<a class="btn" href="/auth/login">Masuk dengan GitLab</a>');
|
return page(res, 401, 'Labuh', `Antrean deploy dan review ${reviewer.name}. Masuk dengan akun GitLab yang punya akses ke repo-nya.`, '<a class="btn" href="/auth/login">Masuk dengan GitLab</a>');
|
||||||
}
|
}
|
||||||
if (url.pathname === '/') return send(res, 200, TYPES['.html'], readFileSync(path.join(STATIC, 'index.html')));
|
if (url.pathname === '/') return send(res, 200, TYPES['.html'], readFileSync(path.join(STATIC, 'index.html')));
|
||||||
if (url.pathname === '/rubric') return send(res, 200, TYPES['.html'], rubricPage(readFileSync(path.resolve(HOME, reviewer.rubric), 'utf8')));
|
if (url.pathname === '/rubric') return send(res, 200, TYPES['.html'], rubricPage(readFileSync(path.resolve(HOME, reviewer.rubric), 'utf8')));
|
||||||
@@ -214,7 +214,7 @@ export function createBoard(store: Store, cfg: BoardConfig, projects: string[],
|
|||||||
const ajuan = store
|
const ajuan = store
|
||||||
.allAjuan()
|
.allAjuan()
|
||||||
.filter((a) => visible(a, cfg, viewer, now))
|
.filter((a) => visible(a, cfg, viewer, now))
|
||||||
.map((a) => viewAjuan(a, store.events(a.id), cfg, viewer, actionState(a), a.deploy_state === 'awaiting_release' && a.target_branch ? store.openRelease(a.project, a.target_branch) ?? null : null));
|
.map((a) => viewAjuan(a, store.events(a.id), cfg, viewer, actionState(a), a.deploy_state === 'awaiting_release' && a.target_branch ? store.openRelease(a.project, a.target_branch) ?? null : null, reviewer.name));
|
||||||
return json(res, 200, { viewer: { username: viewer.username, name: viewer.name, approver: viewer.approver }, reviewer: reviewer.name, lanes: [...cfg.lanes.map((l) => l.name), 'Lainnya'], ajuan, at: new Date(now).toISOString() });
|
return json(res, 200, { viewer: { username: viewer.username, name: viewer.name, approver: viewer.approver }, reviewer: reviewer.name, lanes: [...cfg.lanes.map((l) => l.name), 'Lainnya'], ajuan, at: new Date(now).toISOString() });
|
||||||
}
|
}
|
||||||
const act = url.pathname.match(/^\/api\/ajuan\/(\d+)\/action$/);
|
const act = url.pathname.match(/^\/api\/ajuan\/(\d+)\/action$/);
|
||||||
|
|||||||
@@ -113,11 +113,11 @@ const STATUS: Record<Ajuan['status'], BoardStatus> = {
|
|||||||
closed: 'done',
|
closed: 'done',
|
||||||
};
|
};
|
||||||
|
|
||||||
const REASON: Record<BoardStatus, string> = {
|
const reasons = (reviewer: string): Record<BoardStatus, string> => ({
|
||||||
checking: 'Pandu lagi baca perubahannya.',
|
checking: `${reviewer} lagi baca perubahannya.`,
|
||||||
fix: '',
|
fix: '',
|
||||||
blocked: '',
|
blocked: '',
|
||||||
manual: 'Pandu nggak bisa kasih hasil yang valid. Perlu dicek manual.',
|
manual: `${reviewer} nggak bisa kasih hasil yang valid. Perlu dicek manual.`,
|
||||||
ready: '',
|
ready: '',
|
||||||
gas: '',
|
gas: '',
|
||||||
parked: '',
|
parked: '',
|
||||||
@@ -125,7 +125,7 @@ const REASON: Record<BoardStatus, string> = {
|
|||||||
sailing: 'Sudah di-merge. Pipeline deploy lagi jalan.',
|
sailing: 'Sudah di-merge. Pipeline deploy lagi jalan.',
|
||||||
failed: 'Sudah di-merge, tapi pipeline deploy-nya gagal.',
|
failed: 'Sudah di-merge, tapi pipeline deploy-nya gagal.',
|
||||||
done: 'Sudah di-merge.',
|
done: 'Sudah di-merge.',
|
||||||
};
|
});
|
||||||
|
|
||||||
const ZONE: Record<BoardStatus, Zone> = {
|
const ZONE: Record<BoardStatus, Zone> = {
|
||||||
checking: 'cek', fix: 'cek', blocked: 'cek', manual: 'cek', parked: 'cek',
|
checking: 'cek', fix: 'cek', blocked: 'cek', manual: 'cek', parked: 'cek',
|
||||||
@@ -133,7 +133,7 @@ const ZONE: Record<BoardStatus, Zone> = {
|
|||||||
rejected: 'beres', sailing: 'beres', failed: 'beres', done: 'beres',
|
rejected: 'beres', sailing: 'beres', failed: 'beres', done: 'beres',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Decisions and deploys sit on top of Pandu's verdict.
|
// Decisions and deploys sit on top of the reviewer's verdict.
|
||||||
export function boardStatus(a: Ajuan): BoardStatus {
|
export function boardStatus(a: Ajuan): BoardStatus {
|
||||||
if (a.status === 'closed') {
|
if (a.status === 'closed') {
|
||||||
if (a.closed_state !== 'merged') return 'done';
|
if (a.closed_state !== 'merged') return 'done';
|
||||||
@@ -173,14 +173,14 @@ function publicEvidence(e: Evidence): Evidence {
|
|||||||
|
|
||||||
const VERDICT_WORD: Record<string, string> = { go: 'aman', no_go: 'tahan', waiting: 'nunggu' };
|
const VERDICT_WORD: Record<string, string> = { go: 'aman', no_go: 'tahan', waiting: 'nunggu' };
|
||||||
|
|
||||||
function timelineText(kind: string, result: string | null, author: string | null): string {
|
function timelineText(kind: string, result: string | null, author: string | null, reviewer: string): string {
|
||||||
const r = result ?? '';
|
const r = result ?? '';
|
||||||
const verdict = r.match(/^(go|no_go|waiting) di (\w+)/);
|
const verdict = r.match(/^(go|no_go|waiting) di (\w+)/);
|
||||||
if (kind === 'opened') return verdict ? `Diajukan${author ? ` ${author}` : ''}; Pandu: ${VERDICT_WORD[verdict[1]]}` : `Diajukan${author ? ` ${author}` : ''}`;
|
if (kind === 'opened') return verdict ? `Diajukan${author ? ` ${author}` : ''}; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : `Diajukan${author ? ` ${author}` : ''}`;
|
||||||
if (kind === 'new_commit') return verdict ? `Commit baru ${verdict[2].slice(0, 8)}; Pandu: ${VERDICT_WORD[verdict[1]]}` : 'Commit baru';
|
if (kind === 'new_commit') return verdict ? `Commit baru ${verdict[2].slice(0, 8)}; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : 'Commit baru';
|
||||||
if (kind === 'mention') return r === 'dijawab' ? 'Ditanya; Pandu jawab di MR' : 'Ditanya';
|
if (kind === 'mention') return r === 'dijawab' ? `Ditanya; ${reviewer} jawab di MR` : 'Ditanya';
|
||||||
if (kind === 'closed') return r === 'label dilepas' ? 'Label labuh dilepas' : r === 'MR merged' ? 'Di-merge' : 'MR ditutup';
|
if (kind === 'closed') return r === 'label dilepas' ? 'Label labuh dilepas' : r === 'MR merged' ? 'Di-merge' : 'MR ditutup';
|
||||||
if (kind === 'recheck') return verdict ? `Rubrik berubah; Pandu: ${VERDICT_WORD[verdict[1]]}` : 'Rubrik berubah, dicek ulang';
|
if (kind === 'recheck') return verdict ? `Rubrik berubah; ${reviewer}: ${VERDICT_WORD[verdict[1]]}` : 'Rubrik berubah, dicek ulang';
|
||||||
if (kind === 'gas') return r.startsWith('di-merge') ? 'Gas; di-merge' : r.startsWith('uji coba') ? 'Gas (uji coba)' : r.startsWith('dibatalkan') ? 'Gas dibatalkan' : r ? `Gas tidak jalan: ${r.replace(/^(ditolak|failed): /, '')}` : 'Gas';
|
if (kind === 'gas') return r.startsWith('di-merge') ? 'Gas; di-merge' : r.startsWith('uji coba') ? 'Gas (uji coba)' : r.startsWith('dibatalkan') ? 'Gas dibatalkan' : r ? `Gas tidak jalan: ${r.replace(/^(ditolak|failed): /, '')}` : 'Gas';
|
||||||
if (kind === 'close') return r === 'MR ditutup' ? 'MR ditutup' : r.startsWith('dibatalkan') ? 'Tutup MR dibatalkan' : r.startsWith('uji coba') ? 'Tutup MR (uji coba)' : r ? `MR tidak ditutup: ${r.replace(/^(dilewati|failed): /, '')}` : 'Tutup MR';
|
if (kind === 'close') return r === 'MR ditutup' ? 'MR ditutup' : r.startsWith('dibatalkan') ? 'Tutup MR dibatalkan' : r.startsWith('uji coba') ? 'Tutup MR (uji coba)' : r ? `MR tidak ditutup: ${r.replace(/^(dilewati|failed): /, '')}` : 'Tutup MR';
|
||||||
if (kind === 'decided') return r.startsWith('dibatalkan') ? 'Keputusan dibatalkan' : r === 'diumumkan: tunda' ? 'Ditunda' : r === 'diumumkan: tolak' ? 'Ditolak' : r === 'diumumkan: undo' ? 'Keputusan dibatalkan' : 'Keputusan';
|
if (kind === 'decided') return r.startsWith('dibatalkan') ? 'Keputusan dibatalkan' : r === 'diumumkan: tunda' ? 'Ditunda' : r === 'diumumkan: tolak' ? 'Ditolak' : r === 'diumumkan: undo' ? 'Keputusan dibatalkan' : 'Keputusan';
|
||||||
@@ -194,6 +194,7 @@ export function viewAjuan(
|
|||||||
viewer: Viewer,
|
viewer: Viewer,
|
||||||
act: ActionState = { taken: false, gasQueuedAt: null, graceSeconds: 15, allowed: [], dry: false },
|
act: ActionState = { taken: false, gasQueuedAt: null, graceSeconds: 15, allowed: [], dry: false },
|
||||||
release: Release | null = null,
|
release: Release | null = null,
|
||||||
|
reviewer = 'Labuh',
|
||||||
): AjuanView {
|
): AjuanView {
|
||||||
const verdict: Checked | null = a.verdict_json ? JSON.parse(a.verdict_json) : null;
|
const verdict: Checked | null = a.verdict_json ? JSON.parse(a.verdict_json) : null;
|
||||||
const status = boardStatus(a);
|
const status = boardStatus(a);
|
||||||
@@ -217,7 +218,7 @@ export function viewAjuan(
|
|||||||
lane: laneOf(a.target_branch, cfg),
|
lane: laneOf(a.target_branch, cfg),
|
||||||
zone,
|
zone,
|
||||||
status,
|
status,
|
||||||
reason: (rel && releaseReason(rel, act.dry)) ?? decisionReason(a, status, dry, gasAt !== null) ?? verdictReason ?? REASON[status],
|
reason: (rel && releaseReason(rel, act.dry)) ?? decisionReason(a, status, dry, gasAt !== null) ?? verdictReason ?? reasons(reviewer)[status],
|
||||||
findings: showVerdict ? verdict!.findings.map((f) => ({ kind: f.kind, text: f.text, evidence: f.evidence.map(publicEvidence) })) : [],
|
findings: showVerdict ? verdict!.findings.map((f) => ({ kind: f.kind, text: f.text, evidence: f.evidence.map(publicEvidence) })) : [],
|
||||||
postDeploy: showVerdict ? verdict!.postDeploy.map((p) => ({ text: p.text, evidence: p.evidence.map(publicEvidence) })) : [],
|
postDeploy: showVerdict ? verdict!.postDeploy.map((p) => ({ text: p.text, evidence: p.evidence.map(publicEvidence) })) : [],
|
||||||
overrides: showVerdict ? verdict!.overrides : [],
|
overrides: showVerdict ? verdict!.overrides : [],
|
||||||
@@ -226,7 +227,7 @@ export function viewAjuan(
|
|||||||
tokens: a.tokens,
|
tokens: a.tokens,
|
||||||
since: a.created_at,
|
since: a.created_at,
|
||||||
dockedAt: (a.status !== 'closed' && a.decision === 'tolak' ? a.decision_at : a.status_at) ?? a.updated_at,
|
dockedAt: (a.status !== 'closed' && a.decision === 'tolak' ? a.decision_at : a.status_at) ?? a.updated_at,
|
||||||
timeline: events.filter((e) => e.done_at || e.kind === 'opened').map((e) => ({ at: e.done_at ?? e.created_at, text: timelineText(e.kind, e.result, a.author) })),
|
timeline: events.filter((e) => e.done_at || e.kind === 'opened').map((e) => ({ at: e.done_at ?? e.created_at, text: timelineText(e.kind, e.result, a.author, reviewer) })),
|
||||||
mine,
|
mine,
|
||||||
needsYou: viewer.approver ? status === 'ready' || status === 'failed' || rel?.state === 'proposed' : mine && (status === 'fix' || status === 'manual' || status === 'rejected'),
|
needsYou: viewer.approver ? status === 'ready' || status === 'failed' || rel?.state === 'proposed' : mine && (status === 'fix' || status === 'manual' || status === 'rejected'),
|
||||||
decision: a.decision ? { kind: a.decision, by: a.decision_by ?? '', at: a.decision_at ?? '', note: a.decision_note } : null,
|
decision: a.decision ? { kind: a.decision, by: a.decision_by ?? '', at: a.decision_at ?? '', note: a.decision_note } : null,
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export class CodexClient {
|
|||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
await this.request('initialize', {
|
await this.request('initialize', {
|
||||||
clientInfo: { name: 'labuh', title: 'Labuh', version: '0.1.0' },
|
clientInfo: { name: 'labuh', title: 'Labuh', version: '0.1.1' },
|
||||||
capabilities: { experimentalApi: false, requestAttestation: false },
|
capabilities: { experimentalApi: false, requestAttestation: false },
|
||||||
});
|
});
|
||||||
this.send({ method: 'initialized' });
|
this.send({ method: 'initialized' });
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export class Hub {
|
|||||||
private newCommitClearsDecision(a: Ajuan) {
|
private newCommitClearsDecision(a: Ajuan) {
|
||||||
if (!a.decision || !this.store.cancelActions(a.id, 'dibatalkan: commit baru')) return;
|
if (!a.decision || !this.store.cancelActions(a.id, 'dibatalkan: commit baru')) return;
|
||||||
this.store.update(a.id, { decision: null, decision_by: null, decision_at: null, decision_note: null, deploy_state: a.deploy_state === 'dry' ? null : a.deploy_state });
|
this.store.update(a.id, { decision: null, decision_by: null, decision_at: null, decision_note: null, deploy_state: a.deploy_state === 'dry' ? null : a.deploy_state });
|
||||||
if (a.decision === 'gas') this.notify(`gas-dropped:${a.id}:${a.decision_at}`, a, `↩️ Gas ${this.label(a)} batal: ada commit baru, Pandu review ulang.`);
|
if (a.decision === 'gas') this.notify(`gas-dropped:${a.id}:${a.decision_at}`, a, `↩️ Gas ${this.label(a)} batal: ada commit baru, ${this.reviewer.name} review ulang.`);
|
||||||
this.log(`${a.project} !${a.iid}: keputusan ${a.decision} gugur karena commit baru`);
|
this.log(`${a.project} !${a.iid}: keputusan ${a.decision} gugur karena commit baru`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ function knowledgeFor(r: Reviewer, projectPath: string): string[] {
|
|||||||
return [own, ...shared].filter((p) => existsSync(p));
|
return [own, ...shared].filter((p) => existsSync(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pandu gets its own CODEX_HOME so the operator's personal Codex config (MCP servers,
|
// The reviewer gets its own CODEX_HOME so the operator's personal Codex config (MCP servers,
|
||||||
// instructions, skills) never leaks into reviews. Locally it borrows the operator's login.
|
// instructions, skills) never leaks into reviews. Locally it borrows the operator's login.
|
||||||
function codexHome(): string {
|
function codexHome(): string {
|
||||||
const dir = path.join(HOME, '.codex-home');
|
const dir = path.join(HOME, '.codex-home');
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ test('the timeline reads as people talk', () => {
|
|||||||
store.enqueue(a.id, 'mention', {});
|
store.enqueue(a.id, 'mention', {});
|
||||||
store.finishEvent(store.nextEvent()!.id, 'dijawab');
|
store.finishEvent(store.nextEvent()!.id, 'dijawab');
|
||||||
const v = viewAjuan(store.ajuanById(a.id), store.events(a.id), cfg, sen);
|
const v = viewAjuan(store.ajuanById(a.id), store.events(a.id), cfg, sen);
|
||||||
assert.deepEqual(v.timeline.map((t) => t.text), ['Diajukan raka; Pandu: tahan', 'Ditanya; Pandu jawab di MR']);
|
assert.deepEqual(v.timeline.map((t) => t.text), ['Diajukan raka; Labuh: tahan', 'Ditanya; Labuh jawab di MR']);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function serve(store: Store, c: BoardConfig, devUser?: string) {
|
async function serve(store: Store, c: BoardConfig, devUser?: string) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { viewAjuan } from '../src/boardview.ts';
|
|||||||
import type { Note } from '../src/gitlab.ts';
|
import type { Note } from '../src/gitlab.ts';
|
||||||
import type { Checked } from '../src/contract.ts';
|
import type { Checked } from '../src/contract.ts';
|
||||||
|
|
||||||
const reviewer: Reviewer = { name: 'Pandu', codexBin: '', model: 'm', effort: 'medium', rubric: 'rubric/rubric.md', budgetTokensPerAjuan: 1000, pricingPer1MTokens: null, knowledge: null };
|
const reviewer: Reviewer = { name: 'Labuh', codexBin: '', model: 'm', effort: 'medium', rubric: 'rubric/rubric.md', budgetTokensPerAjuan: 1000, pricingPer1MTokens: null, knowledge: null };
|
||||||
const PROJECT = 'acme/api';
|
const PROJECT = 'acme/api';
|
||||||
const checked = (verdict: Checked['verdict'], reason: string): Checked => ({
|
const checked = (verdict: Checked['verdict'], reason: string): Checked => ({
|
||||||
verdict,
|
verdict,
|
||||||
@@ -125,7 +125,7 @@ const ok = (c: Checked) => () => ({ ok: true, checked: c, attempts: 1, turns: []
|
|||||||
test('labelled MR is reviewed once, a new commit updates the same comment in the same thread', async () => {
|
test('labelled MR is reviewed once, a new commit updates the same comment in the same thread', async () => {
|
||||||
const w = world();
|
const w = world();
|
||||||
w.gl.mrs.set(5, { sha: 'aaaa1111', state: 'opened', labels: ['labuh'] });
|
w.gl.mrs.set(5, { sha: 'aaaa1111', state: 'opened', labels: ['labuh'] });
|
||||||
w.gl.notes.set(5, [{ id: 1, body: '@pandu old question before Labuh', author: 'dev', system: false, createdAt: '' }]);
|
w.gl.notes.set(5, [{ id: 1, body: '@labuh old question before Labuh', author: 'dev', system: false, createdAt: '' }]);
|
||||||
w.script(ok(checked('no_go', 'API naik sebelum migrasi')), ok(checked('go', 'Urutan sudah benar')));
|
w.script(ok(checked('no_go', 'API naik sebelum migrasi')), ok(checked('go', 'Urutan sudah benar')));
|
||||||
|
|
||||||
await w.hub.poll();
|
await w.hub.poll();
|
||||||
@@ -165,13 +165,13 @@ test('mentions are answered in the thread without changing the verdict; own note
|
|||||||
await w.hub.poll();
|
await w.hub.poll();
|
||||||
await w.hub.drain();
|
await w.hub.drain();
|
||||||
w.gl.notes.set(6, [
|
w.gl.notes.set(6, [
|
||||||
{ id: 10, body: `${VERDICT_MARKER}\n### 🔴 Tahan — @pandu`, author: 'someone', system: false, createdAt: '' },
|
{ id: 10, body: `${VERDICT_MARKER}\n### 🔴 Tahan — @labuh`, author: 'someone', system: false, createdAt: '' },
|
||||||
{ id: 11, body: 'added 1 commit @pandu', author: 'dev', system: true, createdAt: '' },
|
{ id: 11, body: 'added 1 commit @labuh', author: 'dev', system: true, createdAt: '' },
|
||||||
{ id: 12, body: '@Pandu kenapa ini tahan?', author: 'dev', system: false, createdAt: '' },
|
{ id: 12, body: '@Labuh kenapa ini tahan?', author: 'dev', system: false, createdAt: '' },
|
||||||
]);
|
]);
|
||||||
await w.hub.poll();
|
await w.hub.poll();
|
||||||
await w.hub.drain();
|
await w.hub.drain();
|
||||||
assert.deepEqual(w.calls.ask, ['@Pandu kenapa ini tahan?']);
|
assert.deepEqual(w.calls.ask, ['@Labuh kenapa ini tahan?']);
|
||||||
const a = w.store.ajuan(PROJECT, 6)!;
|
const a = w.store.ajuan(PROJECT, 6)!;
|
||||||
assert.equal(a.status, 'no_go');
|
assert.equal(a.status, 'no_go');
|
||||||
const reply = w.store.outbox(a.id).find((o) => o.kind === 'reply')!;
|
const reply = w.store.outbox(a.id).find((o) => o.kind === 'reply')!;
|
||||||
@@ -267,7 +267,7 @@ test('merged MRs and removed labels close the ajuan; budget stops further review
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('live mode posts one verdict comment and edits it afterwards', async () => {
|
test('live mode posts one verdict comment and edits it afterwards', async () => {
|
||||||
const w = world({ mode: 'live', botUsername: 'pandu_bot' });
|
const w = world({ mode: 'live', botUsername: 'labuh_bot' });
|
||||||
w.gl.mrs.set(14, { sha: 'a1', state: 'opened', labels: ['labuh'] });
|
w.gl.mrs.set(14, { sha: 'a1', state: 'opened', labels: ['labuh'] });
|
||||||
w.script(ok(checked('no_go', 'Tahan')), ok(checked('go', 'Aman')));
|
w.script(ok(checked('no_go', 'Tahan')), ok(checked('go', 'Aman')));
|
||||||
await w.hub.poll();
|
await w.hub.poll();
|
||||||
|
|||||||
Reference in New Issue
Block a user