diffusion uri edit prints a Python traceback for a server-side validation error

Open Beginner friendly
#394 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in phabfive/cli/diffusion.py at the uri edit apply call on line 684, then compare it with the uri create handling around lines 573-577 and inspect the other apply sites in the file. Reproduce the command with --io=read and verify rejected edits print the error on stderr, exit 1, and do not show a traceback.

Written by the indexing model from the issue text.

Description

app:diffusion bug

Found while writing docs/diffusion-uri.md (#377, PR #392).

uri edit is the one apply path in phabfive/cli/diffusion.py that does not
catch PhabfiveDataException, so any error Conduit returns reaches the user as
an unhandled traceback.

Environment
  • Python version: 3.14.7
  • Phabfive version: 0.10.0 (main at c4b8e93)
  • Phorge: the local k3d instance from docs/phorge-setup.md
Steps to Reproduce

Phorge validates I/O per URI: an external URI carries a remote, so it accepts
default, none, observe and mirror — not read. Ask for read on one:

phabfive diffusion uri edit uridoc377 git@github.com:dynamist/phabfive.git --io=read --yes

Any rejected edit does this; the I/O mismatch is just the easiest to trigger.
--dry-run is unaffected, since it never reaches the apply.

Expected Behavior

The same shape every other failure in this file produces:

ERROR: ERR-CONDUIT-CORE: Validation errors:
  - Value "read" is not a valid IO setting for this URI. Available types for this URI are: default, none, observe, mirror.

on stderr, exit 1.

Observed Behavior

Two chained tracebacks, ~35 lines, with the useful sentence on the last one:

Traceback (most recent call last):
  File ".../phabfive/diffusion/core.py", line 890, in apply_uri_edit
    self.phab.diffusion.uri.edit(
...
phabricator.APIError: ERR-CONDUIT-CORE: Validation errors:
  - Value "read" is not a valid IO setting for this URI. Available types for this URI are: default, none, observe, mirror.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
  File ".../phabfive/cli/diffusion.py", line 684, in edit
    diffusion.apply_uri_edit(object_id, transactions)
...
phabfive.exceptions.PhabfiveDataException: ERR-CONDUIT-CORE: Validation errors:
  - Value "read" is not a valid IO setting for this URI. Available types for this URI are: default, none, observe, mirror.
Cause

phabfive/cli/diffusion.py:684:

diffusion.apply_uri_edit(object_id, transactions)

bare, where uri create a few lines up (:573-577) has:

try:
    diffusion.apply_uri_create(plan)
except PhabfiveDataException as e:
    typer.echo(f"ERROR: {e}", err=True)
    raise typer.Exit(1)

core.apply_uri_edit already converts APIError to PhabfiveDataException,
so the exception arrives in the right type — nothing catches it.

Worth checking the other apply sites in the file at the same time rather than
patching this one line in isolation.

🤖 Generated with Claude Code

Dominant language
Python
Stars
6
Forks
4
Avg merge
51m
Merged PRs (30d)
103

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dynamist/phabfive

All issues in dynamist/phabfive

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.