Add docs: WinUI frontend + Win32 backend remote task manager walkthrough#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c56f963979
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (body[start] == 't' || body[start] == 'f') { | ||
| auto end = body.find_first_of(",}\r\n", start); | ||
| return body.substr(start, end - start); | ||
| } |
There was a problem hiding this comment.
Distinguish string values from boolean literals
The extract helper treats any value starting with t or f as a boolean token, even when it is a quoted string; for example, posting {"title":"first"} makes this branch return first" (with the trailing quote), so task titles beginning with t/f are corrupted on create/update. Because this parser is used for title and completed, it should only use the boolean branch for unquoted values.
Useful? React with 👍 / 👎.
| out = response(201, "Created", taskToJson(t)); | ||
| } | ||
| } else if (method == "PUT" && path.rfind("/tasks/", 0) == 0) { | ||
| int id = std::stoi(path.substr(7)); |
There was a problem hiding this comment.
Handle invalid task IDs before calling stoi
Parsing id with std::stoi(path.substr(7)) without validation can throw on requests like PUT /tasks/foo (or /tasks/), which will terminate the process since the exception is uncaught in the request loop. A malformed client request should return 400 instead of crashing the backend.
Useful? React with 👍 / 👎.
| std::lock_guard lock(mtx_); | ||
| auto before = tasks_.size(); | ||
| tasks_.erase( | ||
| std::remove_if(tasks_.begin(), tasks_.end(), [id](const Task& t) { return t.id == id; }), |
There was a problem hiding this comment.
Include when using std::remove_if
This snippet calls std::remove_if but does not include <algorithm> in task_store.cpp, so users following the guide can hit a build failure (remove_if is not a member of std) on standard-conforming toolchains. Add the missing header in the shown file to keep the walkthrough buildable.
Useful? React with 👍 / 👎.
Motivation
Description
docs/winui-win32-remote-task-manager.mdcontaining a full walkthrough, prerequisites, and run/build instructions for both backend and frontend.task_storein-memory store, a minimal Winsock HTTP server and amain.cppthat runs on port 8080).MainWindow,TaskItemmodel,TaskApiClientusingHttpClient, and UI event handlers).Testing
Codex Task