Skip to content

Conversation

@sarahyurick
Copy link
Contributor

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

Enforces proper configuration management by preventing subclasses from overriding name, resources, and batch_size properties.

Key changes:

  • Added @final decorator to name, resources, and batch_size properties for type checker enforcement
  • Implemented __init_subclass__ hook to raise TypeError at class definition time if any subclass attempts to override these properties
  • These properties should only be modified through the with_() method which updates internal _name, _resources, and _batch_size attributes

Rationale:
This change prevents developers from accidentally creating conflicting configuration patterns and ensures consistent usage of the with_() method for property overrides (see PR #764).

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is a defensive programming improvement that enforces existing design constraints. The __init_subclass__ validation works correctly at class definition time, and testing confirms no existing subclasses override these properties. The @final decorator provides additional static type checking support.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
nemo_curator/stages/base.py 5/5 Added @final decorators and __init_subclass__ validation to enforce proper usage of name, resources, and batch_size properties

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Sub as Subclass Definition
    participant Init as __init_subclass__
    participant Base as ProcessingStage
    
    Dev->>Sub: Define new subclass
    Sub->>Init: Trigger __init_subclass__
    Init->>Init: Check if 'name' in cls.__dict__
    Init->>Init: Check if 'resources' in cls.__dict__
    Init->>Init: Check if 'batch_size' in cls.__dict__
    
    alt Property override detected
        Init-->>Dev: Raise TypeError
    else No override
        Init->>Base: super().__init_subclass__()
        Base-->>Dev: Subclass created successfully
    end
    
    Note over Dev,Base: Properties can only be modified via with_() method
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Signed-off-by: Sarah Yurick <[email protected]>
@sarahyurick sarahyurick enabled auto-merge (squash) November 13, 2025 17:39
@sarahyurick sarahyurick merged commit 2d90b4b into NVIDIA-NeMo:main Nov 13, 2025
37 checks passed
@sarahyurick sarahyurick mentioned this pull request Nov 14, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants