Skip to content

bug: resolve public lifecycle values from the active Typer Click dialect #356

Description

@codeforester

Problem

The no-argument public get_lifecycle_values() helper fails inside supported Typer 0.27.2 commands even though the framework context and lifecycle are active.

Verified evidence

Reviewed on 2026-09-17 at 2d67cd24e8d704386f2be7d3a41addc06fb81e17 (local checkout matched GitHub main). Reproduced in isolated macOS environments with Python 3.14.6. Framework default probe environment: Click 8.5.0 and Typer 0.27.2. Demo probes used released base-cli 0.4.3 unless noted.

Attach a one-command Typer application with base_cli.attach_typer(..., log_to_file=False). In its callback, base_cli.get_current_context() succeeds but base_cli.get_lifecycle_values() raises:

RuntimeError: Lifecycle option values are not available outside a Click invocation.

base_cli.testing.invoke(..., reraise_unexpected=True) returns exit 1 with that exception. The helper always calls upstream click.get_current_context; Typer's vendored Click has its own active context. Explicit context injection is a possible workaround but does not satisfy the documented optional argument.

Sources:

Acceptance criteria

  • Resolve the active owning dialect when no context is supplied; preserve explicit-context calls and the outside-invocation error.
  • Exercise get_lifecycle_values from single and nested Typer commands on both upstream-Click and vendored-Click supported lines.
  • Assert actual normalized values for root/leaf overrides, not merely successful attachment or get_current_context.
  • Check nested invocation restoration without leaking another command dialect/context.

Related work

Follow-up to closed #107 and #273; separate from JSON preflight issues #338/#339.

Project fields

  • Status: Backlog
  • Priority: P2
  • Area: Python
  • Initiative: v1.0 Readiness
  • Size: S
  • Assignee: @codeforester
  • Milestone: v1.0.0
  • Target date: unscheduled

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

Projects

  • Status
    In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions