Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(cli): add updated time range filters to issue list (#9994)

gogodjzhu98846ce564a6
diff --git a/apps/docs/content/docs/cli.fr.mdx b/apps/docs/content/docs/cli.fr.mdx
index 585d17dad1..1e34c1360c 100644
--- a/apps/docs/content/docs/cli.fr.mdx
+++ b/apps/docs/content/docs/cli.fr.mdx
@@ -172,6 +172,15 @@ multica issue comment list MUL-123 --thread <comment-id> --tail 5 --output json
Les listes peuvent aussi se limiter aux champs utiles : `multica issue list --output json --fields id,identifier,title,status`. Le filtrage a lieu dans la CLI : il réduit la sortie et le contexte, pas la requête.
+Pour lister les tâches selon leur dernière mise à jour, fournissez ensemble `--updated-since` et `--updated-until` au format RFC3339. Le serveur renvoie les tâches dont la valeur actuelle de `updated_at` est supérieure ou égale à `since` et strictement inférieure à `until` : `[since, until)`. Ces options se combinent avec les filtres, le tri et la pagination existants. Gardez les mêmes bornes entre les pages ; des mises à jour simultanées peuvent modifier les résultats, car la pagination ne fournit pas d'instantané.
+
+```bash
+multica issue list --updated-since 2026-11-05T10:00:00Z \
+ --updated-until 2026-11-05T10:01:00Z \
+ --sort created_at --direction asc --limit 100 --offset 0 \
+ --output json --fields id,workspace_id,project_id,title
+```
+
### Réveils
Un réveil lance une exécution ordinaire d'un agent quand un événement se produit, qu'une condition devient vraie ou qu'une heure arrive. Les règles complètes figurent dans [Réveils de tâche](/issue-wakeups).
@@ -355,7 +364,7 @@ Les tableaux ci-dessous couvrent toutes les commandes de premier niveau actuelle
| Commande | Sous-commande | Rôle | Options principales |
| --- | --- | --- | --- |
-| `issue` | `list` | Lister les tâches | `--status`, `--priority`, `--assignee`, `--project`, `--metadata` (répétable), `--property` (répétable, `"Name=Value"` ; `__none__` correspond à une valeur non définie), `--limit`, `--offset`, `--sort` (y compris `property:<name-or-id>`), `--full-id`, `--resolve-properties` (JSON uniquement ; lignes avec les noms de propriété, d'option et de membre à côté des ID enregistrés), `--fields` (JSON uniquement ; champs à conserver, séparés par des virgules) |
+| `issue` | `list` | Lister les tâches | `--status`, `--priority`, `--assignee`, `--project`, `--updated-since` / `--updated-until` (bornes RFC3339 à fournir ensemble), `--metadata` (répétable), `--property` (répétable, `"Name=Value"` ; `__none__` correspond à une valeur non définie), `--limit`, `--offset`, `--sort` (y compris `property:<name-or-id>`), `--full-id`, `--resolve-properties` (JSON uniquement ; lignes avec les noms de propriété, d'option et de membre à côté des ID enregistrés), `--fields` (JSON uniquement ; champs à conserver, séparés par des virgules) |
| | `get <id>` | Afficher une tâche | `--resolve-properties` (JSON uniquement ; lignes avec les noms de propriété, d'option et de membre à côté des ID enregistrés) |
| | `create` | Créer une tâche | `--title` (obligatoire), `--description` / `--description-stdin` / `--description-file`, `--status`, `--priority`, `--assignee`, `--parent`, `--stage`, `--project`, `--start-date`, `--due-date`, `--attachment` (répétable), `--property` (répétable), `--allow-duplicate` (crée même si une tâche ouverte porte le même titre) |
| | `update <id>` | Mettre à jour les champs d'une tâche | Mêmes champs que `create`, plus `--position`, `--no-start`, `--duplicate-of` |
diff --git a/apps/docs/content/docs/cli.ja.mdx b/apps/docs/content/docs/cli.ja.mdx
index 5cb2b7a330..310e2a747f 100644
--- a/apps/docs/content/docs/cli.ja.mdx
+++ b/apps/docs/content/docs/cli.ja.mdx
@@ -172,6 +172,15 @@ multica issue comment list MUL-123 --thread <comment-id> --tail 5 --output json
一覧も必要なフィールドだけに絞れます:`multica issue list --output json --fields id,identifier,title,status`。絞り込みは CLI 側で行われるので、減るのは出力とコンテキストで、リクエストの量は変わりません。
+最終更新日時でタスクを絞り込むには、RFC3339 形式の `--updated-since` と `--updated-until` を両方指定します。サーバーは、現在の `updated_at` が `since` 以上、`until` 未満のタスクを返します:`[since, until)`。既存のフィルター、並べ替え、ページネーションと組み合わせて使えます。ページ間で同じ期間を指定してください。ページネーションはスナップショットを提供しないため、同時に更新が行われると結果が変わる場合があります。
+
+```bash
+multica issue list --updated-since 2026-11-05T10:00:00Z \
+ --updated-until 2026-11-05T10:01:00Z \
+ --sort created_at --direction asc --limit 100 --offset 0 \
+ --output json --fields id,workspace_id,project_id,title
+```
+
### ウェイクアップ
ウェイクアップは、イベントが起きたとき、条件が成り立ったとき、または指定の時刻に、エージェントの通常の実行を始めます。詳しいルールは[タスクのウェイクアップ](/issue-wakeups)を参照してください。
@@ -347,7 +356,7 @@ CLI の設定ファイルには、あなたとして Multica にアクセスで
| コマンド | サブコマンド | 用途 | 主なフラグ |
| --- | --- | --- | --- |
-| `issue` | `list` | タスクを一覧 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(繰り返し可)、`--property`(繰り返し可、`"名前=値"` または `"Score>=3"`、`"Due<2026-01-01"`、`"Notes~=text"` のような比較;`__none__` は未設定に一致)、`--limit`、`--offset`、`--sort`(`property:<名前または id>` に対応)、`--full-id`、`--resolve-properties`(JSON のみ;保存された id に加えてプロパティ名・選択肢名・メンバー名を返します)、`--fields`(JSON のみ;カンマ区切りで残すフィールドを指定) |
+| `issue` | `list` | タスクを一覧 | `--status`、`--priority`、`--assignee`、`--project`、`--updated-since` / `--updated-until`(RFC3339 の期間指定、両方必須)、`--metadata`(繰り返し可)、`--property`(繰り返し可、`"名前=値"` または `"Score>=3"`、`"Due<2026-01-01"`、`"Notes~=text"` のような比較;`__none__` は未設定に一致)、`--limit`、`--offset`、`--sort`(`property:<名前または id>` に対応)、`--full-id`、`--resolve-properties`(JSON のみ;保存された id に加えてプロパティ名・選択肢名・メンバー名を返します)、`--fields`(JSON のみ;カンマ区切りで残すフィールドを指定) |
| | `get <id>` | 単一のタスクを表示 | `--resolve-properties`(JSON のみ;保存された id に加えてプロパティ名・選択肢名・メンバー名を返します) |
| | `create` | タスクを作成 | `--title`(必須)、`--description` / `--description-stdin` / `--description-file`、`--status`、`--priority`、`--assignee`、`--parent`、`--stage`、`--project`、`--start-date`、`--due-date`、`--attachment`(繰り返し可)、`--property`(繰り返し可)、`--allow-duplicate`(同じタイトルの未完了タスクがあっても作成) |
| | `update <id>` | タスクのフィールドを更新 | `create` と同系のフィールドに加え `--position`、`--no-start`、`--duplicate-of` |
diff --git a/apps/docs/content/docs/cli.ko.mdx b/apps/docs/content/docs/cli.ko.mdx
index 9d68bbe35e..a28a944196 100644
--- a/apps/docs/content/docs/cli.ko.mdx
+++ b/apps/docs/content/docs/cli.ko.mdx
@@ -172,6 +172,15 @@ multica issue comment list MUL-123 --thread <comment-id> --tail 5 --output json
목록도 필요한 필드만 받을 수 있습니다: `multica issue list --output json --fields id,identifier,title,status`. 필터링은 CLI에서 이루어지므로 줄어드는 것은 출력과 컨텍스트이고 요청량은 그대로입니다.
+마지막 업데이트 시각으로 태스크를 필터링하려면 RFC3339 타임스탬프로 `--updated-since`와 `--updated-until`을 함께 지정하세요. 서버는 현재 `updated_at`이 `since` 이상, `until` 미만인 태스크를 반환합니다: `[since, until)`. 기존 필터, 정렬, 페이지네이션과 함께 사용할 수 있습니다. 페이지를 넘길 때 같은 범위를 유지하세요. 페이지네이션은 스냅샷을 제공하지 않으므로 동시에 업데이트가 발생하면 결과가 달라질 수 있습니다.
+
+```bash
+multica issue list --updated-since 2026-11-05T10:00:00Z \
+ --updated-until 2026-11-05T10:01:00Z \
+ --sort created_at --direction asc --limit 100 --offset 0 \
+ --output json --fields id,workspace_id,project_id,title
+```
+
### 깨우기
깨우기는 이벤트가 생기거나 조건이 충족되거나 지정한 시각이 되면 에이전트의 일반 실행을 시작합니다. 전체 규칙은 [태스크 깨우기](/issue-wakeups)를 참고하세요.
@@ -347,7 +356,7 @@ CLI 설정 파일에는 사용자를 대신해 Multica에 접근할 수 있는 t
| 명령 | 하위 명령 | 용도 | 주요 flag |
| --- | --- | --- | --- |
-| `issue` | `list` | 태스크 목록 | `--status`, `--priority`, `--assignee`, `--project`, `--metadata`(반복 가능), `--property`(반복 가능, `"이름=값"` 또는 `"Score>=3"`, `"Due<2026-01-01"`, `"Notes~=text"` 같은 비교; `__none__`은 미설정과 일치), `--limit`, `--offset`, `--sort`(`property:<이름 또는 id>` 지원), `--full-id`, `--resolve-properties`(JSON 전용; 저장된 id와 함께 속성, 옵션, 멤버 이름을 반환), `--fields`(JSON 전용. 남길 필드를 쉼표로 구분) |
+| `issue` | `list` | 태스크 목록 | `--status`, `--priority`, `--assignee`, `--project`, `--updated-since` / `--updated-until`(RFC3339 범위, 함께 지정), `--metadata`(반복 가능), `--property`(반복 가능, `"이름=값"` 또는 `"Score>=3"`, `"Due<2026-01-01"`, `"Notes~=text"` 같은 비교; `__none__`은 미설정과 일치), `--limit`, `--offset`, `--sort`(`property:<이름 또는 id>` 지원), `--full-id`, `--resolve-properties`(JSON 전용; 저장된 id와 함께 속성, 옵션, 멤버 이름을 반환), `--fields`(JSON 전용. 남길 필드를 쉼표로 구분) |
| | `get <id>` | 태스크 하나 확인 | `--resolve-properties`(JSON 전용; 저장된 id와 함께 속성, 옵션, 멤버 이름을 반환) |
| | `create` | 태스크 생성 | `--title`(필수), `--description` / `--description-stdin` / `--description-file`, `--status`, `--priority`, `--assignee`, `--parent`, `--stage`, `--project`, `--start-date`, `--due-date`, `--attachment`(반복 가능), `--property`(반복 가능), `--allow-duplicate`(같은 제목의 닫히지 않은 태스크가 있어도 생성) |
| | `update <id>` | 태스크 필드 업데이트 | `create`와 같은 종류의 필드에 `--position`, `--no-start`, `--duplicate-of` 추가 |
diff --git a/apps/docs/content/docs/cli.mdx b/apps/docs/content/docs/cli.mdx
index 34e3e37a09..3207bbaa54 100644
--- a/apps/docs/content/docs/cli.mdx
+++ b/apps/docs/content/docs/cli.mdx
@@ -172,6 +172,15 @@ multica issue comment list MUL-123 --thread <comment-id> --tail 5 --output json
Lists can be trimmed to the fields you need, too: `multica issue list --output json --fields id,identifier,title,status`. The filtering happens in the CLI, so it shrinks output and context, not the request.
+To list issues by their last update time, pass both `--updated-since` and `--updated-until` as RFC3339 timestamps. The server returns issues whose current `updated_at` is at or after `since` and before `until`: `[since, until)`. These flags work with existing filters, sorting, and pagination. Keep the same bounds across pages; concurrent updates can change the result set because pagination does not provide a snapshot.
+
+```bash
+multica issue list --updated-since 2026-11-05T10:00:00Z \
+ --updated-until 2026-11-05T10:01:00Z \
+ --sort created_at --direction asc --limit 100 --offset 0 \
+ --output json --fields id,workspace_id,project_id,title
+```
+
### Wakeups
A wakeup starts an ordinary run for an agent when an event happens, a condition becomes true, or a time arrives. The full rules are in [Issue wakeups](/issue-wakeups).
@@ -377,7 +386,7 @@ Migration from CSV parsing: replace `--attachment a,b` with `--attachment a --at
| Command | Subcommand | Purpose | Key flags |
| --- | --- | --- | --- |
-| `issue` | `list` | List issues | `--status`, `--priority`, `--assignee`, `--project`, `--metadata` (repeatable), `--property` (repeatable, `"Name=Value"` or a comparison such as `"Score>=3"`, `"Due<2026-01-01"`, `"Notes~=text"`; `__none__` matches unset), `--limit`, `--offset`, `--sort` (incl. `property:<name-or-id>`), `--full-id`, `--fields` (JSON only; comma-separated fields to keep), `--resolve-properties` (JSON only; rows with property, option and member names beside the stored ids) |
+| `issue` | `list` | List issues | `--status`, `--priority`, `--assignee`, `--project`, `--updated-since` / `--updated-until` (paired RFC3339 bounds), `--metadata` (repeatable), `--property` (repeatable, `"Name=Value"` or a comparison such as `"Score>=3"`, `"Due<2026-01-01"`, `"Notes~=text"`; `__none__` matches unset), `--limit`, `--offset`, `--sort` (incl. `property:<name-or-id>`), `--full-id`, `--fields` (JSON only; comma-separated fields to keep), `--resolve-properties` (JSON only; rows with property, option and member names beside the stored ids) |
| | `get <id>` | Show a single issue | `--resolve-properties` (JSON only; rows with property, option and member names beside the stored ids) |
| | `create` | Create an issue | `--title` (required), `--description` / `--description-stdin` / `--description-file`, `--status`, `--priority`, `--assignee`, `--parent`, `--stage`, `--project`, `--start-date`, `--due-date`, `--attachment` (repeatable), `--property` (repeatable), `--allow-duplicate` (create even when an open issue with the same title exists) |
| | `update <id>` | Update issue fields | Same fields as `create`, plus `--position`, `--no-start`, `--duplicate-of` |
diff --git a/apps/docs/content/docs/cli.zh.mdx b/apps/docs/content/docs/cli.zh.mdx
index fea6165982..bb761fe8b3 100644
--- a/apps/docs/content/docs/cli.zh.mdx
+++ b/apps/docs/content/docs/cli.zh.mdx
@@ -172,6 +172,15 @@ multica issue comment list MUL-123 --thread <comment-id> --tail 5 --output json
列表也可以只取需要的字段:`multica issue list --output json --fields id,identifier,title,status`。筛选在 CLI 本地完成,减少的是输出和上下文,不是请求量。
+按最近更新时间列出任务时,同时传入 RFC3339 时间戳 `--updated-since` 和 `--updated-until`。服务端返回当前 `updated_at` 大于等于 `since`、小于 `until` 的任务,即 `[since, until)`。这两个参数可与现有筛选、排序和分页参数组合使用。翻页时保持时间范围一致;分页不提供快照,并发更新可能改变结果集。
+
+```bash
+multica issue list --updated-since 2026-11-05T10:00:00Z \
+ --updated-until 2026-11-05T10:01:00Z \
+ --sort created_at --direction asc --limit 100 --offset 0 \
+ --output json --fields id,workspace_id,project_id,title
+```
+
### 唤醒
唤醒让智能体在某个事件发生、某个条件成立或到点时开始一次普通运行。完整规则见[任务唤醒](/issue-wakeups)。
@@ -354,7 +363,7 @@ CLI 配置文件包含可代表你访问 Multica 的令牌。不要提交到仓
| 命令 | 子命令 | 用途 | 关键 flag |
| --- | --- | --- | --- |
-| `issue` | `list` | 列出任务 | `--status`、`--priority`、`--assignee`、`--project`、`--metadata`(可重复)、`--property`(可重复,`"名称=值"` 或 `"Score>=3"`、`"Due<2026-01-01"`、`"Notes~=text"` 这样的比较;`__none__` 匹配未设置)、`--limit`、`--offset`、`--sort`(支持 `property:<名称或 id>`)、`--full-id`、`--fields`(仅 JSON;逗号分隔,只输出这些字段)、`--resolve-properties`(仅 JSON;在保存的 id 旁附上属性、选项和成员名称) |
+| `issue` | `list` | 列出任务 | `--status`、`--priority`、`--assignee`、`--project`、`--updated-since` / `--updated-until`(配套的 RFC3339 时间范围)、`--metadata`(可重复)、`--property`(可重复,`"名称=值"` 或 `"Score>=3"`、`"Due<2026-01-01"`、`"Notes~=text"` 这样的比较;`__none__` 匹配未设置)、`--limit`、`--offset`、`--sort`(支持 `property:<名称或 id>`)、`--full-id`、`--fields`(仅 JSON;逗号分隔,只输出这些字段)、`--resolve-properties`(仅 JSON;在保存的 id 旁附上属性、选项和成员名称) |
| | `get <id>` | 查看单个任务 | `--resolve-properties`(仅 JSON;在保存的 id 旁附上属性、选项和成员名称) |
| | `create` | 创建任务 | `--title`(必填)、`--description` / `--description-stdin` / `--description-file`、`--status`、`--priority`、`--assignee`、`--parent`、`--stage`、`--project`、`--start-date`、`--due-date`、`--attachment`(可重复)、`--property`(可重复)、`--allow-duplicate`(已有同名未关闭任务时仍创建) |
| | `update <id>` | 更新任务字段 | 与 `create` 同类字段,另有 `--position`、`--no-start`、`--duplicate-of` |
diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.go
index 5eb61ded1e..cda593b0e5 100644
--- a/server/cmd/multica/cmd_issue.go
+++ b/server/cmd/multica/cmd_issue.go
@@ -640,6 +640,8 @@ func init() {
issueListCmd.Flags().String("assignee", "", "Filter by assignee name (member, agent, or squad; fuzzy match)")
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().String("updated-since", "", "Include issues updated at or after this RFC3339 timestamp; requires --updated-until (keep both bounds fixed across pages)")
+ issueListCmd.Flags().String("updated-until", "", "Include issues updated before this RFC3339 timestamp; requires --updated-since")
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" or as a comparison such as "Score>=3", "Ship Date<2026-01-01" or "Notes~=review" (repeatable, one member per flag; quote it so the shell does not read < and > as redirection). Name is a property name (case-insensitive) or its UUID; a name containing =, <, >, ! or ~ has to be given by UUID. 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. Repeating a property matches ANY of its members; different properties must ALL match. The per-type value forms and comparisons are in the command description above.`)
issueListCmd.Flags().Int("limit", 50, fmt.Sprintf("Page size, 1 to %d (the server returns at most %d issues per request; use --offset to page through more)", issueListMaxPageSize, issueListMaxPageSize))
@@ -827,6 +829,27 @@ func runIssueList(cmd *cobra.Command, _ []string) error {
params := url.Values{}
params.Set("workspace_id", client.WorkspaceID)
+ since, _ := cmd.Flags().GetString("updated-since")
+ until, _ := cmd.Flags().GetString("updated-until")
+ if cmd.Flags().Changed("updated-since") != cmd.Flags().Changed("updated-until") {
+ return fmt.Errorf("--updated-since and --updated-until must be set together")
+ }
+ if cmd.Flags().Changed("updated-since") {
+ start, err := time.Parse(time.RFC3339Nano, since)
+ if err != nil {
+ return fmt.Errorf("invalid --updated-since; expected an RFC3339 timestamp: %w", err)
+ }
+ end, err := time.Parse(time.RFC3339Nano, until)
+ if err != nil {
+ return fmt.Errorf("invalid --updated-until; expected an RFC3339 timestamp: %w", err)
+ }
+ if !start.Before(end) {
+ return fmt.Errorf("--updated-since must be before --updated-until")
+ }
+ params.Set("date_field", "updated_at")
+ params.Set("date_start", since)
+ params.Set("date_end", until)
+ }
if v, _ := cmd.Flags().GetString("status"); v != "" {
params.Set("status", v)
}
diff --git a/server/cmd/multica/cmd_issue_test.go b/server/cmd/multica/cmd_issue_test.go
index 3ece03009d..213f1c659a 100644
--- a/server/cmd/multica/cmd_issue_test.go
+++ b/server/cmd/multica/cmd_issue_test.go
@@ -3955,6 +3955,8 @@ func newIssueListTestCmd() *cobra.Command {
cmd.Flags().String("assignee", "", "")
cmd.Flags().String("assignee-id", "", "")
cmd.Flags().String("project", "", "")
+ cmd.Flags().String("updated-since", "", "")
+ cmd.Flags().String("updated-until", "", "")
cmd.Flags().StringSlice("metadata", nil, "")
cmd.Flags().StringArray("property", nil, "")
cmd.Flags().Int("limit", 50, "")
@@ -5652,6 +5654,114 @@ func TestRunIssueListRejectsOutOfRangeLimitAndOffset(t *testing.T) {
}
}
+func TestRunIssueListUpdatedRange(t *testing.T) {
+ const (
+ since = "2026-11-05T10:00:00.123456789+08:00"
+ until = "2026-11-05T02:01:00.987654321Z"
+ project = "12345678-1234-4234-8234-123456789abc"
+ )
+ for _, filtered := range []bool{false, true} {
+ t.Run(fmt.Sprintf("filtered=%t", filtered), func(t *testing.T) {
+ srv, requests, query := newFakeIssueListServer(t, fakeIssueRows(1), 1)
+ t.Setenv("MULTICA_SERVER_URL", srv.URL)
+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")
+ t.Setenv("MULTICA_TOKEN", "test-token")
+
+ cmd := newIssueListTestCmd()
+ flags := []string{
+ "--output", "json", "--project", project, "--fields", "id,title",
+ "--limit", "100", "--offset", "200", "--sort", "created_at", "--direction", "asc",
+ }
+ if filtered {
+ flags = append(flags, "--updated-since", since, "--updated-until", until)
+ }
+ if err := cmd.ParseFlags(flags); err != nil {
+ t.Fatal(err)
+ }
+ out, err := captureStdout(t, func() error { return runIssueList(cmd, nil) })
+ if err != nil {
+ t.Fatalf("runIssueList: %v", err)
+ }
+ if *requests != 1 {
+ t.Fatalf("list requests = %d, want 1", *requests)
+ }
+ want := url.Values{
+ "workspace_id": {"ws-1"}, "project_id": {project},
+ "limit": {"100"}, "offset": {"200"}, "sort": {"created_at"}, "direction": {"asc"},
+ }
+ if filtered {
+ want.Set("date_field", "updated_at")
+ want.Set("date_start", since)
+ want.Set("date_end", until)
+ }
+ if !reflect.DeepEqual(*query, want) {
+ t.Fatalf("query = %v, want %v", *query, want)
+ }
+ var envelope struct {
+ Issues []map[string]any `json:"issues"`
+ Total int `json:"total"`
+ Limit int `json:"limit"`
+ Offset int `json:"offset"`
+ HasMore bool `json:"has_more"`
+ }
+ if err := json.Unmarshal([]byte(out), &envelope); err != nil {
+ t.Fatal(err)
+ }
+ if len(envelope.Issues) != 1 || len(envelope.Issues[0]) != 2 || envelope.Issues[0]["id"] == nil || envelope.Issues[0]["title"] == nil {
+ t.Fatalf("projected issues = %v, want one issue with id and title", envelope.Issues)
+ }
+ if envelope.Total != 1 || envelope.Limit != 100 || envelope.Offset != 200 || envelope.HasMore {
+ t.Fatalf("unexpected pagination envelope: %+v", envelope)
+ }
+ })
+ }
+}
+
+func TestRunIssueListRejectsInvalidUpdatedRange(t *testing.T) {
+ const since = "2026-11-05T10:00:00Z"
+ const until = "2026-11-05T10:01:00Z"
+ cases := []struct {
+ name string
+ flags []string
+ wantErr string
+ }{
+ {"missing until", []string{"--updated-since", since}, "--updated-since and --updated-until must be set together"},
+ {"missing since", []string{"--updated-until", until}, "--updated-since and --updated-until must be set together"},
+ {"empty since", []string{"--updated-since=", "--updated-until", until}, "invalid --updated-since"},
+ {"empty until", []string{"--updated-since", since, "--updated-until="}, "invalid --updated-until"},
+ {"both empty", []string{"--updated-since=", "--updated-until="}, "invalid --updated-since"},
+ {"invalid since", []string{"--updated-since", "yesterday", "--updated-until", until}, "invalid --updated-since"},
+ {"invalid until", []string{"--updated-since", since, "--updated-until", "2026-11-05"}, "invalid --updated-until"},
+ {"equal bounds", []string{"--updated-since", since, "--updated-until", since}, "--updated-since must be before --updated-until"},
+ {"reversed bounds", []string{"--updated-since", until, "--updated-until", since}, "--updated-since must be before --updated-until"},
+ {"reversed across timezones", []string{"--updated-since", since, "--updated-until", "2026-11-05T11:00:00+02:00"}, "--updated-since must be before --updated-until"},
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ requests := 0
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ requests++
+ _, _ = w.Write([]byte(`{}`))
+ }))
+ defer srv.Close()
+ t.Setenv("MULTICA_SERVER_URL", srv.URL)
+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")
+ t.Setenv("MULTICA_TOKEN", "test-token")
+ cmd := newIssueListTestCmd()
+ if err := cmd.ParseFlags(append(tc.flags, "--assignee", "someone")); err != nil {
+ t.Fatal(err)
+ }
+ err := runIssueList(cmd, nil)
+ if err == nil || !strings.Contains(err.Error(), tc.wantErr) {
+ t.Fatalf("error = %v, want %q", err, tc.wantErr)
+ }
+ if requests != 0 {
+ t.Fatalf("received %d requests; invalid bounds must fail before resolving filters", requests)
+ }
+ })
+ }
+}
+
// TestRunIssueListSendsLimitAndOffset guards that limit and offset reach the
// query as given.
func TestRunIssueListSendsLimitAndOffset(t *testing.T) {