Repository navigation
Expand core task.priority to a 5-level scale (closes #2651) - #2687
Conversation
Replace task.priority's 3-level core_values (low/medium/high) with the 5-level Highest/High/Medium/Low/Lowest scale, ordered most- to least-urgent. Existing value strings are reused for continuity of meaning; per the pre-release policy this is a straight replacement with no migration. The schema seed is not the only place the vocabulary is hardcoded. Two independent TaskPriority enums (packages/core and packages/nodespace-types) enumerate the three variants in their FromStr/as_str impls; without widening both, "highest" and "lowest" would parse to TaskPriority::User(_) — validating fine while reporting is_core() == false, i.e. silently treated as user extensions of the very field that declares them. Also adds test_task_priority_variants_match_core_values_bidirectionally, the priority sibling of the existing ADR-076 status drift check, which asserts the enum and the schema seed stay consistent in both directions. A check existed for task.status but not for task.priority, which is what allowed this drift to go unnoticed. Other call sites updated: the TS CoreTaskPriority union and its isCorePriority/getPriorityDisplayName helpers, the priority icon map in base-node-decoration (highest/lowest previously rendered no icon), the LLM-facing vocabulary in packages/skill/SKILL.md, and the schema fixtures and assertions that mirror the seed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Code Review — PR #2687: Expand core
|
malibio
left a comment
There was a problem hiding this comment.
Initial Review complete — verdict: Approve (posted as a comment; GitHub rejects --approve on a self-authored PR).
Full report: #2687 (comment)
The core change is correct and symmetric across both TaskPriority copies, and I mutation-tested the new drift check — it genuinely fails in both directions. Catching the TaskPriority::User(_) silent-misclassification trap unprompted is real value beyond the issue's ask.
Non-blocking follow-ups worth a short commit:
- The new drift test guards only the
packages/corecopy — deletingLowestfromnodespace-typesleaves the entire suite green (verified). packages/nodespace-types/src/convert.rs:521-527— priority proptest strategy still enumerates only the old 3 values; its sibling intask_node.rswas updated.- The rewritten field description newly claims the scale is "for triage and sorting," but sorting is still lexicographic with no rank map.
Nothing here should hold the merge.
The core-side bidirectional drift test added earlier only guards the packages/core TaskPriority copy. The packages/nodespace-types copy is what actually serializes onto the frontend wire, and nothing linked it to either the schema seed or the core enum. Verified by mutation: deleting Lowest from nodespace-types left all 60 tests green, so a future sixth priority value could reach the frontend as TaskPriority::User(_) with a fully passing suite. Since nodespace-types cannot depend on nodespace-core, the guard is a self-contained test pinning the five core literals to named variants and asserting each round-trips through as_str(). Re-verified by mutation: removing Lowest now fails that test. Also: - Widen the stale priority proptest strategy in convert.rs, which still generated only the old three values (same root cause — nodespace-types source was updated but its tests were not). - Cover the new highest/lowest icon branches in base-node-decoration, the only genuinely new frontend runtime behavior in this PR. - Drop "and sorting" from task.priority's schema description. Nothing implements rank ordering; sorting is lexicographic, so the claim was inaccurate the moment it was written. Filed as #2692. - Delete the orphaned .ns-noderef--priority-high/low CSS rules (zero producers, and they encoded the 3-level assumption). - Reference ADR-076 in the new drift test's doc comment so it greps alongside its TaskStatus sibling. Deferred to follow-up issues rather than widening this PR: #2692 (lexicographic priority sorting), #2693 (unreachable integer-priority validation and phantom legacy-conversion comments), #2694 (whether project.priority should match the 5-level scale). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review feedback addressed — commit
|
Closes #2651.
Replaces
task.priority's 3-levelcore_values(low/medium/high) with the 5-level Highest/High/Medium/Low/Lowest scale, declared most- to least-urgent. Themedium/high/lowvalue strings are reused directly for continuity of meaning rather than renamed. Per the pre-release policy this is a straight replacement — no migration, no backfill.Beyond the issue's stated scope
The issue described this as a one-field edit in
core_schemas.rs. It isn't — the vocabulary is hardcoded in several more places, and two of them would have caused silent, non-obvious breakage:TaskPriorityenums —packages/core/src/models/task_node.rsandpackages/nodespace-types/src/task.rseach enumerate the three variants in theirFromStr/as_strimpls, with aUser(String)catch-all. Left alone,"highest"and"lowest"would parse toTaskPriority::User(_): they'd validate and round-trip fine, but reportis_core() == false— silently treated as user extensions of the very field that declares them as core. Both enums are widened.TaskStatusvariants andtask.status'score_valuesstay in sync, but no priority equivalent — which is precisely why this drift was easy to miss. Addedtest_task_priority_variants_match_core_values_bidirectionallyas its sibling, so the next change to either side fails loudly.Other call sites updated: the TS
CoreTaskPriorityunion and itsisCorePriority/getPriorityDisplayNamehelpers, the priority icon map inbase-node-decoration.ts(highest/lowestpreviously rendered no icon at all), the LLM-facing vocabulary line inpackages/skill/SKILL.md, and the schema fixtures/assertions that mirror the seed.Deliberately left alone
project.priority(core_schemas.rs) is a separate field with the identical 3 values. The issue scopes this totask.priorityand calls project-level changes a non-goal, so it is untouched — worth a follow-up decision.behaviors/mod.rs(1 = high, 2 = medium, 3-4 = low) describe a conversion that no longer exists in code; the test passes only because validation is permissive about the value type. Pre-existing, unrelated to this change, so not touched beyond not propagating the claim.Docs
../nodespace-docs/components/node-types.mdschema reference updated and pushed straight tomain(commitf33e723), per that repo's workflow.Testing
nodespace-core+nodespace-typessuites green, including the new drift test.bun run quality:fixclean (svelte-check 0 errors/0 warnings; clippy with-D warnings).test:all+cargo build --bin nodespaced+test:e2e) passed on push.🤖 Generated with Claude Code