Skip to content

fix(cli): show full task and parent IDs in rich views (#1340) - #1658

Queued
prateeknitcse wants to merge 2 commits into
pyrite-wiki:devfrom
prateeknitcse:fix/1340-task-rich-full-ids
Queued

prateeknitcse wants to merge 2 commits into
pyrite-wiki:devfrom
prateeknitcse:fix/1340-task-rich-full-ids

Conversation

@prateeknitcse

@prateeknitcse prateeknitcse commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1340. Supercedes stale duplicate #1341.

Summary of Changes

  • In pyrite/cli/task_commands.py:
    • In _render_list (task list --format rich): removed 12-character slicing on task ID and parent ID, replacing max_width=12 with overflow="fold" so full IDs display without truncation.
    • In _render_task (task get --format rich): removed 12-character slicing on child task IDs.
  • Added regression tests in tests/test_task_rich_ids.py using cli_world fixture (without patching load_config), verifying full IDs and narrow terminal column reassembly.
  • Added changelog fragment changelog.d/1340-task-rich-full-ids.fixed.md.

@markramm markramm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking #1340. The change is the small one the groom asked for: the 12-character slices are gone from _render_list (ID and Parent) and from the child lines in _render_task, and the columns use overflow="fold" so long IDs wrap instead of being cut. The diff to pyrite/cli/task_commands.py is only +5/-5, built on current dev, which is exactly right. One blocking item: the new test file will trip a repository guard test.

Blocking

  1. tests/test_task_rich_ids.py, fixture long_id_task_cli_env: with patch("pyrite.cli.context.load_config", return_value=config): is a patch of load_config, which tests/test_production_wiring_guard.py::test_no_file_adds_a_site counts (baseline 0) and fails on ("1 load_config site(s), baseline 0"). Patching it skips config parsing and the untrusted-config rules the real command runs. Please switch to the cli_world fixture from tests/conftest.py, which runs the real load_config against a throwaway config. Create the parent and child tasks through world (or the task service it exposes) and call world.cli("task", "list", ...). To set the width, pass COLUMNS the way other tests in the repo do with cli_world; look at how a neighbouring test sets terminal width. The guard test is in the shards still running as I write (see CI below), so I expect it to go red.

Non-blocking

  • The narrow-terminal test (COLUMNS=60) asserts "write-th" in res.output and "form" in res.output. That depends on where Rich chooses to fold, and could break on a Rich upgrade. Asserting that the full ID can be reassembled (strip newlines, borders and spaces from each row, then check) is more robust. The groom also says the Title column should give up width first; adding min_width to the ID column (or no_wrap=False plus a ratio on Title) would make that explicit, but folding already avoids the truncation the issue is about.
  • The fixture's inline comments name IDs ("parent-epic-for-login", "exactly twel") that are only illustrative; the IDs are generated from the titles. The 12-char case is titled "Exactly twel" but the generated ID is probably a slug of different length. If you want a real 12-character ID, assert len(exact_id) == 12 in the fixture so the test checks what it claims.
  • Optional: a task with no parent (empty Parent cell) is a regime the groom lists; the exact task covers it implicitly, but an assertion that the cell is empty would be explicit.
  • This reuses a pattern from tests/test_task_cli_get.py:30 (task_cli_env); you could import or extend that fixture rather than build a new one.

Duplicate: #1341 (HarshRajSinghania, opened 2026-10-25) also closes #1340. It has been reviewed twice and is state: needs-author; its branch is based on a very stale dev and conflicts, with a large unrelated rewrite of task_commands.py. This PR is the cleaner of the two, so the maintainer will likely prefer it once the test is fixed. Please mention #1341 in your PR description so the maintainer can close it.

CI: changes, lock, collect, mypy (advisory), experimental and test (3.12, 1) passed; test (3.12, 2) and test (3.12, 3) were pending when I looked. A coverage/e2e/frontend/kb/smoke jobs were skipped.

Triggers: none. 3 files, CLI rich rendering only; no flag, REST field, MCP argument or file format changes, and nothing in pyrite/server/, storage/, schema/ or auth. JSON output (the default) is untouched, and MCP/REST are unaffected, as the groom states. The only wrinkle is the competing PR #1341.

There is a changelog fragment (changelog.d/1340-task-rich-full-ids.fixed.md).

Recommendation: request changes.

@markramm markramm added the state: needs-author Changes requested on the current head: the next move is the author's label Nov 17, 2026

@markramm markramm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the new head 5a4867d.

Previous items:

  1. tests/test_task_rich_ids.py patched load_config (guard baseline 0): fixed. The fixture long_id_task_world now builds a cli_world with a KBConfig, creates the tasks through world.cli("task", "create", ...), and calls the command inside world.pointed() (tests/_world.py:158). The file has no patch, monkeypatch.setattr or get_db names, so the counts tests/test_production_wiring_guard.py looks for (load_config, get_db) stay at 0.

Also addressed from the non-blocking list: the narrow-terminal test now reassembles the folded ID and Parent columns instead of matching a fold point, and the fixture asserts len(exact_id) == 12.

New blocking findings: none. The production change in pyrite/cli/task_commands.py is unchanged from the reviewed version.

Non-blocking:

  • test_task_list_rich_narrow_terminal_folds_without_crash: the Parent column is read as line.split("│")[6], which depends on the column order and count; if a column is added the test breaks quietly. Locating the column by its header would be sturdier.
  • Please mention #1341 (older PR for #1340) in the PR description so the maintainer can close it.

Recommendation: merge.

@markramm markramm added state: needs-maintainer Reviewed clean; the maintainer merges (storage, server, schema or a public shape) and removed state: needs-author Changes requested on the current head: the next move is the author's labels Nov 17, 2026
@markramm
markramm added this pull request to the merge queue Nov 17, 2026
@markramm markramm added state: queued In the merge queue and removed state: needs-maintainer Reviewed clean; the maintainer merges (storage, server, schema or a public shape) labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: queued In the merge queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task list and task status (rich) cut task and parent ids to 12 characters

2 participants