Skip to content

fix: validate and correct export-report proposal against codebase - #61

Merged
alexey1312 merged 1 commit into
mainfrom
claude/validate-export-report-gDU24
Feb 24, 2026
Merged

fix: validate and correct export-report proposal against codebase#61
alexey1312 merged 1 commit into
mainfrom
claude/validate-export-report-gDU24

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Key corrections after codebase validation:

  • Decision 4: TerminalUI does NOT collect warnings (only prints them);
    replaced with new WarningCollector actor following SharedThemeAttributesCollector pattern
  • Decision 7: SHA256 → FNV-1a (no CryptoKit/swift-crypto in project;
    FNV1aHasher already available in codebase)
  • Decision 1: ExportStats is NOT Codable and has batch-only fields;
    create new ReportStats: Encodable instead of reusing ExportStats
  • Added Decision 9 (version field) and Decision 10 (run() result capture)
  • Fixed task file locations (Batch/ → Report/), added missing tasks
  • Added spec requirements: version field, zero-file export edge case
  • Updated all SHA256 references to FNV-1a 16-char hex throughout

https://claude.ai/code/session_01M6Cw6Pcsy5L1KVkPZ1esu8

Key corrections after codebase validation:
- Decision 4: TerminalUI does NOT collect warnings (only prints them);
  replaced with new WarningCollector actor following SharedThemeAttributesCollector pattern
- Decision 7: SHA256 → FNV-1a (no CryptoKit/swift-crypto in project;
  FNV1aHasher already available in codebase)
- Decision 1: ExportStats is NOT Codable and has batch-only fields;
  create new ReportStats: Encodable instead of reusing ExportStats
- Added Decision 9 (version field) and Decision 10 (run() result capture)
- Fixed task file locations (Batch/ → Report/), added missing tasks
- Added spec requirements: version field, zero-file export edge case
- Updated all SHA256 references to FNV-1a 16-char hex throughout

https://claude.ai/code/session_01M6Cw6Pcsy5L1KVkPZ1esu8
@alexey1312
alexey1312 merged commit d4c7deb into main Feb 24, 2026
1 check failed
@alexey1312
alexey1312 deleted the claude/validate-export-report-gDU24 branch February 24, 2026 03:37
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the export-report functionality by validating its initial proposal against the existing codebase. It addresses several key discrepancies, leading to a more robust and integrated reporting system. The changes primarily involve adjusting data structures for report statistics, implementing a dedicated warning collection mechanism, and standardizing content hashing using an internal FNV-1a algorithm. Additionally, the report now includes a version field for future compatibility and ensures that export command results are properly captured.

Highlights

  • Report Stats Refinement: The ExportReport now uses a new ReportStats: Encodable struct for count fields, instead of reusing ExportStats, which was found to contain non-Codable batch-only fields.
  • Warning Collection Overhaul: TerminalUI no longer collects warnings; a new WarningCollector actor has been introduced, following the SharedThemeAttributesCollector pattern, to centralize warning collection for reports.
  • Checksum Algorithm Change: The content checksum mechanism has been switched from SHA256 to FNV-1a, leveraging an existing FNV1aHasher in the codebase, due to the absence of CryptoKit/swift-crypto dependencies and FNV-1a's suitability for change detection.
  • Report Versioning Added: A version integer field has been introduced to ExportReport for forward compatibility, starting at 1.
  • Export Result Capture: Single export commands' run() methods will now capture export results (timing, stats, success/failure) for inclusion in the report, rather than discarding them.
  • Specification Updates: The export-report specifications have been updated to reflect these changes, including requirements for the new version field and graceful handling of zero-file exports.
  • Task List Adjustments: Development tasks have been revised to align with the updated design decisions, including changes to file locations and implementation details.
Changelog
  • openspec/changes/export-report/design.md
    • Updated the decision for ExportReport to use a new ReportStats: Encodable struct, clarifying why ExportStats cannot be reused.
    • Revised the warning collection decision, stating TerminalUI does not store warnings and introducing a new WarningCollector actor.
    • Changed the content checksum decision from SHA256 to FNV-1a, detailing the rationale and options considered.
    • Added Decision 9 for including a version field in ExportReport.
    • Added Decision 10 for modifying run() methods to capture export results.
    • Updated the "Risks / Trade-offs" table to reflect the FNV-1a checksum and new decisions.
  • openspec/changes/export-report/proposal.md
    • Modified the ExportReport struct description to include a version field and specify the use of a new ReportStats: Encodable struct.
    • Updated the asset manifest checksum from SHA256 to FNV-1a.
    • Added TerminalUI.swift to the list of affected files for warning collection.
  • openspec/changes/export-report/specs/export-report/spec.md
    • Added a requirement for the ExportReport to contain a version integer field.
    • Clarified that the stats object will use a new ReportStats: Encodable struct.
    • Updated the warning collection requirement to specify the use of a WarningCollector.
    • Changed the manifest checksum type from SHA256 to FNV-1a 16-char hex.
    • Revised the checksum requirement to use FNV-1a and updated the expected hex string length.
    • Added a new requirement for the report to include a version field for forward compatibility.
    • Added a new requirement for the manifest to handle zero-file exports gracefully.
  • openspec/changes/export-report/tasks.md
    • Updated the location for ExportReport struct creation from Batch/ExportReport.swift to Report/ExportReport.swift.
    • Modified task 1.2 to create ReportStats: Encodable and clarified ExportStats non-Codability.
    • Updated task 1.3 to add Encodable conformance to ExportReport.
    • Revised task 1.4 for unit tests to include the version field.
    • Added help text to @Option for --report flag tasks.
    • Refined task 2.5 for writeExportReport helper to reference Batch.swift pattern.
    • Detailed task 2.6 for modifying run() methods to capture results, including startTime and endTime.
    • Replaced task 3.1 with creating a WarningCollector actor in Report/WarningCollector.swift.
    • Updated task 3.2 to extend TerminalUI.warning() to forward messages to WarningCollector.
    • Revised task 3.4 for WarningCollector tests.
    • Updated task 4.3 to specify FNV1aHasher.hashToHex() for file tracking.
    • Changed task 4.4 to compute checksum via FNV1aHasher.hashToHex() instead of SHA256.
    • Clarified task 5.1 for deleted file detection to compare against previous report at the same path.
    • Updated task 6.1 for integration test to include version, command, stats, timestamps.
    • Added task 6.4 for integration test of zero-file export.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request does an excellent job of validating and refining the export-report feature design against the existing codebase. The corrections to use a new ReportStats struct, introduce a WarningCollector actor, and adopt the existing FNV-1a hasher are all well-reasoned and significantly improve the proposal's feasibility. The addition of a version field and ensuring result capture are also great improvements for robustness. My review focuses on aligning the updated documentation with the repository's TOON format convention for tables and lists, as specified in the style guide.

Comment on lines +90 to 95
| Option | Pros | Cons |
| ----------------------------- | ---------------------------------------- | --------------------------------------- |
| Add collection to TerminalUI | Single point of interception | Adds state to stateless class |
| Separate WarningCollector | Clean separation, follows actor pattern | Must wire into export commands |
| Intercept at queueLogMessage | No TerminalUI changes | Only works in batch mode |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The "Options considered" table is in Markdown format. According to the repository style guide, all tabular data should use the TOON format to reduce token usage and maintain consistency.

Suggested change
| Option | Pros | Cons |
| ----------------------------- | ---------------------------------------- | --------------------------------------- |
| Add collection to TerminalUI | Single point of interception | Adds state to stateless class |
| Separate WarningCollector | Clean separation, follows actor pattern | Must wire into export commands |
| Intercept at queueLogMessage | No TerminalUI changes | Only works in batch mode |
options[3]{option,pros,cons}:
"Add collection to TerminalUI","Single point of interception","Adds state to stateless class"
"Separate WarningCollector","Clean separation, follows actor pattern","Must wire into export commands"
"Intercept at queueLogMessage","No TerminalUI changes","Only works in batch mode"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +137 to +142
| Option | Pros | Cons |
| ----------------------- | --------------------------------------- | --------------------------------------------------------- |
| SHA256 (CryptoKit) | Industry standard, 64-char hex | macOS-only; Linux needs `swift-crypto` dependency |
| SHA256 (swift-crypto) | Cross-platform, industry standard | New dependency |
| FNV-1a (already in use) | No new deps, fast (~2 GB/s), in codebase | Non-cryptographic, 16-char hex, collision-prone at scale |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This "Options considered" table for checksums is in Markdown format, which deviates from the repository's TOON format convention for tabular data.

Suggested change
| Option | Pros | Cons |
| ----------------------- | --------------------------------------- | --------------------------------------------------------- |
| SHA256 (CryptoKit) | Industry standard, 64-char hex | macOS-only; Linux needs `swift-crypto` dependency |
| SHA256 (swift-crypto) | Cross-platform, industry standard | New dependency |
| FNV-1a (already in use) | No new deps, fast (~2 GB/s), in codebase | Non-cryptographic, 16-char hex, collision-prone at scale |
options[3]{option,pros,cons}:
"SHA256 (CryptoKit)","Industry standard, 64-char hex","macOS-only; Linux needs `swift-crypto` dependency"
"SHA256 (swift-crypto)","Cross-platform, industry standard","New dependency"
"FNV-1a (already in use)","No new deps, fast (~2 GB/s), in codebase","Non-cryptographic, 16-char hex, collision-prone at scale"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +178 to +186
| Risk | Impact | Mitigation |
| --------------------------------- | ------ | ----------------------------------------------------- |
| FileWriter tracking overhead | Low | Only active when `--report` specified |
| FNV-1a collision risk | Low | Non-cryptographic but sufficient for change detection |
| exfig-action Phase 3 dependency | Medium | Action requires CLI release with `--report` first |
| Report format evolution | Low | `version` field in report for forward compat |
| `deleted` detection needs history | Low | Optional -- requires previous report at same path |
| Warning collector wiring | Low | Follow SharedThemeAttributesCollector actor pattern |
| run() refactor for result capture | Low | performExportWithResult() already exists |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The "Risks / Trade-offs" table is in Markdown format. To adhere to the repository's style guide, it should be converted to the TOON format.

Suggested change
| Risk | Impact | Mitigation |
| --------------------------------- | ------ | ----------------------------------------------------- |
| FileWriter tracking overhead | Low | Only active when `--report` specified |
| FNV-1a collision risk | Low | Non-cryptographic but sufficient for change detection |
| exfig-action Phase 3 dependency | Medium | Action requires CLI release with `--report` first |
| Report format evolution | Low | `version` field in report for forward compat |
| `deleted` detection needs history | Low | Optional -- requires previous report at same path |
| Warning collector wiring | Low | Follow SharedThemeAttributesCollector actor pattern |
| run() refactor for result capture | Low | performExportWithResult() already exists |
risks[7]{risk,impact,mitigation}:
"FileWriter tracking overhead","Low","Only active when `--report` specified"
"FNV-1a collision risk","Low","Non-cryptographic but sufficient for change detection"
"exfig-action Phase 3 dependency","Medium","Action requires CLI release with `--report` first"
"Report format evolution","Low","`version` field in report for forward compat"
"`deleted` detection needs history","Low","Optional -- requires previous report at same path"
"Warning collector wiring","Low","Follow SharedThemeAttributesCollector actor pattern"
"run() refactor for result capture","Low","performExportWithResult() already exists"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines 9 to +12
- Add `--report <path>` option to `ExportColors`, `ExportIcons`, `ExportImages`, `ExportTypography`
- New `ExportReport` struct (analogous to `BatchReport` but for a single command): command name, config path, timing, success/error, stats, collected warnings
- Reuse existing `ExportStats` from `BatchResult.swift` and `JSONCodec.encodePrettySorted()` from swift-yyjson
- New `ExportReport` struct (analogous to `BatchReport` but for a single command): version, command name, config path, timing, success/error, stats, collected warnings
- New `ReportStats: Encodable` struct with count fields only (colors, icons, images, typography) — analogous to `BatchReport.Stats`, NOT reusing `ExportStats` directly (it contains batch-only fields like `computedNodeHashes`, `granularCacheStats`)
- Serialize via `JSONCodec.encodePrettySorted()` from swift-yyjson

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This list of Phase 1 changes is in Markdown list format. The repository style guide specifies that lists of items should use the TOON format.

Suggested change
- Add `--report <path>` option to `ExportColors`, `ExportIcons`, `ExportImages`, `ExportTypography`
- New `ExportReport` struct (analogous to `BatchReport` but for a single command): command name, config path, timing, success/error, stats, collected warnings
- Reuse existing `ExportStats` from `BatchResult.swift` and `JSONCodec.encodePrettySorted()` from swift-yyjson
- New `ExportReport` struct (analogous to `BatchReport` but for a single command): version, command name, config path, timing, success/error, stats, collected warnings
- New `ReportStats: Encodable` struct with count fields only (colors, icons, images, typography) — analogous to `BatchReport.Stats`, NOT reusing `ExportStats` directly (it contains batch-only fields like `computedNodeHashes`, `granularCacheStats`)
- Serialize via `JSONCodec.encodePrettySorted()` from swift-yyjson
phase1_items[4]{item}:
"Add `--report <path>` option to `ExportColors`, `ExportIcons`, `ExportImages`, `ExportTypography`"
"New `ExportReport` struct (analogous to `BatchReport` but for a single command): version, command name, config path, timing, success/error, stats, collected warnings"
"New `ReportStats: Encodable` struct with count fields only (colors, icons, images, typography) — analogous to `BatchReport.Stats`, NOT reusing `ExportStats` directly (it contains batch-only fields like `computedNodeHashes`, `granularCacheStats`)"
"Serialize via `JSONCodec.encodePrettySorted()` from swift-yyjson"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +16 to 18
- New `AssetManifest` struct tracking every generated file: path, action (`created`/`modified`/`unchanged`/`deleted`), FNV-1a content checksum, asset type
- Track file write status in `FileWriter` and attach manifest to `ExportReport`
- Enables: precise change tracking, PR diff comments, design drift detection

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The list for Phase 2 is a Markdown list. Please convert it to a TOON table to follow the repository's format convention.

Suggested change
- New `AssetManifest` struct tracking every generated file: path, action (`created`/`modified`/`unchanged`/`deleted`), FNV-1a content checksum, asset type
- Track file write status in `FileWriter` and attach manifest to `ExportReport`
- Enables: precise change tracking, PR diff comments, design drift detection
phase2_items[3]{item}:
"New `AssetManifest` struct tracking every generated file: path, action (`created`/`modified`/`unchanged`/`deleted`), FNV-1a content checksum, asset type"
"Track file write status in `FileWriter` and attach manifest to `ExportReport`"
"Enables: precise change tracking, PR diff comments, design drift detection"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +222 to 228
#### Scenario: Written file has FNV-1a checksum

- **GIVEN** an export writes a file with known content
- **WHEN** the manifest entry is recorded
- **THEN** `checksum` SHALL be a 64-character lowercase hexadecimal string
- **AND** the value SHALL match the SHA256 hash of the written file content
- **THEN** `checksum` SHALL be a 16-character lowercase hexadecimal string
- **AND** the value SHALL match the FNV-1a hash of the written file content

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This scenario is formatted as a Markdown list. Please convert it to a TOON table to adhere to the project's documentation standards.

Suggested change
#### Scenario: Written file has FNV-1a checksum
- **GIVEN** an export writes a file with known content
- **WHEN** the manifest entry is recorded
- **THEN** `checksum` SHALL be a 64-character lowercase hexadecimal string
- **AND** the value SHALL match the SHA256 hash of the written file content
- **THEN** `checksum` SHALL be a 16-character lowercase hexadecimal string
- **AND** the value SHALL match the FNV-1a hash of the written file content
scenario_checksum[4]{step}:
"**GIVEN** an export writes a file with known content"
"**WHEN** the manifest entry is recorded"
"**THEN** `checksum` SHALL be a 16-character lowercase hexadecimal string"
"**AND** the value SHALL match the FNV-1a hash of the written file content"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines 237 to +239
- **GIVEN** an export that detects a file is unchanged
- **WHEN** the manifest entry is recorded
- **THEN** `checksum` SHALL equal the SHA256 of the existing file content
- **THEN** `checksum` SHALL equal the FNV-1a hash of the existing file content

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This scenario is formatted as a Markdown list. Please convert it to a TOON table to adhere to the project's documentation standards.

Suggested change
- **GIVEN** an export that detects a file is unchanged
- **WHEN** the manifest entry is recorded
- **THEN** `checksum` SHALL equal the SHA256 of the existing file content
- **THEN** `checksum` SHALL equal the FNV-1a hash of the existing file content
scenario_unchanged_checksum[3]{step}:
"**GIVEN** an export that detects a file is unchanged"
"**WHEN** the manifest entry is recorded"
"**THEN** `checksum` SHALL equal the FNV-1a hash of the existing file content"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +247 to +251
#### Scenario: Initial report version

- **GIVEN** any export with `--report`
- **WHEN** the report is written
- **THEN** `"version"` SHALL be `1`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This new scenario for the report version is a Markdown list. It should be converted to a TOON table to follow the repository's formatting convention.

Suggested change
#### Scenario: Initial report version
- **GIVEN** any export with `--report`
- **WHEN** the report is written
- **THEN** `"version"` SHALL be `1`
scenario_version[3]{step}:
"**GIVEN** any export with `--report`"
"**WHEN** the report is written"
"**THEN** `\"version\"` SHALL be `1`"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

Comment on lines +259 to +264
#### Scenario: Export produces no files

- **GIVEN** a valid config with no matching assets in Figma
- **WHEN** the export completes successfully with `--report`
- **THEN** `manifest.files` SHALL be an empty array `[]`
- **AND** `stats` SHALL reflect zero counts for the relevant asset type

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This new scenario for handling zero-file exports is a Markdown list. Please convert it to a TOON table to align with the project's style guide.

Suggested change
#### Scenario: Export produces no files
- **GIVEN** a valid config with no matching assets in Figma
- **WHEN** the export completes successfully with `--report`
- **THEN** `manifest.files` SHALL be an empty array `[]`
- **AND** `stats` SHALL reflect zero counts for the relevant asset type
scenario_zero_files[4]{step}:
"**GIVEN** a valid config with no matching assets in Figma"
"**WHEN** the export completes successfully with `--report`"
"**THEN** `manifest.files` SHALL be an empty array `[]`"
"**AND** `stats` SHALL reflect zero counts for the relevant asset type"
References
  1. The style guide requires using TOON for all tabular data and lists of items, instead of Markdown tables or lists. This is to reduce token usage and ensure a consistent format across documentation files. (link)

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