Skip to content

feat: get default page title from context#43

Merged
olivermeyer merged 3 commits into
mainfrom
feat/default-title
Apr 10, 2026
Merged

feat: get default page title from context#43
olivermeyer merged 3 commits into
mainfrom
feat/default-title

Conversation

@olivermeyer
Copy link
Copy Markdown
Collaborator

@olivermeyer olivermeyer commented Apr 10, 2026

Two unrelated changes:

  • 710f1f5 gets the page title from the context at runtime, to avoid having to set it with every decorator use (e.g. page_public(..., title="My Title"))
  • 4de16fd removes duplicate test helpers and fixtures
  • 1e088df refactors gui.auth for SonarQube

All five page_* decorators and GUINamespace methods now accept
title: str | None = None. When None, the wrapper resolves the title
lazily at request time via get_context().name.title(), ensuring every
page gets a sensible default without callers having to repeat the
project name.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@olivermeyer olivermeyer requested a review from a team as a code owner April 10, 2026 09:02
@olivermeyer olivermeyer added the claude Trigger Claude Code automation label Apr 10, 2026
@claude
Copy link
Copy Markdown

claude Bot commented Apr 10, 2026

Claude finished @olivermeyer's task in 2m 42s —— View job


Code Review Complete

Tasks

  • Read project documentation (CLAUDE.md, CODE_STYLE.md, tests/CLAUDE.md)
  • Analyze changes (git diff, git log)
  • Review code quality and standards compliance
  • Verify test coverage and markers
  • Check for security and performance issues
  • Provide comprehensive feedback

Summary

This PR contains three commits implementing two features:

  1. Default page title from context (710f1f5) - Good feature, well-implemented
  2. Clean duplicate test helpers/fixtures (8833534) - Excellent refactoring
  3. Extract _frame_context helper (1e088df) - Good refactoring to reduce complexity

Overall Assessment: The changes are well-structured and improve the codebase. However, there are blocking issues that must be addressed before merge.


Blocking Issues

1. Insufficient Test Coverage

Location: src/aignostics_foundry_core/gui/auth.py
Issue: Codecov reports only 42.1% coverage on new code with 11 missing lines. Project minimum is 85%.

The new _frame_context helper and title resolution logic lack test coverage. Per CLAUDE.md:

Coverage: Goal 100%, minimum 85%.

Required Action: Add tests specifically for:

  • _frame_context helper with frame_func=None case
  • _frame_context helper with a real frame function
  • Title resolution when title=None (testing get_context().name.title() fallback)
  • Title resolution when an explicit title is provided

Fix test coverage →


Suggestions

2. SonarQube Issues to Investigate

Issue: SonarQube reports 3 new issues (Quality Gate passed but issues present).

While the Quality Gate passed, investigate the 3 new issues at SonarQube Cloud to ensure they don't violate project standards.


3. Consider Adding Docstring for _frame_context

Location: src/aignostics_foundry_core/gui/auth.py:222-233

The _frame_context helper is well-named and clear, but a docstring would improve maintainability:

@contextlib.contextmanager
def _frame_context(
    frame_func: FrameFunc,
    title: str,
    user: dict[str, Any] | None,
) -> Generator[None, None, None]:
    """Context manager that conditionally applies a frame function.
    
    When frame_func is None, yields directly (no frame).
    Otherwise, yields within the frame_func context.
    
    Args:
        frame_func: Optional frame callable or None.
        title: Page title to pass to frame_func.
        user: User dict to pass to frame_func.
        
    Yields:
        None
    """
    if frame_func is not None:
        with frame_func(title, user=user):
            yield
    else:
        yield

Positive Observations ✅

  1. Excellent Test Cleanup (8833534)

    • Moved GUI-specific fixtures to tests/aignostics_foundry_core/gui/conftest.py
    • Centralized _set_context fixture in root conftest.py
    • Removed 147 lines of duplicate code across 10 files
    • Maintains test isolation via autouse fixtures
  2. Good Feature Implementation (710f1f5)

    • title: str | None = None with lazy resolution is a sensible UX improvement
    • Documentation updated consistently across all 5 decorators
    • Comment in _PageEntry dataclass clearly explains the None case
  3. Complexity Reduction (1e088df)

    • Extracted _frame_context helper eliminates 7 repetitions of frame_func(...) if frame_func is not None else contextlib.nullcontext()
    • Clearer intent: "apply frame if present"
    • Added proper Generator import for type hints
  4. Test Markers Present

    • All tests properly marked with @pytest.mark.unit or @pytest.mark.integration
    • Follows test/CLAUDE.md requirements
  5. Conventional Commits

    • All three commits follow conventional commit format
    • Scopes are appropriate (gui, no scope for cross-cutting refactor)
    • Co-authored-by trailers present

Security & Performance

  • ✅ No security concerns identified
  • ✅ No performance regressions expected
  • ✅ No breaking changes (backward compatible)

Recommendation

Do not merge until:

  1. Test coverage reaches ≥85% (add tests for _frame_context and title resolution)
  2. SonarQube issues are reviewed and resolved if applicable

Once coverage is addressed, this will be a solid contribution. The refactoring is clean and the feature is useful.


@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/aignostics_foundry_core/gui/auth.py 92.30% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/aignostics_foundry_core/gui/auth.py 93.05% <92.30%> (+26.87%) ⬆️

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@olivermeyer
Copy link
Copy Markdown
Collaborator Author

Claude comments are based on an outdated SonarQube scan; merging.

@olivermeyer olivermeyer merged commit a4134d9 into main Apr 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Trigger Claude Code automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant