Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-6771 feat(cli): filter and sort issue list by custom property (#7664)
Firerd4a712abf388
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.mdindex 8df361e2be..b73ebe3352 100644--- a/CLI_AND_DAEMON.md+++ b/CLI_AND_DAEMON.md@@ -504,9 +504,9 @@ multica issue list --status todo --sort position # board order (the defaulmultica issue list --sort created_at --direction desc # newest first```-Table output shows a routable issue `KEY` such as `MUL-123`; copy that key into follow-up commands like `issue get`, `issue comment list`, `issue status`, or `--parent`. Add `--full-id` when you need canonical UUIDs. Available filters: `--status`, `--priority`, `--assignee` / `--assignee-id`, `--project`, `--metadata`, `--limit`. Use `--assignee-id <uuid>` for unambiguous filtering when names overlap.+Table output shows a routable issue `KEY` such as `MUL-123`; copy that key into follow-up commands like `issue get`, `issue comment list`, `issue status`, or `--parent`. Add `--full-id` when you need canonical UUIDs. Available filters: `--status`, `--priority`, `--assignee` / `--assignee-id`, `--project`, `--metadata`, `--property`, `--limit`. Use `--assignee-id <uuid>` for unambiguous filtering when names overlap.-Results come back in board order (`position`, ascending) by default. Pass `--sort` to change the column (`position`, `title`, `created_at`, `start_date`, `due_date`, `priority`) and `--direction asc|desc` to flip the order. `position` is always ascending (it is the manual drag order), so `--direction` is rejected when `--sort` is `position` or omitted — use it only with `title`, `created_at`, `start_date`, `due_date`, or `priority`.+Results come back in board order (`position`, ascending) by default. Pass `--sort` to change the column (`position`, `title`, `created_at`, `start_date`, `due_date`, `priority`, or `property:<name-or-id>` for a custom property — select properties order by option order, and issues without the property sort last) and `--direction asc|desc` to flip the order. `position` is always ascending (it is the manual drag order), so `--direction` is rejected when `--sort` is `position` or omitted — use it only with `title`, `created_at`, `start_date`, `due_date`, `priority`, or a `property:` sort.Use `--metadata key=value` (repeatable; combined with AND) to filter by per-issue metadata. The value is JSON-parsed: `true`/`false` become bool, numbers become numbers, anything else is a string. Wrap as `'"42"'` to force a string when the value would otherwise sniff as a number:@@ -515,6 +515,14 @@ multica issue list --metadata pipeline_status=waiting_reviewmultica issue list --metadata pr_number=482 --metadata is_blocked=true```+Use `--property "Name=Value"` (repeatable; one value per flag) to filter by custom property. Names and select option values are case-insensitive and resolve to ids; repeating the same property matches any of its values, different properties must all match. Values are option names or ids (select types), `true`/`false` (checkbox), a member name, email, or id (actor types), or the stored value itself for `text`, `url`, `number`, and `date` (`YYYY-MM-DD`). Only `=` is supported today; the `>=`, `<=` and `!=` spellings are reserved for comparison filters and are rejected. The reserved value `__none__` matches issues where the property is unset:++```bash+multica issue list --property "Impact=High" --property "Impact=Medium"+multica issue list --property "Impact=__none__" --status in_review+multica issue list --property "Score=42" --property "Ship Date=2026-08-28"+```+### Get Issue```bashdiff --git a/apps/docs/content/docs/cli.ja.mdx b/apps/docs/content/docs/cli.ja.mdxindex 2d63d61b43..e57578dc53 100644--- a/apps/docs/content/docs/cli.ja.mdx+++ b/apps/docs/content/docs/cli.ja.mdx@@ -224,7 +224,7 @@ CLI の設定ファイルには、あなたとして Multica にアクセスで| コマンド | サブコマンド | 用途 | 主なフラグ || --- | --- | --- | --- |-| `issue` | `list` | タスクを一覧 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(繰り返し可)、`--limit`、`--offset`、`--sort`、`--full-id` |+| `issue` | `list` | タスクを一覧 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(繰り返し可)、`--property`(繰り返し可、`"名前=値"`;`__none__` は未設定に一致)、`--limit`、`--offset`、`--sort`(`property:<名前または id>` に対応)、`--full-id` || | `get <id>` | 単一のタスクを表示 | || | `create` | タスクを作成 | `--title`(必須)、`--description` / `--description-stdin` / `--description-file`、`--status`、`--priority`、`--assignee`、`--parent`、`--stage`、`--project`、`--start-date`、`--due-date`、`--attachment`(繰り返し可) || | `update <id>` | タスクのフィールドを更新 | `create` と同系のフィールドに加え `--position`、`--no-start` |diff --git a/apps/docs/content/docs/cli.ko.mdx b/apps/docs/content/docs/cli.ko.mdxindex b68444b381..11c7c527ec 100644--- a/apps/docs/content/docs/cli.ko.mdx+++ b/apps/docs/content/docs/cli.ko.mdx@@ -224,7 +224,7 @@ CLI 설정 파일에는 사용자를 대신해 Multica에 접근할 수 있는 t| 명령 | 하위 명령 | 용도 | 주요 flag || --- | --- | --- | --- |-| `issue` | `list` | 태스크 목록 | `--status`, `--priority`, `--assignee`, `--project`, `--metadata`(반복 가능), `--limit`, `--offset`, `--sort`, `--full-id` |+| `issue` | `list` | 태스크 목록 | `--status`, `--priority`, `--assignee`, `--project`, `--metadata`(반복 가능), `--property`(반복 가능, `"이름=값"`; `__none__`은 미설정과 일치), `--limit`, `--offset`, `--sort`(`property:<이름 또는 id>` 지원), `--full-id` || | `get <id>` | 태스크 하나 확인 | || | `create` | 태스크 생성 | `--title`(필수), `--description` / `--description-stdin` / `--description-file`, `--status`, `--priority`, `--assignee`, `--parent`, `--stage`, `--project`, `--start-date`, `--due-date`, `--attachment`(반복 가능) || | `update <id>` | 태스크 필드 업데이트 | `create`와 같은 종류의 필드에 `--position`, `--no-start` 추가 |diff --git a/apps/docs/content/docs/cli.mdx b/apps/docs/content/docs/cli.mdxindex 00db779bf4..b33b425453 100644--- a/apps/docs/content/docs/cli.mdx+++ b/apps/docs/content/docs/cli.mdx@@ -232,7 +232,7 @@ The tables below cover every current top-level command, grouped the way the CLI| Command | Subcommand | Purpose | Key flags || --- | --- | --- | --- |-| `issue` | `list` | List issues | `--status`, `--priority`, `--assignee`, `--project`, `--metadata` (repeatable), `--limit`, `--offset`, `--sort`, `--full-id` |+| `issue` | `list` | List issues | `--status`, `--priority`, `--assignee`, `--project`, `--metadata` (repeatable), `--property` (repeatable, `"Name=Value"`; `__none__` matches unset), `--limit`, `--offset`, `--sort` (incl. `property:<name-or-id>`), `--full-id` || | `get <id>` | Show a single issue | || | `create` | Create an issue | `--title` (required), `--description` / `--description-stdin` / `--description-file`, `--status`, `--priority`, `--assignee`, `--parent`, `--stage`, `--project`, `--start-date`, `--due-date`, `--attachment` (repeatable) || | `update <id>` | Update issue fields | Same fields as `create`, plus `--position`, `--no-start` |diff --git a/apps/docs/content/docs/cli.zh.mdx b/apps/docs/content/docs/cli.zh.mdxindex 4b848a636b..9ae90488f1 100644--- a/apps/docs/content/docs/cli.zh.mdx+++ b/apps/docs/content/docs/cli.zh.mdx@@ -224,7 +224,7 @@ CLI 配置文件包含可代表你访问 Multica 的令牌。不要提交到仓| 命令 | 子命令 | 用途 | 关键 flag || --- | --- | --- | --- |-| `issue` | `list` | 列出任务 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(可重复)、`--limit`、`--offset`、`--sort`、`--full-id` |+| `issue` | `list` | 列出任务 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(可重复)、`--property`(可重复,`"名称=值"`;`__none__` 匹配未设置)、`--limit`、`--offset`、`--sort`(支持 `property:<名称或 id>`)、`--full-id` || | `get <id>` | 查看单个任务 | || | `create` | 创建任务 | `--title`(必填)、`--description` / `--description-stdin` / `--description-file`、`--status`、`--priority`、`--assignee`、`--parent`、`--stage`、`--project`、`--start-date`、`--due-date`、`--attachment`(可重复) || | `update <id>` | 更新任务字段 | 与 `create` 同类字段,另有 `--position`、`--no-start` |diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.goindex 0dc5b28346..3547c0cd00 100644--- a/server/cmd/multica/cmd_issue.go+++ b/server/cmd/multica/cmd_issue.go@@ -494,10 +494,11 @@ func init() {issueListCmd.Flags().String("assignee-id", "", "Filter by assignee UUID — member, agent, or squad (mutually exclusive with --assignee)")issueListCmd.Flags().String("project", "", "Filter by project ID")issueListCmd.Flags().StringSlice("metadata", nil, "Filter by metadata key=value (repeatable; combined with AND). Value is JSON-parsed: 'true'/'false' → bool, numbers → number, otherwise string. Wrap as '\"42\"' to force a string when the value would otherwise sniff as a number.")+ issueListCmd.Flags().StringArray("property", nil, `Filter by custom property, written as "Name=Value" (repeatable, one value per flag). Name is a property name (case-insensitive) or its UUID. Value depends on the type: an option name or id for select and multi_select, true or false for checkbox, a member name, email, or id for actor types, and the value itself for text, url, number, and date (YYYY-MM-DD). Use __none__ to match issues where the property is unset; it works for every type, so an option or member actually named __none__ has to be given by id, as does a property whose name contains "=" or ends in <, > or ! (the >=, <=, and != spellings are reserved for comparison filters). Repeating a property matches ANY of its values; different properties must ALL match.`)issueListCmd.Flags().Int("limit", 50, "Maximum number of issues to return in one page (the server caps a page at 100; use --offset to page through more)")issueListCmd.Flags().Int("offset", 0, "Number of issues to skip (for pagination)")- issueListCmd.Flags().String("sort", "", "Sort column: position (default, manual board order), title, created_at, start_date, due_date, priority")- issueListCmd.Flags().String("direction", "", "Sort direction (asc or desc); requires --sort to be a non-position column (position is always ascending)")+ issueListCmd.Flags().String("sort", "", "Sort column: position (default, manual board order), title, created_at, start_date, due_date, priority, or property:<name-or-id> to sort by a custom property (select properties sort by option order)")+ issueListCmd.Flags().String("direction", "", "Sort direction (asc or desc); requires --sort to be a non-position column or a property sort (position is always ascending)")// issue getissueGetCmd.Flags().String("output", "json", "Output format: table or json")@@ -679,8 +680,32 @@ func runIssueList(cmd *cobra.Command, _ []string) error {}params.Set("metadata", filter)}+ // --property filtering and property:<ref> sorting both address definitions+ // by name or UUID, so they share a single catalog fetch.+ const propertySortPrefix = "property:"+ propertyFlags, _ := cmd.Flags().GetStringArray("property")sortVal, _ := cmd.Flags().GetString("sort")- if sortVal != "" {+ var properties []propertyDTO+ if len(propertyFlags) > 0 || strings.HasPrefix(sortVal, propertySortPrefix) {+ var err error+ if properties, err = fetchProperties(ctx, client); err != nil {+ return err+ }+ }+ if len(propertyFlags) > 0 {+ filter, err := buildPropertiesFilterQueryParam(ctx, client, properties, propertyFlags)+ if err != nil {+ return err+ }+ params.Set("properties", filter)+ }+ if strings.HasPrefix(sortVal, propertySortPrefix) {+ property, err := resolveSortableProperty(properties, strings.TrimPrefix(sortVal, propertySortPrefix))+ if err != nil {+ return err+ }+ params.Set("sort", propertySortPrefix+property.ID)+ } else if sortVal != "" {valid := falsefor _, c := range validIssueSortColumns {if c == sortVal {@@ -689,7 +714,7 @@ func runIssueList(cmd *cobra.Command, _ []string) error {}}if !valid {- return fmt.Errorf("invalid --sort %q; valid values: %s", sortVal, strings.Join(validIssueSortColumns, ", "))+ return fmt.Errorf("invalid --sort %q; valid values: %s, or property:<name-or-id> for a custom property", sortVal, strings.Join(validIssueSortColumns, ", "))}params.Set("sort", sortVal)}@@ -703,7 +728,7 @@ func runIssueList(cmd *cobra.Command, _ []string) error {// than silently dropping the flag — a passed-but-ignored flag is a// footgun, especially in scripts.if sortVal == "" || sortVal == "position" {- return fmt.Errorf("--direction requires --sort to be one of %s; position (the default manual board order) is always ascending", strings.Join(directionalIssueSortColumns, ", "))+ return fmt.Errorf("--direction requires --sort to be one of %s, or a property:<name-or-id> sort; position (the default manual board order) is always ascending", strings.Join(directionalIssueSortColumns, ", "))}params.Set("direction", d)}diff --git a/server/cmd/multica/cmd_issue_property_filter_test.go b/server/cmd/multica/cmd_issue_property_filter_test.gonew file mode 100644index 0000000000..fff043972a--- /dev/null+++ b/server/cmd/multica/cmd_issue_property_filter_test.go@@ -0,0 +1,360 @@+package main++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "net/url"+ "reflect"+ "strings"+ "testing"+)++const (+ testImpactDefID = "aaaaaaaa-1111-4111-8111-111111111111"+ testImpactLowID = "bbbbbbbb-1111-4111-8111-111111111111"+ testImpactMediumID = "bbbbbbbb-2222-4222-8222-222222222222"+ testImpactHighID = "bbbbbbbb-3333-4333-8333-333333333333"+ testBlockedDefID = "cccccccc-1111-4111-8111-111111111111"+ testNotesDefID = "dddddddd-1111-4111-8111-111111111111"+ testArchivedDefID = "eeeeeeee-1111-4111-8111-111111111111"+ testPlatformsDefID = "ffffffff-1111-4111-8111-111111111111"+ testPlatformsIOSID = "ffffffff-2222-4222-8222-222222222222"+ testReviewerDefID = "abababab-1111-4111-8111-111111111111"+ testScoreDefID = "acacacac-1111-4111-8111-111111111111"+ testShipDateDefID = "adadadad-1111-4111-8111-111111111111"+ testSpecDefID = "aeaeaeae-1111-4111-8111-111111111111"+ testFutureDefID = "afafafaf-1111-4111-8111-111111111111"+)++func propertyFilterTestCatalog() []propertyDTO {+ impact := propertyDTO{ID: testImpactDefID, Name: "Impact", Type: "select"}+ impact.Config.Options = []propertyOptionDTO{+ {ID: testImpactLowID, Name: "Low"},+ {ID: testImpactMediumID, Name: "Medium"},+ {ID: testImpactHighID, Name: "High"},+ }+ blocked := propertyDTO{ID: testBlockedDefID, Name: "Blocked", Type: "checkbox"}+ notes := propertyDTO{ID: testNotesDefID, Name: "Notes", Type: "text"}+ archived := propertyDTO{ID: testArchivedDefID, Name: "Old Impact", Type: "select", Archived: true}+ archived.Config.Options = []propertyOptionDTO{{ID: testImpactLowID, Name: "Legacy"}}+ platforms := propertyDTO{ID: testPlatformsDefID, Name: "Platforms", Type: "multi_select"}+ platforms.Config.Options = []propertyOptionDTO{{ID: testPlatformsIOSID, Name: "iOS"}}+ reviewer := propertyDTO{ID: testReviewerDefID, Name: "Reviewer", Type: "actor"}+ score := propertyDTO{ID: testScoreDefID, Name: "Score", Type: "number"}+ shipDate := propertyDTO{ID: testShipDateDefID, Name: "Ship Date", Type: "date"}+ spec := propertyDTO{ID: testSpecDefID, Name: "Spec", Type: "url"}+ // A type this build has never heard of, the way a newer backend would report one.+ future := propertyDTO{ID: testFutureDefID, Name: "Sentiment", Type: "mood"}+ return []propertyDTO{impact, blocked, notes, archived, platforms, reviewer, score, shipDate, spec, future}+}++// newPropertyFilterTestServer serves the fixed property catalog and captures+// each /api/issues query. Counters expose how often each endpoint was hit so+// tests can pin the single-catalog-fetch behavior and error paths that must+// never reach /api/issues.+func newPropertyFilterTestServer(t *testing.T) (issueQueries *[]url.Values, propertiesCalls *int) {+ t.Helper()+ queries := &[]url.Values{}+ calls := new(int)+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.URL.Path {+ case "/api/properties":+ *calls+++ json.NewEncoder(w).Encode(map[string]any{"properties": propertyFilterTestCatalog()})+ case "/api/issues":+ *queries = append(*queries, r.URL.Query())+ json.NewEncoder(w).Encode(map[string]any{"issues": []any{}, "total": 0})+ default:+ http.NotFound(w, r)+ }+ }))+ t.Cleanup(srv.Close)++ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "test-token")+ return queries, calls+}++func listIssuesWithFlags(t *testing.T, flags map[string][]string) error {+ t.Helper()+ cmd := newIssueListTestCmd()+ _ = cmd.Flags().Set("output", "json")+ for name, values := range flags {+ for _, value := range values {+ if err := cmd.Flags().Set(name, value); err != nil {+ t.Fatalf("set --%s %q: %v", name, value, err)+ }+ }+ }+ _, err := captureStdout(t, func() error { return runIssueList(cmd, nil) })+ return err+}++func decodePropertiesParam(t *testing.T, queries []url.Values) map[string][]string {+ t.Helper()+ if len(queries) != 1 {+ t.Fatalf("expected exactly one /api/issues request, got %d", len(queries))+ }+ raw := queries[0].Get("properties")+ if raw == "" {+ t.Fatalf("no properties query param sent; query = %v", queries[0])+ }+ var filter map[string][]string+ if err := json.Unmarshal([]byte(raw), &filter); err != nil {+ t.Fatalf("properties param %q is not valid JSON: %v", raw, err)+ }+ return filter+}++func TestRunIssueListSendsPropertyFilter(t *testing.T) {+ cases := []struct {+ name string+ flags []string+ want map[string][]string+ }{+ {+ name: "select option by name",+ flags: []string{"Impact=High"},+ want: map[string][]string{testImpactDefID: {testImpactHighID}},+ },+ {+ name: "case-insensitive property and option names",+ flags: []string{"impact=high"},+ want: map[string][]string{testImpactDefID: {testImpactHighID}},+ },+ {+ name: "property and option addressed by UUID",+ flags: []string{testImpactDefID + "=" + testImpactHighID},+ want: map[string][]string{testImpactDefID: {testImpactHighID}},+ },+ {+ name: "repeated property flags OR into one definition",+ flags: []string{"Impact=High", "impact=Medium"},+ want: map[string][]string{testImpactDefID: {testImpactHighID, testImpactMediumID}},+ },+ {+ name: "duplicate resolved values collapse",+ flags: []string{"Impact=High", "Impact=high"},+ want: map[string][]string{testImpactDefID: {testImpactHighID}},+ },+ {+ name: "distinct definitions AND together",+ flags: []string{"Impact=High", "Blocked=true"},+ want: map[string][]string{+ testImpactDefID: {testImpactHighID},+ testBlockedDefID: {"true"},+ },+ },+ {+ name: "unset sentinel passes through for a checkbox",+ flags: []string{"Blocked=__none__"},+ want: map[string][]string{testBlockedDefID: {"__none__"}},+ },+ {+ name: "unset sentinel passes through for a text property",+ flags: []string{"Notes=__none__"},+ want: map[string][]string{testNotesDefID: {"__none__"}},+ },+ {+ name: "multi_select option by name",+ flags: []string{"Platforms=iOS"},+ want: map[string][]string{testPlatformsDefID: {testPlatformsIOSID}},+ },+ {+ // Stored actor values are canonical lowercase-hyphenated and the+ // filter is exact containment, so an explicit member:<uuid> value+ // must be re-serialized rather than passed through as typed.+ name: "actor member reference canonicalized",+ flags: []string{"Reviewer=member:ABABABAB-2222-4222-8222-222222222222"},+ want: map[string][]string{testReviewerDefID: {"member:abababab-2222-4222-8222-222222222222"}},+ },+ {+ name: "text value forwarded verbatim",+ flags: []string{"Notes=needs a second look"},+ want: map[string][]string{testNotesDefID: {"needs a second look"}},+ },+ {+ // Text is stored exactly as written, so the filter has to pass+ // through what the user typed.+ name: "text value keeps surrounding whitespace",+ flags: []string{"Notes= padded "},+ want: map[string][]string{testNotesDefID: {" padded "}},+ },+ {+ name: "number value forwarded",+ flags: []string{"Score=42"},+ want: map[string][]string{testScoreDefID: {"42"}},+ },+ {+ name: "negative and fractional numbers are accepted",+ flags: []string{"Score=-1.5"},+ want: map[string][]string{testScoreDefID: {"-1.5"}},+ },+ {+ name: "date value forwarded",+ flags: []string{"Ship Date=2026-08-28"},+ want: map[string][]string{testShipDateDefID: {"2026-08-28"}},+ },+ {+ // A url is stored trimmed, so the filter trims to match it.+ name: "url value trimmed to the stored spelling",+ flags: []string{"Spec= https://example.com/spec "},+ want: map[string][]string{testSpecDefID: {"https://example.com/spec"}},+ },+ {+ // The store cap is 2000 runes, not bytes.+ name: "text value at the store length cap is sent",+ flags: []string{"Notes=" + strings.Repeat("é", 2000)},+ want: map[string][]string{testNotesDefID: {strings.Repeat("é", 2000)}},+ },+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ queries, _ := newPropertyFilterTestServer(t)+ if err := listIssuesWithFlags(t, map[string][]string{"property": tc.flags}); err != nil {+ t.Fatalf("runIssueList: %v", err)+ }+ if got := decodePropertiesParam(t, *queries); !reflect.DeepEqual(got, tc.want) {+ t.Fatalf("properties param = %v, want %v", got, tc.want)+ }+ })+ }+}++func TestRunIssueListPropertyFilterErrors(t *testing.T) {+ cases := []struct {+ name string+ flags []string+ wantErr string+ }{+ {"missing equals", []string{"Impact"}, "Name=Value"},+ {"empty value", []string{"Impact="}, "__none__"},+ {"unknown property lists names", []string{"Nope=High"}, "Impact"},+ {"unknown option lists options", []string{"Impact=Critical"}, "Low"},+ {"archived property", []string{"Old Impact=Legacy"}, "archived"},+ {"checkbox value must be a bool", []string{"Blocked=maybe"}, "true or false"},+ {"whitespace-only value", []string{"Notes= "}, "__none__"},+ {"number value must be numeric", []string{"Score=high"}, "not a valid number"},+ {"number value must be finite", []string{"Score=NaN"}, "not a finite number"},+ {"date value must be YYYY-MM-DD", []string{"Ship Date=28/08/2026"}, "YYYY-MM-DD"},+ {"unknown property type is rejected", []string{"Sentiment=happy"}, "does not know how to filter"},+ {"url must have a scheme", []string{"Spec=example.com/foo"}, "http(s) URL"},+ {"url must be http or https", []string{"Spec=ftp://example.com/x"}, "http(s) URL"},+ {"url must have a host", []string{"Spec=http://"}, "http(s) URL"},+ {"url over the store length cap", []string{"Spec=https://example.com/" + strings.Repeat("a", 2048)}, "2048 characters or fewer"},+ {"text over the store length cap", []string{"Notes=" + strings.Repeat("a", 2001)}, "2000 characters or fewer"},+ {"comparison operators are reserved", []string{"Impact>=Medium"}, "comparison operators"},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ queries, _ := newPropertyFilterTestServer(t)+ err := listIssuesWithFlags(t, map[string][]string{"property": tc.flags})+ if err == nil {+ t.Fatalf("expected error for --property %q", tc.flags)+ }+ if !strings.Contains(err.Error(), tc.wantErr) {+ t.Fatalf("error = %q, want it to mention %q", err, tc.wantErr)+ }+ if len(*queries) != 0 {+ t.Fatalf("a failing --property still hit /api/issues: %v", *queries)+ }+ })+ }+}++func TestRunIssueListSendsPropertySort(t *testing.T) {+ cases := []struct {+ name string+ flags map[string][]string+ }{+ {"by name", map[string][]string{"sort": {"property:Impact"}, "direction": {"desc"}}},+ {"case-insensitive name", map[string][]string{"sort": {"property:impact"}, "direction": {"desc"}}},+ {"by UUID", map[string][]string{"sort": {"property:" + testImpactDefID}, "direction": {"desc"}}},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ queries, _ := newPropertyFilterTestServer(t)+ if err := listIssuesWithFlags(t, tc.flags); err != nil {+ t.Fatalf("runIssueList: %v", err)+ }+ if len(*queries) != 1 {+ t.Fatalf("expected one /api/issues request, got %d", len(*queries))+ }+ got := (*queries)[0]+ if got.Get("sort") != "property:"+testImpactDefID {+ t.Fatalf("sort query = %q, want property:%s", got.Get("sort"), testImpactDefID)+ }+ if got.Get("direction") != "desc" {+ t.Fatalf("direction query = %q, want desc", got.Get("direction"))+ }+ })+ }+}++func TestRunIssueListPropertySortErrors(t *testing.T) {+ cases := []struct {+ name string+ sort string+ wantErr string+ }{+ {"unknown property", "property:Nope", "not found"},+ {"archived property", "property:Old Impact", "archived"},+ {"type without a sort order", "property:Platforms", "no server-side sort order"},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ queries, _ := newPropertyFilterTestServer(t)+ err := listIssuesWithFlags(t, map[string][]string{"sort": {tc.sort}})+ if err == nil {+ t.Fatalf("expected error for --sort %q", tc.sort)+ }+ if !strings.Contains(err.Error(), tc.wantErr) {+ t.Fatalf("error = %q, want it to mention %q", err, tc.wantErr)+ }+ if len(*queries) != 0 {+ t.Fatalf("a failing --sort still hit /api/issues: %v", *queries)+ }+ })+ }+}++// TestRunIssueListInvalidSortMentionsPropertyForm guards that the static+// column whitelist still rejects unknown plain columns, and that the error now+// tells the user the property:<name-or-id> form exists.+func TestRunIssueListInvalidSortMentionsPropertyForm(t *testing.T) {+ t.Setenv("MULTICA_SERVER_URL", "http://127.0.0.1:0")+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "test-token")++ cmd := newIssueListTestCmd()+ _ = cmd.Flags().Set("sort", "bogus")+ err := runIssueList(cmd, nil)+ if err == nil {+ t.Fatal("expected error for invalid --sort")+ }+ if !strings.Contains(err.Error(), "invalid --sort") || !strings.Contains(err.Error(), "property:<name-or-id>") {+ t.Fatalf("error = %q, want it to reject the column and mention property:<name-or-id>", err)+ }+}++// TestRunIssueListFetchesCatalogOnce pins that combining --property and a+// property sort costs a single /api/properties round trip.+func TestRunIssueListFetchesCatalogOnce(t *testing.T) {+ queries, propertiesCalls := newPropertyFilterTestServer(t)+ err := listIssuesWithFlags(t, map[string][]string{+ "property": {"Impact=High"},+ "sort": {"property:Impact"},+ "direction": {"desc"},+ })+ if err != nil {+ t.Fatalf("runIssueList: %v", err)+ }+ if *propertiesCalls != 1 {+ t.Fatalf("property catalog fetched %d times, want exactly once", *propertiesCalls)+ }+ if len(*queries) != 1 {+ t.Fatalf("expected one /api/issues request, got %d", len(*queries))+ }+}diff --git a/server/cmd/multica/cmd_issue_test.go b/server/cmd/multica/cmd_issue_test.goindex 8f8bad44bb..944c5bbd8e 100644--- a/server/cmd/multica/cmd_issue_test.go+++ b/server/cmd/multica/cmd_issue_test.go@@ -2943,6 +2943,7 @@ func newIssueListTestCmd() *cobra.Command {cmd.Flags().String("assignee-id", "", "")cmd.Flags().String("project", "", "")cmd.Flags().StringSlice("metadata", nil, "")+ cmd.Flags().StringArray("property", nil, "")cmd.Flags().Int("limit", 50, "")cmd.Flags().Int("offset", 0, "")cmd.Flags().String("sort", "", "")diff --git a/server/cmd/multica/cmd_property.go b/server/cmd/multica/cmd_property.goindex 8650f85d7a..e33d11107e 100644--- a/server/cmd/multica/cmd_property.go+++ b/server/cmd/multica/cmd_property.go@@ -4,9 +4,13 @@ import ("context""encoding/json""fmt"+ "math"+ "net/url""os""strconv""strings"+ "time"+ "unicode/utf8""github.com/google/uuid""github.com/spf13/cobra"@@ -450,10 +454,15 @@ func resolveActorPropertyRef(ctx context.Context, client *cli.APIClient, raw strreturn "", fmt.Errorf("actor value cannot be empty")}if kind, id, found := strings.Cut(token, ":"); found && kind == "member" {- if _, err := uuid.Parse(strings.TrimSpace(id)); err != nil {+ parsed, err := uuid.Parse(strings.TrimSpace(id))+ if err != nil {return "", fmt.Errorf("actor id in %q must be a UUID", token)}- return kind + ":" + strings.TrimSpace(id), nil+ // Return the canonical lowercase-hyphenated spelling. Stored actor+ // values are normalized on write, and the issue list filter matches+ // the stored string exactly — an uppercase or braced input would+ // store fine via `property set` but silently miss as a filter.+ return kind + ":" + parsed.String(), nil}actorType, actorID, err := resolveAssignee(ctx, client, token, memberOnlyKinds)if err != nil {@@ -462,6 +471,23 @@ func resolveActorPropertyRef(ctx context.Context, client *cli.APIClient, raw strreturn actorType + ":" + actorID, nil}+// resolveSelectOptionRef matches a select/multi_select value reference+// against a definition's options by id first, then case-insensitive name —+// the same addressing contract resolvePropertyRef gives definitions.+func resolveSelectOptionRef(property propertyDTO, ref string) (string, error) {+ ref = strings.TrimSpace(ref)+ for _, opt := range property.Config.Options {+ if opt.ID == ref || strings.EqualFold(opt.Name, ref) {+ return opt.ID, nil+ }+ }+ optionNames := make([]string, len(property.Config.Options))+ for i, opt := range property.Config.Options {+ optionNames[i] = opt.Name+ }+ return "", fmt.Errorf("option %q not found on property %q; valid options: %s", ref, property.Name, strings.Join(optionNames, ", "))+}+// encodeIssuePropertyValue converts the CLI --value string into the typed// JSON the API expects, translating option names to ids for select types and// member names to actor references for actor types.@@ -470,19 +496,10 @@ func encodeIssuePropertyValue(ctx context.Context, client *cli.APIClient, properfor i, opt := range property.Config.Options {optionNames[i] = opt.Name}- resolveOption := func(ref string) (string, error) {- ref = strings.TrimSpace(ref)- for _, opt := range property.Config.Options {- if opt.ID == ref || strings.EqualFold(opt.Name, ref) {- return opt.ID, nil- }- }- return "", fmt.Errorf("option %q not found on property %q; valid options: %s", ref, property.Name, strings.Join(optionNames, ", "))- }switch property.Type {case "select":- id, err := resolveOption(raw)+ id, err := resolveSelectOptionRef(property, raw)if err != nil {return nil, err}@@ -494,7 +511,7 @@ func encodeIssuePropertyValue(ctx context.Context, client *cli.APIClient, properif strings.TrimSpace(part) == "" {continue}- id, err := resolveOption(part)+ id, err := resolveSelectOptionRef(property, part)if err != nil {return nil, err}@@ -794,3 +811,160 @@ func runIssuePropertyUnset(cmd *cobra.Command, args []string) error {fmt.Fprintf(os.Stdout, "Property %q unset.\n", property.Name)return nil}++// ---------------------------------------------------------------------------+// issue list --property / --sort property:<ref>+// ---------------------------------------------------------------------------++// propertyNoValueSentinel is the server's reserved filter value meaning "the+// property is not set" (see parsePropertiesFilterParam in+// internal/handler/property.go). It short-circuits value resolution for every+// property type, so an option or member literally named "__none__" can only be+// filtered by its UUID.+const propertyNoValueSentinel = "__none__"++// Store-side caps from validatePropertyValue in internal/handler/property.go.+// A filter value past them could never match anything.+const (+ maxPropertyTextValueLen = 2000 // runes+ maxPropertyURLValueLen = 2048 // bytes+)++// issueSortablePropertyTypes are the property types the server gives a+// meaningful ORDER BY (see propertySortExpr). This is an allowlist on purpose:+// a type the CLI does not know — multi_select, checkbox, actor kinds, or a+// future type from a newer backend — would be silently degraded to position+// order by the server, and a passed-but-ignored flag is a footgun in scripts.+var issueSortablePropertyTypes = []string{"select", "number", "date", "text", "url"}++// buildPropertiesFilterQueryParam converts repeated `--property Name=Value`+// flags into the JSON object passed as the `properties` query parameter to+// /api/issues. Each flag carries exactly one value; repeating the same+// property ORs its values (server semantics: OR within a definition, AND+// across definitions), keyed by the RESOLVED definition id so name and UUID+// addressing aggregate into one entry.+func buildPropertiesFilterQueryParam(ctx context.Context, client *cli.APIClient, properties []propertyDTO, pairs []string) (string, error) {+ filter := make(map[string][]string, len(pairs))+ for _, pair := range pairs {+ name, rawValue, found := strings.Cut(pair, "=")+ if !found || strings.TrimSpace(name) == "" {+ return "", fmt.Errorf(`--property %q must be in "Name=Value" form`, pair)+ }+ // Reserved so scripts never come to depend on "Impact>" resolving as a+ // property name once >=, <=, != mean comparison filters.+ if n := strings.TrimSpace(name); strings.HasSuffix(n, "<") || strings.HasSuffix(n, ">") || strings.HasSuffix(n, "!") {+ return "", fmt.Errorf(`--property %q: comparison operators are not supported yet; only "Name=Value" is accepted`, pair)+ }+ if strings.TrimSpace(rawValue) == "" {+ return "", fmt.Errorf("--property %s: value cannot be empty (use %s to match issues where the property is unset)", name, propertyNoValueSentinel)+ }+ property, err := resolvePropertyRef(properties, name)+ if err != nil {+ return "", err+ }+ if property.Archived {+ return "", fmt.Errorf("property %q is archived; archived properties are hidden from filtering (matching the web UI) — restore it with `multica property unarchive` if you need it", property.Name)+ }+ value, err := resolvePropertyFilterValue(ctx, client, property, rawValue)+ if err != nil {+ return "", err+ }+ duplicate := false+ for _, existing := range filter[property.ID] {+ if existing == value {+ duplicate = true+ break+ }+ }+ if !duplicate {+ filter[property.ID] = append(filter[property.ID], value)+ }+ }+ buf, err := json.Marshal(filter)+ if err != nil {+ return "", fmt.Errorf("encode properties filter: %w", err)+ }+ return string(buf), nil+}++// resolvePropertyFilterValue turns one human-facing filter value into the+// string the server matches stored values against. The CLI filters the same+// property types the web UI offers — see isFilterablePropertyType in+// packages/core/types/property.ts.+//+// Scalars match by exact containment, so whatever we send has to be spelled+// the way the value was stored. validatePropertyValue keeps text as written,+// trims url and only stores http(s), holds date to YYYY-MM-DD, and caps text+// and url length; the branches below follow it. A value that could never+// match is rejected here rather than sent, because an empty result reads+// like a real answer.+func resolvePropertyFilterValue(ctx context.Context, client *cli.APIClient, property propertyDTO, raw string) (string, error) {+ trimmed := strings.TrimSpace(raw)+ if trimmed == propertyNoValueSentinel {+ return propertyNoValueSentinel, nil+ }+ switch property.Type {+ case "select", "multi_select":+ return resolveSelectOptionRef(property, trimmed)+ case "checkbox":+ if trimmed != "true" && trimmed != "false" {+ return "", fmt.Errorf("--property %s: value %q is not a valid bool (expected true or false)", property.Name, trimmed)+ }+ return trimmed, nil+ case "actor", "multi_actor":+ return resolveActorPropertyRef(ctx, client, trimmed)+ case "number":+ num, err := strconv.ParseFloat(trimmed, 64)+ if err != nil {+ return "", fmt.Errorf("--property %s: value %q is not a valid number", property.Name, trimmed)+ }+ if math.IsNaN(num) || math.IsInf(num, 0) {+ // NaN and infinity have no JSON spelling, so the server never+ // builds a numeric match for them and the filter would come+ // back empty for the wrong reason.+ return "", fmt.Errorf("--property %s: value %q is not a finite number", property.Name, trimmed)+ }+ return trimmed, nil+ case "date":+ if _, err := time.Parse("2006-01-02", trimmed); err != nil {+ return "", fmt.Errorf("--property %s: value %q is not a date in YYYY-MM-DD form", property.Name, trimmed)+ }+ return trimmed, nil+ case "url":+ if len(trimmed) > maxPropertyURLValueLen {+ return "", fmt.Errorf("--property %s: value must be %d characters or fewer", property.Name, maxPropertyURLValueLen)+ }+ if u, err := url.Parse(trimmed); err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {+ return "", fmt.Errorf("--property %s: value %q is not an http(s) URL", property.Name, trimmed)+ }+ return trimmed, nil+ case "text":+ if utf8.RuneCountInString(raw) > maxPropertyTextValueLen {+ return "", fmt.Errorf("--property %s: value must be %d characters or fewer", property.Name, maxPropertyTextValueLen)+ }+ // Text is stored exactly as written, so trimming here would miss a+ // value that genuinely has spaces around it.+ return raw, nil+ default: // a property type only a newer backend knows about+ return "", fmt.Errorf("--property %s: this CLI does not know how to filter %s properties; update with `multica update`, or use the %s unset filter", property.Name, property.Type, propertyNoValueSentinel)+ }+}++// resolveSortableProperty resolves a `--sort property:<ref>` target and+// applies the loud-failure guards for cases the server would silently degrade+// to position order: archived definitions and types with no sort order.+func resolveSortableProperty(properties []propertyDTO, ref string) (propertyDTO, error) {+ property, err := resolvePropertyRef(properties, ref)+ if err != nil {+ return propertyDTO{}, err+ }+ if property.Archived {+ return propertyDTO{}, fmt.Errorf("property %q is archived and the server would fall back to position order; restore it first with `multica property unarchive`", property.Name)+ }+ for _, sortable := range issueSortablePropertyTypes {+ if property.Type == sortable {+ return property, nil+ }+ }+ return propertyDTO{}, fmt.Errorf("%s property %q has no server-side sort order; sortable property types: %s", property.Type, property.Name, strings.Join(issueSortablePropertyTypes, ", "))+}diff --git a/server/internal/handler/issue_table_query_test.go b/server/internal/handler/issue_table_query_test.goindex f9d9b62764..e5f664f879 100644--- a/server/internal/handler/issue_table_query_test.go+++ b/server/internal/handler/issue_table_query_test.go@@ -10,7 +10,10 @@ import ("testing""time"+ "github.com/google/uuid""github.com/jackc/pgx/v5"++ "github.com/multica-ai/multica/server/internal/testutil")type issueTableEnrichmentFailTxStarter struct {@@ -1401,6 +1404,96 @@ func TestIssueTableHierarchyDoesNotCrossGroups(t *testing.T) {}}+// TestIssueTableSelectPropertySortKeysetPagination walks the keyset cursor+// over a select-property sort. The sort expression ranks options by option+// order and carries the "::numeric" token that issueTableOrderBy sniffs into+// the cursor's cast type, so this pins three things at once: ordinal order,+// the numeric cursor round-trip (equal ranks tie, valueless rows trail), and+// no duplicated or skipped rows across pages. Explicit option ids in reverse+// lexical order make the ordinal assertions deterministic — a regression to+// raw-value ordering fails every run, not most runs.+func TestIssueTableSelectPropertySortKeysetPagination(t *testing.T) {+ const (+ lowID = "eeeeeeee-aaaa-4aaa-8aaa-aaaaaaaaaaaa" // lexically last+ mediumID = "99999999-aaaa-4aaa-8aaa-aaaaaaaaaaaa"+ highID = "11111111-aaaa-4aaa-8aaa-aaaaaaaaaaaa" // lexically first+ )+ sel := createTestProperty(t, map[string]any{+ "name": "TK" + uuid.NewString()[:8], "type": "select",+ "config": map[string]any{"options": []map[string]any{+ {"id": lowID, "name": "Low", "color": "#6b7280"},+ {"id": mediumID, "name": "Medium", "color": "#f59e0b"},+ {"id": highID, "name": "High", "color": "#ef4444"},+ }},+ })++ projectID := dbfx.Project(t, "Select property sort pagination")+ seedIssue := func(title string) string {+ t.Helper()+ return dbfx.Issue(t, title, testutil.Cols{"project_id": projectID})+ }+ lowA := seedIssue("keyset low a")+ lowB := seedIssue("keyset low b")+ medium := seedIssue("keyset medium")+ high := seedIssue("keyset high")+ unset := seedIssue("keyset unset")+ for issueID, optionID := range map[string]string{lowA: lowID, lowB: lowID, medium: mediumID, high: highID} {+ if w := setIssuePropertyRaw(t, issueID, sel.ID, optionID); w.Code != http.StatusOK {+ t.Fatalf("seed select value: %d %s", w.Code, w.Body.String())+ }+ }++ query := issueTableQuerySpec{+ Scope: issueTableScope{Kind: "project", ProjectID: projectID},+ Sort: issueTableSortRequest{Field: "property:" + sel.ID, Direction: "asc"},+ }+ fetchPage := func(cursor *string) issueTableRowsResponse {+ t.Helper()+ var response issueTableRowsResponse+ testutil.Call(t, testHandler.ListIssueTableRows, newRequest("POST", "/api/issues/table/rows", issueTableRowsRequest{+ Query: query,+ Group: issueTableGroupSpec{Kind: "none"},+ Page: issueTablePageRequest{Limit: 2, Cursor: cursor},+ })).Want(http.StatusOK).JSON(&response)+ return response+ }++ var order []string+ seen := make(map[string]struct{}, 5)+ cursor := (*string)(nil)+ for page := 0; ; page++ {+ if page > 5 {+ t.Fatalf("cursor did not terminate after %d pages", page)+ }+ response := fetchPage(cursor)+ for _, row := range response.Rows {+ if _, duplicate := seen[row.Issue.ID]; duplicate {+ t.Fatalf("issue %s repeated across pages", row.Issue.ID)+ }+ seen[row.Issue.ID] = struct{}{}+ order = append(order, row.Issue.ID)+ }+ if response.NextCursor == nil {+ break+ }+ cursor = response.NextCursor+ }+ if len(order) != 5 {+ t.Fatalf("paginated rows = %d, want all 5 seeded issues", len(order))+ }++ index := make(map[string]int, len(order))+ for i, id := range order {+ index[id] = i+ }+ if !(index[lowA] < index[medium] && index[lowB] < index[medium]) {+ t.Fatalf("low-ranked issues not first: %v", order)+ }+ if !(index[medium] < index[high] && index[high] < index[unset]) {+ t.Fatalf("option order violated across pages: medium=%d high=%d unset=%d", index[medium], index[high], index[unset])+ }+}+func TestIssueTableHierarchyRootKeysetPagination(t *testing.T) {ctx := context.Background()var projectID stringdiff --git a/server/internal/handler/property.go b/server/internal/handler/property.goindex 4607213d4c..69a24d756a 100644--- a/server/internal/handler/property.go+++ b/server/internal/handler/property.go@@ -1474,13 +1474,50 @@ func (h *Handler) propertySortExpr(r *http.Request, workspaceID string, sortValu}// uuidToString re-serializes the parsed UUID: hex and dashes only, safe// to embed in the ORDER BY string.+ //+ // The literal token "::numeric" in the number and select branches is a+ // contract, not a formatting choice: issueTableOrderBy sniffs it+ // (strings.Contains) to give the keyset cursor a numeric cast instead of+ // text. Writing e.g. "::integer" would silently break table pagination.id := uuidToString(def.ID)switch def.Type {case "number":return fmt.Sprintf("CASE WHEN jsonb_typeof(i.properties->'%s') = 'number' THEN (i.properties->>'%s')::numeric END", id, id), true, nil- case "date", "text", "url", "select":+ case "select":+ return selectPropertySortExpr(id, parsePropertyConfig(def.Config)), true, nil+ case "date", "text", "url":return fmt.Sprintf("NULLIF(i.properties->>'%s', '')", id), true, nildefault: // multi_select, checkbox, future types: no meaningful orderreturn "", true, nil}}++// selectPropertySortExpr ranks a select property's stored value by its+// position in the definition's option list, so an ordinal scale (Low < Medium+// < High) sorts by meaning rather than by the option-id string. A stored value+// no longer in the config — and an issue without the property — yields NULL,+// which the callers order last.+//+// Each CASE arm embeds the option id's ORIGINAL config spelling: explicit ids+// are stored as supplied (validatePropertyConfig trims but does not+// re-serialize), and issue values must equal that spelling exactly, so a+// canonicalized form would never match. Embedding is inert because uuid.Parse+// gates every arm and its accepted grammar (hex, dashes, braces, urn:uuid:+// prefix) admits no quote or backslash. An empty or malformed config — the API+// enforces at least one option, so only a corrupt row — degrades to "" and the+// caller keeps position order, like an unknown definition.+func selectPropertySortExpr(defID string, cfg PropertyConfig) string {+ var b strings.Builder+ rank := 0+ for _, opt := range cfg.Options {+ if _, err := uuid.Parse(opt.ID); err != nil {+ continue+ }+ fmt.Fprintf(&b, " WHEN '%s' THEN %d", opt.ID, rank)+ rank+++ }+ if rank == 0 {+ return ""+ }+ return fmt.Sprintf("(CASE i.properties->>'%s'%s END)::numeric", defID, b.String())+}diff --git a/server/internal/handler/property_test.go b/server/internal/handler/property_test.goindex f592a5c0cd..a73d7cd9ae 100644--- a/server/internal/handler/property_test.go+++ b/server/internal/handler/property_test.go@@ -641,6 +641,71 @@ func TestListIssuesPropertyFilterAndSort(t *testing.T) {}}+// TestListIssuesSelectPropertySortOptionOrder pins the ordinal semantic of a+// select property sort: issues order by the OPTION ORDER of the definition+// (Low < Medium < High), not by the stored option-id string. The explicit+// option ids are chosen so their lexical order is the exact reverse of the+// option order — sorting by the raw stored value (the pre-fix behavior) puts+// High first and fails deterministically. The first id is deliberately+// uppercase: config validation stores an explicit id's original spelling, so+// the CASE arms must embed that spelling, not a re-serialized canonical form.+func TestListIssuesSelectPropertySortOptionOrder(t *testing.T) {+ const (+ lowID = "EEEEEEEE-EEEE-4EEE-8EEE-EEEEEEEEEEEE" // lexically last+ mediumID = "99999999-9999-4999-8999-999999999999"+ highID = "11111111-1111-4111-8111-111111111111" // lexically first+ )+ sel := createTestProperty(t, map[string]any{+ "name": "SO" + uuid.NewString()[:8], "type": "select",+ "config": map[string]any{"options": []map[string]any{+ {"id": lowID, "name": "Low", "color": "#6b7280"},+ {"id": mediumID, "name": "Medium", "color": "#f59e0b"},+ {"id": highID, "name": "High", "color": "#ef4444"},+ }},+ })++ low := dbfx.Issue(t, "select sort low")+ medium := dbfx.Issue(t, "select sort medium")+ high := dbfx.Issue(t, "select sort high")+ unset := dbfx.Issue(t, "select sort unset")+ for issueID, optionID := range map[string]string{low: lowID, medium: mediumID, high: highID} {+ if w := setIssuePropertyRaw(t, issueID, sel.ID, optionID); w.Code != http.StatusOK {+ t.Fatalf("seed select value: %d %s", w.Code, w.Body.String())+ }+ }++ listIssues := func(query string) map[string]int {+ t.Helper()+ var resp struct {+ Issues []IssueResponse `json:"issues"`+ }+ testutil.Call(t, testHandler.ListIssues, newRequest("GET", "/api/issues"+query, nil)).+ Want(http.StatusOK).JSON(&resp)+ out := make(map[string]int, len(resp.Issues))+ for i, issue := range resp.Issues {+ out[issue.ID] = i+ }+ return out+ }++ pos := listIssues("?limit=200&sort=property:" + sel.ID + "&direction=asc")+ for _, id := range []string{low, medium, high, unset} {+ if _, ok := pos[id]; !ok {+ t.Fatalf("asc sorted list missing seeded issue %s", id)+ }+ }+ if !(pos[low] < pos[medium] && pos[medium] < pos[high] && pos[high] < pos[unset]) {+ t.Fatalf("asc select sort not in option order: low=%d medium=%d high=%d unset=%d",+ pos[low], pos[medium], pos[high], pos[unset])+ }++ pos = listIssues("?limit=200&sort=property:" + sel.ID + "&direction=desc")+ if !(pos[high] < pos[medium] && pos[medium] < pos[low] && pos[low] < pos[unset]) {+ t.Fatalf("desc select sort not in reverse option order: high=%d medium=%d low=%d unset=%d",+ pos[high], pos[medium], pos[low], pos[unset])+ }+}+func TestParsePropertiesFilterNoValueUnit(t *testing.T) {defID := uuid.NewString()w := httptest.NewRecorder()diff --git a/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md b/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.mdindex ae6d886f08..2a306296d3 100644--- a/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md+++ b/server/internal/service/builtin_skills/multica-working-on-issues/SKILL.md@@ -179,6 +179,28 @@ multica issue property unset <issue-id> --name Environment- Property vs metadata: if the value is workflow state a human should see andfilter by, and a definition exists, prefer the property. Metadata stays thefree-form bag for durable custom issue state.+- `issue list` filters and sorts by property with the same name addressing:++```bash+multica issue list --property "Impact=High" --property "Impact=Medium" --output json+multica issue list --property "QA Status=__none__" --status in_review --output json+multica issue list --sort property:Impact --direction desc --output json+```++- `--property` takes one `Name=Value` per flag. Repeating the same property+ matches ANY of its values; different properties must ALL match. Values are+ option names or ids (select types), `true`/`false` (checkbox), a member+ name/email/id (actor types), or the value itself for text, url, number,+ and date (`YYYY-MM-DD`). The reserved value `__none__` matches+ issues where the property is unset (works for every type; it is not+ index-backed, so use it for targeted audits rather than as a default+ listing filter). Only `=` is supported today; the `>=`, `<=` and `!=`+ spellings are reserved for comparison filters and are rejected.+- `--sort property:<name-or-id>` orders select properties by option order —+ an ordinal scale (Low < Medium < High) sorts by meaning — and number/date/+ text/url by value; issues without the property sort last either way.+ Archived properties and types without an order (multi_select, checkbox,+ actor kinds) are rejected up front.## Status changes have server side effectsdiff --git a/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md b/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.mdindex 0d96769ad0..68bc7213f2 100644--- a/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md+++ b/server/internal/service/builtin_skills/multica-working-on-issues/references/working-on-issues-source-map.md@@ -204,6 +204,10 @@ about the issue — there is no assignee gate (MUL-6417).|---|---|| `multica property list/get/create/update/archive/unarchive` | `server/cmd/multica/cmd_property.go` || `multica issue property list/set/unset` (name→id translation) | `server/cmd/multica/cmd_property.go` (`encodeIssuePropertyValue`) |+| `issue list --property "Name=Value"` filter (OR within a definition, AND across; `__none__` unset sentinel; scalar values sent in their stored spelling) | `server/cmd/multica/cmd_property.go` (`buildPropertiesFilterQueryParam`, `resolvePropertyFilterValue`, `propertyNoValueSentinel`) |+| `issue list --sort property:<name-or-id>` (archived + orderless types rejected up front) | `server/cmd/multica/cmd_property.go` (`resolveSortableProperty`, `issueSortablePropertyTypes`); `server/cmd/multica/cmd_issue.go` (`runIssueList`) |+| Server `properties=` filter contract the CLI forwards to | `server/internal/handler/property.go` (`parsePropertiesFilterParam`, `noPropertyValue`) |+| Select sort follows option order (ordinal scales sort by meaning) | `server/internal/handler/property.go` (`propertySortExpr`, `selectPropertySortExpr`) || Definition CRUD, admin gate, agent-actor rejection | `server/internal/handler/property.go` (`requirePropertyAdmin`) || Optional catalog icon field and allowlist validation | `server/internal/handler/property.go` (`PropertyResponse`, `validatePropertyIcon`) || Per-type value validation (self-correcting errors) | `server/internal/handler/property.go` (`validatePropertyValue`) |