mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
Wave 1: PR-gate turn cut, task search, trace timestamps, Secretary edits + e2e scenarios 2–3 (#295)
* feat(tests): e2e scenario 2 — the PM merge chain through the PR gate
Shared arcs extracted (arcs.py: canonical-company seeding + dev/qa/doc
segments); scenario 2 seeds a root->cell->dev hierarchy mid-flight, rides
the child through the scenario-1 arc into the cell branch (real squash
via the fake GitHub), then submit_up -> claim_gate_review/pr_pass ->
dispatcher re-claim (mirrored) -> PM complete merging cell->root. This is
the exact PM->reviewer->PM turn sequence the wave-1 turn cut shortens —
the BEFORE-net. Learned seams scripted: commit-subject validator (>=20
chars), reviewer learning-note gate, pr_pass clears ownership by design.
* feat(runtime): PR-gate turn cut — assembled parents auto-submit to the reviewer
When every child of an assembled parent is terminal, the closure
dispatcher now runs the real submit_up/submit_root through the internal
API as the owning PM (_try_auto_submit) instead of spawning the PM for
that turn — the submit's substance is deterministic gate code. Any gate
refusal falls back to the classic PM closure spawn; pr_fail routing and
the PM's final merge turn are unchanged; umbrellas never auto-submit.
ROBOCO_PR_GATE_AUTO_SUBMIT_ENABLED default-on; task.auto_submitted audit
row per cut. Proven by e2e scenario 2b (real API, real gates, real git)
against scenario 2 as the before-net.
* feat(notes): structured note sections carry a written_at trace stamp
Sections are overwrite-in-place, so without a stamp there was no way to
reconstruct WHEN a dev/qa/doc/reviewer note landed (CEO reMarkable item:
trace TIMESTAMPS). apply_structured_note stamps ISO written_at beside
the model fields; the panel notes tab renders it next to each card
title (pre-stamp rows render nothing). Progress updates, commits, and
journal entries already carried timestamps — this was the one gap.
* feat(tasks): server-side task search — title, details, and id prefix
The task list's search box only matched titles client-side, and the
trimmed summary payload deliberately carries no description — so
keyword/details/id search was impossible in the browser by design.
GET /tasks/summary gains q (ILIKE over title+description, id-prefix
match, composed with team/status and the view-permission scoping);
the panel debounces the box into the summary fetch and drops the
title-only client filter that would have hidden description matches.
* feat(wave-1): trace timestamps, real task search, Secretary task edits
- apply_structured_note stamps written_at per section; the panel notes
tab shows it (the one trace surface without a timestamp).
- GET /tasks/summary?q= searches title+description+id-prefix server-side
(summaries carry no description by design); panel debounces into the
fetch and drops the title-only client filter.
- Secretary control_task gains a CEO-gated edit action over the content
allowlist, and GET /secretary/tasks?q= resolves task names to ids for
the chat. PM-side expansion deferred per the CEO's 'not that much'.
* fix(workspace): dep-update probe scrubs the inherited venv pin
Under uv run the orchestrator's process tree carries VIRTUAL_ENV, and a
uv-based dep_update_command in the throwaway probe clone would target
that venv instead of the clone's — the same hazard _uv_subprocess_env
already guards on the install path.
* build: private per-repo uv cache — isolate from machine-wide uvx servers
Root cause of the recurring rich/pip/bandit rot, with evidence: uv cache
clean timed out on the ~/.cache/uv lock ('is another uv process
running?') — three uvx mcp-server-fetch processes (Claude Code fetch MCP,
one alive since Wednesday) share that cache and race repo syncs on it;
poisoned entries then survive venv rebuilds because rm -rf .venv never
touches the cache, and every re-link reproduces the breakage. UV_CACHE_DIR
now pins <repo>/.uv-cache (gitignored). The earlier UV_NO_SYNC
serialization stays as defense-in-depth but was not the whole story.
* feat(tests): e2e scenario 3 — pr_fail revision loop + root→CEO chain
3a: reviewer pr_fail with a concrete issue -> needs_revision ->
i_will_plan re-entry (full plan gates) -> real fix lands on the cell
branch (the unchanged-PR hard gate refuses resubmit until it does) ->
clean second pass -> merge. 3b: submit_root -> gate -> Main PM complete
escalates the root to the CEO -> the REAL approve-and-merge endpoint
squash-merges to the origin's master. Harness gains the tasks router, a
seeded CEO identity, origin_commit, and a fake GitHub whose head.sha is
recomputed live (real-GitHub semantics the unchanged gate reads). Seeds
now encode the real shape: delivery roots are team=main_pm and
planning-typed.
---------
Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense, useMemo, useCallback } from "react";
|
||||
import { Suspense, useEffect, useMemo, useCallback, useState } from "react";
|
||||
import { useSearchParams, useRouter } from "next/navigation";
|
||||
import { useTasks } from "@/hooks/use-tasks";
|
||||
import { useProjects } from "@/hooks/use-projects";
|
||||
@@ -160,7 +160,17 @@ function TasksPageContent() {
|
||||
);
|
||||
|
||||
// Fetch all tasks and filter client-side for multi-select
|
||||
const { data: tasks, isLoading, error, refetch } = useTasks();
|
||||
// Debounced server-side search: title + description + id prefix. The
|
||||
// old client-side title-only filter hid description/id matches the
|
||||
// server now returns, so it is gone.
|
||||
const [debouncedQuery, setDebouncedQuery] = useState(searchQuery);
|
||||
useEffect(() => {
|
||||
const handle = setTimeout(() => setDebouncedQuery(searchQuery), 300);
|
||||
return () => clearTimeout(handle);
|
||||
}, [searchQuery]);
|
||||
const { data: tasks, isLoading, error, refetch } = useTasks(
|
||||
debouncedQuery ? { q: debouncedQuery } : undefined,
|
||||
);
|
||||
|
||||
// Projects + products: power the Project/Product filter options + name display.
|
||||
const { data: projects } = useProjects();
|
||||
@@ -191,14 +201,6 @@ function TasksPageContent() {
|
||||
if (!tasks) return [];
|
||||
|
||||
return tasks.filter((task) => {
|
||||
// Search filter
|
||||
if (
|
||||
searchQuery &&
|
||||
!task.title.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Status filter (if any selected, task must match one of them)
|
||||
if (statusFilter.length > 0 && !statusFilter.includes(task.status)) {
|
||||
return false;
|
||||
@@ -239,7 +241,6 @@ function TasksPageContent() {
|
||||
});
|
||||
}, [
|
||||
tasks,
|
||||
searchQuery,
|
||||
statusFilter,
|
||||
teamFilter,
|
||||
taskTypeFilter,
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { TaskStatus, Team, TaskType, type Task } from "@/types";
|
||||
|
||||
// Structured note sections are overwrite-in-place; apply_structured_note
|
||||
// stamps written_at so the panel can show WHEN a trace landed (CEO
|
||||
// reMarkable item: "Task notes and other traces: TIMESTAMPS!").
|
||||
|
||||
vi.mock("@/hooks/use-tasks", () => ({
|
||||
useUpdateTask: () => ({ mutateAsync: vi.fn(), isPending: false }),
|
||||
}));
|
||||
|
||||
vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
|
||||
|
||||
import { TabNotes } from "../tab-notes";
|
||||
|
||||
function buildTask(overrides: Partial<Task> = {}): Task {
|
||||
return {
|
||||
id: "t1",
|
||||
title: "Task",
|
||||
description: "d",
|
||||
status: TaskStatus.IN_PROGRESS,
|
||||
team: Team.BACKEND,
|
||||
task_type: TaskType.CODE,
|
||||
acceptance_criteria: [],
|
||||
...overrides,
|
||||
} as unknown as Task;
|
||||
}
|
||||
|
||||
describe("notes tab written_at stamps", () => {
|
||||
it("shows the section's written_at next to the card title", () => {
|
||||
const task = buildTask({
|
||||
dev_notes: "Built the greeting module.",
|
||||
notes_structured: {
|
||||
developer: {
|
||||
summary: "Built the greeting module.",
|
||||
written_at: "2026-07-02T18:30:00+00:00",
|
||||
},
|
||||
},
|
||||
} as Partial<Task>);
|
||||
const { getByTestId } = render(<TabNotes task={task} />);
|
||||
expect(getByTestId("written-at-dev_notes").textContent).toContain("Jul");
|
||||
});
|
||||
|
||||
it("renders no stamp when the section has none (pre-stamp rows)", () => {
|
||||
const task = buildTask({
|
||||
dev_notes: "Legacy note without a structured stamp.",
|
||||
notes_structured: { developer: { summary: "Legacy note." } },
|
||||
} as Partial<Task>);
|
||||
const { queryByTestId } = render(<TabNotes task={task} />);
|
||||
expect(queryByTestId("written-at-dev_notes")).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -86,6 +86,47 @@ function prReviewCardBg(task: Task): string {
|
||||
);
|
||||
}
|
||||
|
||||
// Mirror-column -> structured-section key (the write-time source of truth).
|
||||
const FIELD_TO_SECTION: Record<NoteField, string> = {
|
||||
quick_context: "resumption",
|
||||
dev_notes: "developer",
|
||||
qa_notes: "qa",
|
||||
auditor_notes: "auditor",
|
||||
pr_reviewer_notes: "pr_review",
|
||||
doc_notes: "doc",
|
||||
};
|
||||
|
||||
// When the section was last written (apply_structured_note stamps it).
|
||||
function writtenAt(task: Task, field: NoteField): string | null {
|
||||
const sections = task.notes_structured as
|
||||
| Record<string, { written_at?: string }>
|
||||
| null
|
||||
| undefined;
|
||||
const stamp = sections?.[FIELD_TO_SECTION[field]]?.written_at;
|
||||
if (!stamp) return null;
|
||||
const date = new Date(stamp);
|
||||
if (Number.isNaN(date.getTime())) return null;
|
||||
return date.toLocaleString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
}
|
||||
|
||||
function WrittenAtStamp({ task, field }: { task: Task; field: NoteField }) {
|
||||
const stamp = writtenAt(task, field);
|
||||
if (!stamp) return null;
|
||||
return (
|
||||
<span
|
||||
className="text-xs font-normal text-muted-foreground ml-2"
|
||||
data-testid={`written-at-${field}`}
|
||||
>
|
||||
{stamp}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
interface NoteCardProps {
|
||||
task: Task;
|
||||
field: NoteField;
|
||||
@@ -193,6 +234,7 @@ function EditableNoteCard({
|
||||
{icon}
|
||||
{title}
|
||||
{badge}
|
||||
<WrittenAtStamp task={task} field={field} />
|
||||
</CardTitle>
|
||||
{isEditing ? (
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -19,6 +19,9 @@ export interface TaskFilters {
|
||||
team?: Team;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
// Server-side search over title, description, and id prefix — summaries
|
||||
// carry no description, so the search must happen on the backend.
|
||||
q?: string;
|
||||
}
|
||||
|
||||
// One board reviewer's decision-log entry for a task (PO or Head of Marketing).
|
||||
@@ -107,6 +110,7 @@ export const tasksApi = {
|
||||
if (filters?.status) params.append("status", filters.status);
|
||||
if (filters?.team) params.append("team", filters.team);
|
||||
if (filters?.limit) params.append("limit", String(filters.limit));
|
||||
if (filters?.q) params.append("q", filters.q);
|
||||
|
||||
const url = "/tasks/summary?" + params.toString();
|
||||
const { data } = await api.get<TaskSummaryWire[]>(url);
|
||||
|
||||
Reference in New Issue
Block a user