Skip to content

Comments

feat(major): [sc-29118] Update Frostflake#71

Open
0xTim wants to merge 35 commits intomainfrom
feature/sc-29118/update-frostlake
Open

feat(major): [sc-29118] Update Frostflake#71
0xTim wants to merge 35 commits intomainfrom
feature/sc-29118/update-frostlake

Conversation

@0xTim
Copy link
Member

@0xTim 0xTim commented Feb 18, 2026

Description

Update Frostflake to work with Swift 6, modern concurrency and fix CI. Benchmarks are slightly improved with the adoption of Mutex.

How Has This Been Tested?

Unit tests and benchmarks

Minimal checklist:

  • I have performed a self-review of my own code
  • I have added DocC code-level documentation for any public interfaces exported by the package
  • I have added unit and/or integration tests that prove my fix is effective or that my feature works

@gemini-code-assist
Copy link

Summary of Changes

Hello @0xTim, 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 significantly modernizes the Frostflake library by upgrading it to Swift 6, adopting modern concurrency primitives like Mutex, and migrating the testing suite to the new Testing framework. It also includes essential CI fixes and dependency updates, ensuring the library remains robust, performant, and aligned with the latest Swift ecosystem standards.

Highlights

  • Swift 6 Compatibility: Updated the project to be compatible with Swift 6, including toolchain version and platform requirements.
  • Modern Concurrency Adoption: Replaced the custom Lock implementation with Swift's new Synchronization.Mutex for thread-safe state management within the Frostflake generator, improving performance and adhering to modern Swift concurrency best practices.
  • CI/CD Enhancements: Fixed continuous integration (CI) issues, removed an outdated Consul action, and introduced Dependabot for automated GitHub Actions dependency updates.
  • Testing Framework Migration: Migrated unit tests from XCTest to the new Testing framework, enhancing test structure and expressiveness.
  • Dependency Updates: Updated various Swift package dependencies across both the main library and benchmarks, including hdrhistogram-swift, package-benchmark, swift-argument-parser, swift-atomics, swift-numerics, and swift-system.
  • Performance Improvements: Achieved slight improvements in benchmarks due to the adoption of Mutex for synchronization.
Changelog
  • .claude/settings.local.json
    • Added permissions for swift test, swift package benchmark, and swift build commands.
  • .github/actions/consul-start/action.yml
    • Removed the GitHub Action for starting Consul.
  • .github/dependabot.yml
    • Added Dependabot configuration to check for weekly updates to GitHub Actions.
  • .gitignore
    • Added .vscode/ to the ignore list.
  • .swift-version
    • Updated the required Swift version from 5.10 to 6.2.
  • Benchmarks/Benchmarks/Frostflake/FrostflakeBenchmark.swift
    • Updated the benchmarks closure signature to @Sendable () -> Void for Swift 6 compatibility.
  • Benchmarks/Package.resolved
    • Updated hdrhistogram-swift to 0.1.4.
    • Updated package-benchmark to 1.29.11.
    • Updated swift-argument-parser to 1.7.0.
    • Updated swift-atomics to 1.3.0.
    • Updated swift-numerics to 1.1.1.
    • Updated swift-system to 1.6.4.
    • Updated the package resolution format version to 3.
  • Benchmarks/Package.swift
    • Updated the Swift tools version to 6.2.
    • Updated the minimum macOS platform version to v15.
    • Removed commented-out dependency declarations.
  • Package.resolved
    • Updated swift-argument-parser to 1.7.0.
    • Updated swift-docc-plugin to 1.4.6.
    • Updated swift-docc-symbolkit to use swiftlang repository.
    • Updated swift-system to 1.6.4.
  • Package.swift
    • Updated the Swift tools version to 6.0.
    • Updated the minimum macOS platform version to v15.
    • Updated the minimum iOS platform version to v18.
    • Removed the custom makeDependencies function and simplified dependency declarations directly in the package manifest.
  • Sources/Frostflake/Frostflake.swift
    • Adopted Synchronization.Mutex for internal state management, replacing the custom Lock.
    • Made the Frostflake class Sendable.
    • Refactored currentSeconds and sequenceNumber into a MutableState struct, managed by Mutex or StateBox.
    • Updated sharedGenerator and setup methods to use Mutex for thread-safe access.
    • Removed the lock property.
    • Introduced generateInternal to encapsulate the core Frostflake generation logic.
  • Sources/Frostflake/FrostflakeHelpers.swift
    • Refactored currentSecondsSinceEpoch to use a new private getCurrentTime helper.
    • Added currentNanoSecondsSinceEpoch function.
  • Sources/Frostflake/FrostflakeIdentifier+Base58.swift
    • Added a guard statement to init?(base58:) to handle empty input strings.
  • Sources/Frostflake/Lock.swift
    • Removed the custom Lock implementation, as it is replaced by Synchronization.Mutex.
  • Tests/FrostflakeTests/FrostflakeTests.swift
    • Migrated test suite from XCTest to the Testing framework.
    • Removed setUp override.
    • Updated assertions from XCTAssert to #expect.
    • Added @Test attributes to individual test methods.
    • Removed shared generator tests, which were moved to a new file.
    • Added unsynchronizedStatePersistence test to verify sequence number persistence.
  • Tests/FrostflakeTests/SharedGeneratorSuiteTrait.swift
    • Added a new file defining SharedGeneratorSuiteTrait for setting up the shared Frostflake generator in the Testing framework.
  • Tests/FrostflakeTests/SharedGeneratorTests.swift
    • Added a new file containing tests specifically for the shared Frostflake generator, utilizing the Testing framework and SharedGeneratorSuiteTrait.
Ignored Files
  • Ignored by pattern: .github/workflows/** (11)
    • .github/workflows/lint-pr.yaml
    • .github/workflows/semantic-release.yml
    • .github/workflows/swift-benchmark-delta.yml
    • .github/workflows/swift-check-api-breaks.yml
    • .github/workflows/swift-code-coverage.yml
    • .github/workflows/swift-lint.yml
    • .github/workflows/swift-linux-build.yml
    • .github/workflows/swift-macos-build.yml
    • .github/workflows/swift-outdated-dependencies.yml
    • .github/workflows/swift-sanitizer-address.yml
    • .github/workflows/swift-sanitizer-thread.yml
Activity
  • The author performed a self-review of the code.
  • The author added DocC code-level documentation for public interfaces.
  • The author added unit and/or integration tests to verify the changes and features.
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.

Copy link

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

Choose a reason for hiding this comment

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

Code Review

This is a significant and well-executed update. The changes to adopt Swift 6 features like Mutex for concurrency control are excellent, improving both performance and code clarity. The refactoring in Frostflake.swift to handle synchronized and unsynchronized states is a particularly strong improvement that also resolves a potential bug. The migration of tests to swift-testing is a great modernization step. Overall, this is a high-quality pull request that significantly improves the library. I have one minor suggestion to improve test code clarity.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2026

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 83.96226% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.44%. Comparing base (40094d1) to head (1092db4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
Sources/Frostflake/Frostflake.swift 75.00% 14 Missing ⚠️
Sources/FrostflakeUtility/FrostflakeUtility.swift 0.00% 2 Missing ⚠️
...urces/Frostflake/FrostflakeIdentifier+Base58.swift 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
+ Coverage   74.64%   78.44%   +3.80%     
==========================================
  Files           9       10       +1     
  Lines         347      269      -78     
==========================================
- Hits          259      211      -48     
+ Misses         88       58      -30     
Files with missing lines Coverage Δ
Sources/Frostflake/FrostflakeDefinitions.swift 100.00% <ø> (ø)
Sources/Frostflake/FrostflakeHelpers.swift 92.31% <100.00%> (+1.40%) ⬆️
Tests/FrostflakeTests/FrostflakeTests.swift 100.00% <100.00%> (ø)
...ts/FrostflakeTests/SharedGeneratorSuiteTrait.swift 100.00% <100.00%> (ø)
Tests/FrostflakeTests/SharedGeneratorTests.swift 100.00% <100.00%> (ø)
...urces/Frostflake/FrostflakeIdentifier+Base58.swift 31.03% <0.00%> (+1.77%) ⬆️
Sources/FrostflakeUtility/FrostflakeUtility.swift 0.00% <0.00%> (ø)
Sources/Frostflake/Frostflake.swift 79.75% <75.00%> (+5.72%) ⬆️

... and 2 files with indirect coverage changes

Files with missing lines Coverage Δ
Sources/Frostflake/FrostflakeDefinitions.swift 100.00% <ø> (ø)
Sources/Frostflake/FrostflakeHelpers.swift 92.31% <100.00%> (+1.40%) ⬆️
Tests/FrostflakeTests/FrostflakeTests.swift 100.00% <100.00%> (ø)
...ts/FrostflakeTests/SharedGeneratorSuiteTrait.swift 100.00% <100.00%> (ø)
Tests/FrostflakeTests/SharedGeneratorTests.swift 100.00% <100.00%> (ø)
...urces/Frostflake/FrostflakeIdentifier+Base58.swift 31.03% <0.00%> (+1.77%) ⬆️
Sources/FrostflakeUtility/FrostflakeUtility.swift 0.00% <0.00%> (ø)
Sources/Frostflake/Frostflake.swift 79.75% <75.00%> (+5.72%) ⬆️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 061a0d1...1092db4. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xTim 0xTim requested a review from hassila February 18, 2026 12:52
@0xTim 0xTim force-pushed the feature/sc-29118/update-frostlake branch from 16f2ecf to 815c771 Compare February 19, 2026 13:57
Copy link
Contributor

@hassila hassila left a comment

Choose a reason for hiding this comment

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

Very nice cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants