Skip to content

docs: bare 'Type' in TraceFlow._foutio's autodoc comment is ambiguous across five classes, adding a Sphinx cross-reference warning #709

Description

@JarryShaw

The Sphinx docs build gains a warning when TraceFlow._foutio is rendered, because its autodoc comment
names a bare Type:

pcapkit/foundation/traceflow/traceflow.py:406:    #: Type[Dumper]: Dumper class.

Napoleon resolves that Type against every class of that name in the project, and there are five, so it
emits:

WARNING: more than one target found for cross-reference 'Type'

The same warning already fires 4× on main at base, from other bare Type references; this is a
fifth instance that becomes visible as soon as _foutio carries a directive.

How it surfaced

PR #694 adds an autoattribute for _foutio under the owner's contract-versus-recipe rule (a class
private attribute carrying subclass state is contract and stays documented). The docs build on that
branch goes 55 → 56 warnings, exit 0 both sides, the one new warning being this. make docs runs
sphinx-build -b html without -W, so it does not fail the build — the check is the warning diff.

Why #694 correctly did not fix it

The fix is in pcapkit/, not in docs/, and #694 is a docs-only change that touches no library file.
Its author flagged it rather than either editing outside its ownership or dropping the directive — and
dropping the directive would hide contract to keep a warning count flat, which is the wrong trade.

Suggested fix

Qualify the reference so it resolves uniquely — :class:typing.Type`` or the fully-qualified dumper
type, matching whatever the surrounding #: comments in that file already do for unambiguous names.
Worth sweeping the other four pre-existing bare-`Type` sites in the same change, since they are the same
defect and the count only means something once they are all resolved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdocsPull requests that change documentation only (docs: subject prefix)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions