Skip to content

Open new project's draft view from the new-project modal - #150

Merged
marmeladema merged 1 commit into
mainfrom
open-draft-on-new-project
Jul 30, 2026
Merged

Open new project's draft view from the new-project modal#150
marmeladema merged 1 commit into
mainfrom
open-draft-on-new-project

Conversation

@marmeladema

@marmeladema marmeladema commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Problem

Creating a project from the new-project modal (the sidebar + under "Projects") discarded the returned project id and only reloaded the sidebar, leaving whatever thread was previously on screen visible. The per-project + button already landed on a draft via newThread(pid); the modal did not.

Change

crates/giskard-server/static/app.js — the $("pmCreate").onclick handler now captures the created project's id and calls newThread(id) after loadProjects(), reusing the exact same path as the per-project + button:

const { id } = await api("POST","/api/projects",{ name, dir, default_model:model });
closeProjectModal();
await loadProjects();
newThread(id);

newThread runs openDraftThread(pid) (draws the draft synchronously, resets the composer, highlights the project row) then applyProjectDefaultModel(pid, state.draftThread) (resolves the default model in the background). All existing LT6–LT9 draft semantics therefore apply automatically — the draft opens before the project fetch, the model starts null with modelLoading shown, Send is disabled until the default resolves, and a late default won't clobber a user-picked model. No new draft logic was needed.

Frontend-only behavioral change to an existing UI flow; no HTTP/WS route, config key, persisted shape, or appearance changed, so no README/spec/api-endpoints/screenshot updates are required.

Test

Added tests/e2e/tests/new-project.spec.ts, which drives the real modal end-to-end against giskard-server-replay: opens #newProj, browses the picker to /tmp, names the project, clicks Create, and asserts the draft view lands for the new project (modal closes, project row highlighted .active with aria-current="true", no thread active, composer visible and focused, transcript shows the draft explainer, model resolves to "Replay Model", Send enabled). It then sends a message to prove the draft is live, asserts the highlight correctly moves to the new thread row, and cleans up the project in a finally.

This is the first e2e coverage of the new-project modal UI; existing specs created projects server-side via the API, so a regression dropping the newThread(id) call would previously have gone undetected.

Verification

  • `tests/e2e/run.sh tests/new-project.spec.ts` → `1 passed`
  • `tests/e2e/run.sh tests/draft-composer.spec.ts tests/thread.spec.ts` → `22 passed` (existing per-project-`+` draft path and thread flows intact)
  • `cargo build`, `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings` → clean

Summary by CodeRabbit

  • New Features

    • Newly created projects now open directly in their draft view after creation.
    • Users can immediately start composing and sending the first message in a new project.
  • Tests

    • Added end-to-end coverage for project creation, folder selection, draft initialization, messaging, and project cleanup.

Creating a project from the new-project modal discarded the returned
project id and only reloaded the sidebar, leaving whatever thread was
on screen visible. The per-project + button already landed on a draft
via newThread(pid); reuse that path from the modal's Create handler so
creating a project opens its draft view (model resolves in the
background, Send disabled until then — LT6–LT9 semantics).

Add an e2e test that drives the real modal flow and asserts the draft
lands for the new project.
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d8ebf1c-a942-4153-9e2b-767af04e409f

📥 Commits

Reviewing files that changed from the base of the PR and between 428a31e and c99bfa3.

📒 Files selected for processing (2)
  • crates/giskard-server/static/app.js
  • tests/e2e/tests/new-project.spec.ts

📝 Walkthrough

Walkthrough

Project creation now navigates directly to the new project’s draft view after reloading the project list. A Playwright test covers modal creation, folder selection, draft state, messaging, and cleanup.

Changes

New project flow

Layer / File(s) Summary
Open the created project draft
crates/giskard-server/static/app.js
The create-project handler calls newThread(id) after project creation and project-list reload.
Validate project creation and first message
tests/e2e/tests/new-project.spec.ts
Adds Playwright coverage for modal creation, /tmp folder selection, draft-state assertions, first-message delivery, active-thread selection, and cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: opening the newly created project’s draft view from the new-project modal.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch open-draft-on-new-project

Comment @coderabbitai help to get the list of available commands.

@marmeladema
marmeladema merged commit 9db4aaa into main Jul 30, 2026
5 checks passed
@marmeladema
marmeladema deleted the open-draft-on-new-project branch July 30, 2026 18:09
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.

1 participant