Repository navigation
Type project.status as a ProjectStatus enum with a user-value variant - #3476
Conversation
Pragmatic Code Review: PR #3476Review Type: Initial Review (no prior reviews or comments on the PR) Reviewed at: SummaryA small, atomic change that does what it says. Requirements CheckOnly the
What I verified
Code Review Findings🟡 Important1. A user-defined project status is never exercised past the update struct The description says "a user-defined value still round-trips", but the only test of a
Task has the first one: Recommendation: add one service test that mirrors the task one. Add Principle: test the behaviour the change claims. The user-value variant is the reason this is an enum and not a closed one. 🟢 Suggestions2. The pin test catches schema drift, but not a new enum variant The schema-to-enum direction is solid, and stricter than the task test: it compares the ordered lists, so a value added, removed, renamed or reordered in the schema fails, and so does a changed default. The enum-to-schema direction depends on the hand-written The risk is low, because writing a variant the schema lacks is rejected loudly by the service. But the test name says "bidirectionally". Recommendation: make the compiler enforce the list, for both enums. Either an exhaustive 3. The task test does not pin the default, though the docs now say it does The docs row says "A test pins the named variants and the default to the schema's Recommendation: add the same three-line default assertion to the task test in this PR, so the documented rule holds for both types it names. 4. Nit: rustdoc syntax leaks into the generated TypeScript The doc comment is copied into the TypeScript file, where 5. Nit: stale comment on the re-export The comment still reads " 6. Nit: the project sheet omits "required" The task table's column is "Required / default" and shows 7. Nit, not for this PR: three copies of the same enum boilerplate
Docs accuracy
RecommendationAPPROVE. The change is correct and consistent with |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressedAddressed
Skipped
Verification: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The review approved with no critical findings. The follow-up is one new test, one assertion, a const that replaces two inline lists, and comment and doc wording. No behaviour changed. |
… (part of #3453) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…one CORE list per status enum - project_update_accepts_a_status_added_to_the_schema covers validation, write and read - TaskStatus::CORE and ProjectStatus::CORE back the pin tests and the generator check - The task pin test also pins the schema default Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
9d2cc16 to
4022782
Compare
Part of #3453 (its
project.statusitem; the issue stays open for the rest).What changed
project.statuswas a plainStringin the wire structs whiletask.statuswas an enum, although both are user-extensible. ADR-086 §4 says an extensible enum is an enum with a user-value variant, so project now follows task.ProjectStatusinnodespace-types:Planning,Active,Completed,Cancelled,User(String), withfrom_value/as_str/is_coreand hand-written serde, mirroringTaskStatus. Its default isPlanning, the schema's default.ProjectNode.statusandProjectNodeUpdate.statususe it.DEFAULT_PROJECT_STATUSis deleted; the conversion uses the enum's default.UpdateProjectNodehandler and the Tauri command convert at the proto boundary, as the task path does.generated/project-status.ts, andProjectNode.statusisstatus: ProjectStatus. The generator's literal check covers the new enum.The wire format is unchanged: status still travels as a bare string, and a user-defined value still round-trips.
Tests
core_schemas.rs:project.status'scoreValuesequal the enum's named variants, in order, each parses to a named variant, and the schema default equalsProjectStatus::default().project.rs: a core value parses to its variant, a user value is kept asUserand written back unchanged.archivedrejected, typed update writes) now build the update with the enum and still pass.Verification
bun run quality:fixclean.bun run test:changedpasses: frontend, scripts, browser,types:check, Rust workspace.Docs
nodespace-docs is updated alongside (committed separately, direct to main): the task and project sheets in
components/node-types.mdname the enums, andcomponents/creating-node-types.mdstates the per-type status enum rule.🤖 Generated with Claude Code