Skip to content

feat(projects): edit existing registered projects#16

Merged
nathanwhit merged 1 commit into
nathanwhit:mainfrom
nathanwhitbot:orcha/impl-ff08f8d4
Jun 15, 2026
Merged

feat(projects): edit existing registered projects#16
nathanwhit merged 1 commit into
nathanwhit:mainfrom
nathanwhitbot:orcha/impl-ff08f8d4

Conversation

@nathanwhitbot

Copy link
Copy Markdown
Contributor

Summary

Closes #15.

Previously you could only add or remove registered projects — there was no way to edit one in place. This adds a real edit flow, exposed in the UI and verified end-to-end with Playwright.

Backend (Go)

  • internal/store/projects.go — new UpdateProject(p): a full UPDATE by id that sets every editable field explicitly, so emptied fields actually clear (unlike the repo-keyed UpsertProject, which preserves empty fields). Defaults an empty name to the repo, returns ErrNotFound when no row matches (via RowsAffected), and returns a conflict error on a UNIQUE repo collision instead of panicking.
  • internal/store/store.go — new ErrConflict sentinel for uniqueness violations.
  • internal/api/api.go — registered PUT /api/projects/{id} with an updateProject handler (reuses upsertProjectReq; repo required → 400). ErrNotFound → 404 and ErrConflict → 409 via the existing httpStatusFor helper.
  • TestsTestUpdateProject (success, field-clear, not-found, conflict) and TestUpdateProject_Endpoint (200/404/400), following the existing test style.

Frontend (React/TS)

  • ui/src/api.tsput<T> helper mirroring post.
  • ui/src/icons.tsx — lucide square-pen path under edit.
  • ui/src/pages/Projects.tsx — each project row gains an Edit button next to Remove. AddProjectModal is refactored into a shared ProjectModal that pre-fills fields, titles itself "Edit project", and PUTs when given a project; otherwise it behaves exactly as before ("Add project", POST).

Playwright verification

The issue explicitly asked to "make sure with playwright."

  • Added @playwright/test, playwright.config.ts, and a test:e2e npm script. The config's webServer builds the UI and runs the Go server (-fake-agents -db :memory:) so the binary serves both the SPA and /api on one port.
  • ui/e2e/projects.spec.ts drives the full stack: adds a project, edits its name and base branch, and asserts the change is reflected (old values gone).
  • .gitignore updated for Playwright artifacts.

Verification

go build ./..., go vet ./..., go test ./... pass; the UI builds; and the Playwright e2e test passes locally.

Closes nathanwhit#15: projects could only be added or removed, with no way to edit a
registered project's name, repo, fork, or base branch.

Backend:
- store.UpdateProject does a full UPDATE by id, setting every editable field
  explicitly so emptied fields actually clear (unlike UpsertProject, which is
  keyed by repo and preserves empty values) and the repo itself can change.
  Returns ErrNotFound when no row matches and a new ErrConflict when the new
  repo collides with another project (repo is UNIQUE).
- PUT /api/projects/{id} -> updateProject handler (reuses upsertProjectReq;
  repo required -> 400). ErrNotFound -> 404, ErrConflict -> 409 via the
  existing httpStatusFor helper.
- Go tests for the store update (success, field-clear, not-found, conflict)
  and the PUT endpoint (200, 404, 400).

Frontend:
- api.put mirroring api.post; an "edit" (square-pen) icon.
- AddProjectModal refactored into a shared ProjectModal that pre-fills and PUTs
  when given a project ("Edit project") and POSTs otherwise ("Add project",
  unchanged). Each project row gains an Edit button next to Remove.

Verification:
- Playwright e2e (ui/e2e/projects.spec.ts) drives the full stack against a real
  orcha server (fake agents, in-memory SQLite): adds a project, edits its name
  and base branch, and asserts the change is reflected. Added @playwright/test,
  playwright.config.ts, and a test:e2e npm script.
@nathanwhit nathanwhit merged commit 9df82c7 into nathanwhit:main Jun 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing way to edit existing projects

2 participants