Skip to content

fix: add Final annotation to __version__ and document shutdown_cycles (#1059)#1061

Merged
microsasa merged 1 commit intomainfrom
fix/1059-version-final-annotation-and-docs-d22c37395d289124
Apr 23, 2026
Merged

fix: add Final annotation to __version__ and document shutdown_cycles (#1059)#1061
microsasa merged 1 commit intomainfrom
fix/1059-version-final-annotation-and-docs-d22c37395d289124

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #1059

Changes

1. __version__ missing Final annotation

File: src/copilot_usage/__init__.py

Changed __version__: str__version__: Final[str] per coding guidelines requiring Final for module-level constants that should never be reassigned. Final was already imported in the file.

2. SessionSummary.shutdown_cycles absent from implementation.md field table

File: src/copilot_usage/docs/implementation.md

Added the shutdown_cycles row to the SessionSummary fields table, documenting its type (list[tuple[datetime | None, SessionShutdownData]]) and how it's populated by build_session_summary().

3. Regression test for Final annotation

File: tests/test_packaging.py

Added test_version_is_final_str() which asserts that __version__ is annotated as Final[str] using typing.get_origin and typing.get_args, guarding against regression.

Warning

⚠️ Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • astral.sh
  • pypi.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"

See Network Configuration for more information.

Generated by Issue Implementer · ● 8.6M ·

- Change __version__: str → __version__: Final[str] in __init__.py
  per coding guidelines requiring Final for module-level constants
- Add shutdown_cycles row to SessionSummary fields table in
  implementation.md
- Add test_version_is_final_str regression test in test_packaging.py

Closes #1059

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 09:00
@microsasa microsasa added the aw Created by agentic workflow label Apr 23, 2026
@microsasa microsasa enabled auto-merge April 23, 2026 09:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses two small code-health/documentation gaps in copilot_usage: it makes the public __version__ constant explicitly non-reassignable via Final[str], and documents the existing SessionSummary.shutdown_cycles field in the implementation guide. It also adds a regression test to prevent the annotation from being accidentally removed later.

Changes:

  • Annotate copilot_usage.__version__ as Final[str].
  • Document SessionSummary.shutdown_cycles in docs/implementation.md’s field table.
  • Add a packaging regression test asserting the Final[str] annotation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/copilot_usage/__init__.py Updates __version__ typing to Final[str] to match constant conventions.
src/copilot_usage/docs/implementation.md Adds missing shutdown_cycles entry to the SessionSummary fields table.
tests/test_packaging.py Adds a regression test ensuring __version__ remains annotated as Final[str].

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 23, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Low-impact changes: Final type annotation on __version__, documentation gap fill for shutdown_cycles, and a meaningful regression test. All CI checks pass. Auto-approving for merge.

@microsasa microsasa merged commit 2e10f8f into main Apr 23, 2026
8 checks passed
@microsasa microsasa deleted the fix/1059-version-final-annotation-and-docs-d22c37395d289124 branch April 23, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow aw-quality-gate-approved Quality gate approved the PR

Projects

None yet

2 participants