Repository navigation
refactor(api): move goal routes into hq_routes (ARCH-10c) #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # ARCH-10c — Ziel-Routen nach hq_routes | ||
|
|
||
| Status: entwurf | ||
|
|
||
| Paketgröße: M, höchstens 300 Diff-Zeilen | ||
| Dateien: `src-tauri/src/api.rs`, `src-tauri/src/api/hq_routes.rs`, dieser Auftrag | ||
|
|
||
| Verschiebt unverändert die drei Arme `GET /api/hq/v1/goals`, | ||
| `POST /api/hq/v1/goals` und `POST /api/hq/v1/goals/:goalId/tasks` aus | ||
| `api.rs` in `hq_routes::handle()`. Besitztest in `hq_routes::route` nennt | ||
| genau diese Methoden und Pfadsegmente, kein Präfix- oder Methoden-Platzhalter. | ||
|
|
||
| Keine neue Funktion, kein Bugfix, keine Änderung an Backend, Store, Schema, | ||
| Auth oder Konfiguration. Bestehende Ziel-API-Tests in `api.rs` decken | ||
| Verhalten und Reihenfolge ab (No-Test, rein mechanisch). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ pub(super) fn route( | |
| | ("GET", ["api", "hq", "v1", "runtime" | "plan" | "runs"]) | ||
| | ("GET", ["api", "hq", "v1", "context" | "changes"]) | ||
| | ("POST", ["api", "hq", "v1", "plan", "import"]) | ||
| | ("GET" | "POST", ["api", "hq", "v1", "goals"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Der Commit ändert Rust-Quellcode, enthält aber keine eigenständige Zeile AGENTS.md reference: AGENTS.md:L155-L158 Useful? React with 👍 / 👎. |
||
| | ("POST", ["api", "hq", "v1", "goals", _, "tasks"]) | ||
| ); | ||
| owned.then(|| handle(inner, request, method, path, project_id)) | ||
| } | ||
|
|
@@ -173,6 +175,84 @@ fn handle( | |
| } | ||
| continuous_response(backend.development_records(project_id)) | ||
| } | ||
| ("GET", ["api", "hq", "v1", "goals"]) => { | ||
| let project_id = match project_id { | ||
| Some(value) if !value.is_empty() => value, | ||
| _ => return Response::error(400, "projectId is required"), | ||
| }; | ||
| match backend.list_continuous_goals(project_id) { | ||
| Ok(goals) => Response::ok(json!({ "goals": goals })), | ||
| Err(err) => continuous_error(err), | ||
| } | ||
| } | ||
| ("POST", ["api", "hq", "v1", "goals"]) => { | ||
| let body = match parse_body(&request.body) { | ||
| Ok(body) => body, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| if let Err(err) = only_keys( | ||
| &body, | ||
| &[ | ||
| "projectId", | ||
| "objective", | ||
| "acceptanceCriteria", | ||
| "sourceGoalId", | ||
| "admit", | ||
| ], | ||
| ) { | ||
| return Response::error(400, err); | ||
| } | ||
| let project_id = match required_str(&body, "projectId") { | ||
| Ok(value) => value, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| let objective = match required_str(&body, "objective") { | ||
| Ok(value) => value, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| let admit = match optional_bool(&body, "admit") { | ||
| Ok(value) => value.unwrap_or(false), | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| match backend.create_continuous_goal( | ||
| &project_id, | ||
| &objective, | ||
| optional_str(&body, "acceptanceCriteria"), | ||
| optional_str(&body, "sourceGoalId"), | ||
| admit, | ||
| ) { | ||
| Ok(goal) => Response::ok(json!({ "goal": goal })), | ||
| Err(err) => continuous_error(err), | ||
| } | ||
| } | ||
| ("POST", ["api", "hq", "v1", "goals", goal_id, "tasks"]) => { | ||
| let body = match parse_body(&request.body) { | ||
| Ok(body) => body, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| let objective = match required_str(&body, "objective") { | ||
| Ok(value) => value, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| let owned_paths = match string_array(&body, "ownedPaths") { | ||
| Ok(value) => value, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| let dependencies = match string_array(&body, "dependencies") { | ||
| Ok(value) => value, | ||
| Err(err) => return Response::error(400, err), | ||
| }; | ||
| match backend.create_continuous_task( | ||
| goal_id, | ||
| &objective, | ||
| optional_str(&body, "profileId"), | ||
| owned_paths, | ||
| dependencies, | ||
| ) { | ||
| Ok(task) => Response::ok(json!({ "task": task })), | ||
| Err(err) => continuous_error(err), | ||
| } | ||
| } | ||
| _ => unreachable!("route() only hands over owned arms"), | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entwurfbedeutet lautscripts/lib/active-specs.mjs:3-6, dass die Datei noch kein ausführbarer Auftrag ist; entsprechend lässtnpm run specsARCH-10c aus, obwohl derselbe Commit das M-Paket bereits umsetzt und die serielle Nahtstelleapi.rsändert. Dadurch bleibt diese Lane während der laufenden Arbeit inSTAND.mdunbelegt und ein weiterer Agent könnte parallel dieselbe Nahtstelle bearbeiten. Setze die Spec bis zum Merge aufaktivund trage sie unter „Aktive Specs“ ein; nach dem Merge kann sie aufhistorischgesetzt werden.AGENTS.md reference: AGENTS.md:L31-L32
Useful? React with 👍 / 👎.