Skip to content

4. Consolidate ORCA Class Files #1563

@SamErde

Description

@SamErde

4. Consolidate ORCA Class Files

Status: Confirmed.

Problem: The ORCA integration uses a class-based architecture (ORCACheck,
ORCACheckConfig, etc.) defined across multiple .ps1 files in
powershell/internal/orca/. These are loaded via ScriptsToProcess in the module manifest,
which runs them in the caller's scope before the module body executes. Multiple files means
multiple filesystem reads at the earliest possible point in the import sequence.

Action:

  • During the build, consolidate all ORCA class definition files from
    powershell/internal/orca/ into a single OrcaClasses.ps1 in the output directory.
  • Update ScriptsToProcess in the output Maester.psd1 to reference only the single
    consolidated file.

Critical constraint — class inheritance order:
PowerShell requires base classes to be defined before derived classes in the same script
scope. The build step must explicitly enforce load order, not rely on filesystem sort order.

Determine the required order by inspecting class inheritance relationships:

  1. Any class with no base class (e.g., ORCACheckConfig) comes first.
  2. Base classes (e.g., ORCACheck) before classes that inherit from them.
  3. Helper/enum types before the classes that use them.

Verification: After consolidation, run a representative set of ORCA tests
(Test-ORCA100, Test-ORCA143, etc.) and confirm they pass without class resolution errors.

Note: Do not consolidate the ORCA class files into the main Maester.psm1. They must
remain in ScriptsToProcess (or equivalent) because PowerShell classes defined inside a
module are not accessible to Pester test scripts running in a separate scope.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions