This PR standardizes how size-related properties are handled across all
GitHub classes to ensure consistency in storage format and display
formatting.
## Changes Made
### 1. GitHubRepository
- **Property**: Updated `Size` property to store bytes instead of
kilobytes
- **Storage**: Convert API values using `$Object.size * 1KB` and
`$Object.diskUsage * 1KB`
- **Display**: Updated format file to use
`[GitHubFormatter]::FormatFileSize($_.Size)`
- **Documentation**: Updated comments to reflect "in bytes" instead of
"in kilobytes"
### 2. GitHubOrganization
- **Property**: Renamed `DiskUsage` property to `Size` for consistency
- **Storage**: Convert API values using `$Object.disk_usage * 1KB`
- **Compatibility**: Added `DiskUsage` alias property for backward
compatibility
- **Documentation**: Updated comments to reflect "size of organization's
repositories, in bytes"
### 3. GitHubArtifact
- **Display**: Updated format file to use
`[GitHubFormatter]::FormatFileSize($_.Size)` instead of custom
formatting
- **Property**: Already correctly stores bytes and uses "Size" property
name
- **Label**: Updated table header from "Size (KB)" to "Size" for cleaner
display
### 4. Format File Updates
All affected format files now use the standardized
`[GitHubFormatter]::FormatFileSize()` method instead of custom size
calculations, ensuring consistent human-readable formatting across all
size displays.
### 5. Comprehensive Test Coverage
- **GitHubFormatter.Tests.ps1**: New test file validating unit
conversion logic (KB→bytes), type boundaries, and format patterns
- **Enhanced Integration Tests**: Added size property validation tests
to Repositories.Tests.ps1, Organizations.Tests.ps1, and
Artifacts.Tests.ps1
- **Unit Verification**: Tests confirm all size properties store values
in bytes and use expected denominations
- **Compatibility Testing**: Validates DiskUsage alias functionality and
backward compatibility
## Verification
The changes maintain backward compatibility and existing functionality:
- Size conversions work correctly: 108 KB → 110,592 bytes → "108.00 KB"
display
- Tests continue to pass (they only verify `Size > 0`)
- New tests verify correct unit storage and formatting behavior
- GitHubReleaseAsset was already implemented correctly as the reference
standard
## Example Impact
Before:
```powershell
# GitHubRepository.Size = 108 (kilobytes)
# Display: "0.11 MB" (custom calculation)
# GitHubOrganization.DiskUsage = 10000 (kilobytes)
# Display: Not shown in table format
```
After:
```powershell
# GitHubRepository.Size = 110592 (bytes)
# Display: "108.00 KB" (standardized formatter)
# GitHubOrganization.Size = 10240000 (bytes)
# GitHubOrganization.DiskUsage -> Size (alias for compatibility)
# Display: "9.77 MB" (standardized formatter)
```
Fixes #478.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: Marius Storhaug <marstor@hotmail.com>