Skip to content

Add swoopmist export --snapshot for the release-data snapshot - #46

Merged
leogdion merged 2 commits into
v1.0.0-alpha.4from
194-snapshot-export
Nov 27, 2026
Merged

leogdion merged 2 commits into
v1.0.0-alpha.4from
194-snapshot-export

Conversation

@leogdion

@leogdion leogdion commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Depends on SwoopKit 1.0.0-beta.2 (brightdigit/SwoopKit#3), which moved ReleaseDataSnapshot and JSONEncoder.iso8601PrettySorted into SwoopKit.

Package U.3 of Stewed's v1.0.0-beta.1 plan, part of brightdigit/Stewed#194 (drop StewedTools).

What

swoopmist export --snapshot <output.json> writes SwoopKit's ReleaseDataSnapshot, the file Stewed bundles as Resources/release-data-snapshot.json. It keeps every guarantee of StewedTools' release-data-snapshot:

  • Only SDKVersion, XcodeVersion and SimulatorRuntime, each through queryAllRecords, which pages.
  • Every record maps with from(recordInfo:). The export fails if a type is empty or any record doesn't map, and names the records that didn't.
  • Records are sorted by record name, fetchedAt is whole seconds, and the JSON is SwoopKit's JSONEncoder.iso8601PrettySorted plus a trailing newline.
  • Read-only: it only queries.
  • Development by default. Production needs --allow-production. That's a command-line flag only, with no SWOOP_* variable, so a leftover environment variable can't turn it on.
  • --output, --pretty, --signed-only and --no-betas don't apply to a snapshot, so they're refused rather than ignored.

The logic is in the library (ReleaseDataSnapshotExport, SyncEngine.exportSnapshot(fetchedAt:)), so it's tested without CloudKit. SnapshotExportCommand in the CLI only handles the configuration and the file.

Stewed's make release-data-snapshot can then run:

swoopmist export --snapshot Resources/release-data-snapshot.json

with SwoopMistKit's environment loaded (CLOUDKIT_KEY_ID, CLOUDKIT_PRIVATE_KEY_PATH or CLOUDKIT_PRIVATE_KEY; CLOUDKIT_ENVIRONMENT unset or development).

Byte identity with StewedTools

Tests/SwoopMistKitTests/Fixtures/release-data-snapshot-stewedtools.json was written by StewedTools' own records() and write() code, copied verbatim into a throwaway harness built against SwoopMistKit 1.0.0-alpha.3, SwoopCloudKit 1.0.0-beta.1 and MistKit 1.0.0-beta.6, with only the CloudKit query swapped for SnapshotFixture's records. Those records come out of query order, with millisecond dates, INT64 booleans, references, a missing isPrerelease, escaped characters and sdkBuildNumbersText. The tests check:

  • export --snapshot's bytes equal that file exactly;
  • SwoopKit's encoder gives the same bytes as SwoopCloudKit 1.0.0-beta.1's encoder settings;
  • write(_:to:) puts the same bytes on disk.

There's no live Development comparison. No SwoopMistKit or Stewed .env with Development credentials was available locally. Production was never touched.

#17: the 200-record cap

Already fixed: SwoopMistKitService.queryAllRecords calls MistKit 1.0.0-beta.6's queryAllRecords, which follows continuation markers. MistKit's QueryPagination tests cover that, and both export and export --snapshot use it. This PR adds a regression test showing that the snapshot export keeps all 450 records it's given for one type.

Closes #17

Tests

swift test: 318 tests pass against SwoopKit 1.0.0-beta.2 (Package.resolved pins it). New suites:

  • Release-Data Snapshot Export: byte identity, the encoder, writing, only three types queried and nothing written, sorting, whole seconds, more than 200 records.
  • Release-Data Snapshot Export Failures: an empty type, an unmapped record, a failed query.
  • Release-Data Snapshot Export Validation: Development, Production refused or allowed, conflicting options.
  • Snapshot Export Flags: --snapshot, --allow-production, and SWOOP_EXPORT_ALLOW_PRODUCTION being ignored.

make docs passes. make lint adds no new warnings in the changed files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

Summary by CodeRabbit

  • New Features
    • Export release-data snapshots containing SDK versions, Xcode versions, and simulator runtimes to a JSON file.
    • Snapshot export is read-only and limited to Development by default. Use --allow-production to enable it in other environments.
  • Bug Fixes
    • Export now reports an error if required release data is missing or cannot be mapped, or if a query fails.
  • Documentation
    • Added guidance on snapshot export options and output behavior.

Writes SDKVersion, XcodeVersion and SimulatorRuntime as SwoopKit's
ReleaseDataSnapshot, byte for byte what Stewed's StewedTools
`release-data-snapshot` wrote, so Stewed can drop StewedTools
(brightdigit/Stewed#194).

- Queries only those three types with queryAllRecords (paged), maps every
  record with from(recordInfo:), and fails on an empty type or an
  unmapped record.
- Sorted by record name, whole-second fetchedAt, SwoopKit's
  JSONEncoder.iso8601PrettySorted plus a trailing newline.
- Read-only. Development unless --allow-production is passed, which is a
  flag only, with no environment variable.
- A fixture JSON written by StewedTools' own code over fixed records
  proves byte identity.

Needs SwoopKit 1.0.0-beta.2 (brightdigit/SwoopKit#3) for
ReleaseDataSnapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34d8938b-06a5-42f1-ae8b-7b8c32755d1c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Adds swoopmist export --snapshot to fetch SDK version, Xcode version, and simulator runtime records, then write them as a JSON snapshot. The workflow validates options and environment access, reports errors, and includes tests for record mapping, output, and configuration.

Changes: Release-data snapshot export

Layer / File(s) Summary
Snapshot data pipeline
Sources/SwoopMistKit/Snapshot/*, Sources/SwoopMistKit/CloudKit/SyncEngine+Snapshot.swift, Tests/SwoopMistKitTests/Snapshot/*, Tests/SwoopMistKit/Fixtures/*, Package.swift
Adds a SyncEngine snapshot API. The exporter queries and sorts records, rejects empty or unmappable results, truncates fetchedAt to whole seconds, encodes sorted ISO-8601 JSON with a trailing newline, and writes atomically. Tests cover byte identity, record ordering, query failures, output, and timestamps.
Configuration, validation, and CLI integration
Sources/SwoopMistKit/Configuration/*, Sources/SwoopMistKitCLI/Commands/*, Tests/SwoopMistKitTests/Configuration/*, Tests/SwoopMistKitTests/Snapshot/ReleaseDataSnapshotExportValidationTests.swift, README.md, AGENTS.md, Sources/SwoopMistKit/SwoopMistKit.docc/*, .agents/memory/*
Adds --snapshot and CLI-only --allow-production configuration. Snapshot validation rejects conflicting export options and Production access unless enabled. The CLI routes snapshot requests to the new command, which authenticates, fetches, writes, and reports snapshot details. Documentation describes the command and its constraints.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant SnapshotExportCommand
  participant SyncEngine
  participant ReleaseDataSnapshotExport
  participant CloudKit
  participant SnapshotFile
  SnapshotExportCommand->>SyncEngine: exportSnapshot(fetchedAt:)
  SyncEngine->>ReleaseDataSnapshotExport: snapshot(from:fetchedAt:)
  ReleaseDataSnapshotExport->>CloudKit: query all records for three record types
  CloudKit-->>ReleaseDataSnapshotExport: return records
  ReleaseDataSnapshotExport-->>SyncEngine: return ReleaseDataSnapshot
  SyncEngine-->>SnapshotExportCommand: return snapshot
  SnapshotExportCommand->>SnapshotFile: write snapshot and report size
Loading
Merge Risk: Minimal · up to 1c641 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#17] Issue #17 asks that the export retrieve all records per type. Its Phase 2 change is in BushelCloud's SyncEngine+Export.swift, which is outside this repository. This PR does not change BushelClou… Confirm at the reviewed head that SwoopMistKitService.queryAllRecords follows continuation markers, and that a test covers paging through that path. State whether the BushelCloud export change in #17 is tracked in another issue or pull requ…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add swoopmist export --snapshot for the release-data snapshot" matches the main change. The PR adds the export --snapshot option to the swoopmist CLI, which writes SwoopKit's ReleaseDataS…
Out of Scope Changes check Passed The changed files support the snapshot export feature in #17's context or the stated PR scope. These files include the new ReleaseDataSnapshotExport, validation, and SnapshotExportError sources; SyncE…
Full details: Title check

Explanation

The title "Add swoopmist export --snapshot for the release-data snapshot" matches the main change. The PR adds the export --snapshot option to the swoopmist CLI, which writes SwoopKit's ReleaseDataSnapshot. The title names the command and the snapshot feature. It does not mention the read-only Development default or the --allow-production flag, but it does not need to cover every detail.

Full details: Out of Scope Changes check

Explanation

The changed files support the snapshot export feature in #17's context or the stated PR scope. These files include the new ReleaseDataSnapshotExport, validation, and SnapshotExportError sources; SyncEngine.exportSnapshot; ExportConfiguration and configuration key additions for --snapshot and --allow-production; SnapshotExportCommand and its wiring in ExportCommand; the Package.swift SwoopKit minimum bump to 1.0.0-beta.2; the fixtures and tests for these sources; and documentation in README, AGENTS.md, the DocC pages, and the memory notes. The memory notes and AGENTS.md are documentation for the same feature. No change in the summary is unrelated to the snapshot export.

Full details: Linked Issues check

Explanation

[#17] Issue #17 asks that the export retrieve all records per type. Its Phase 2 change is in BushelCloud's SyncEngine+Export.swift, which is outside this repository. This PR does not change BushelCloud. The PR states that SwoopMistKitService.queryAllRecords already calls MistKit 1.0.0-beta.6 queryAllRecords, which follows continuation markers. The reviewed change summary does not show that service method, so its paging behavior at the reviewed head is not verified here. The new test in ReleaseDataSnapshotExportTests covers 450 XcodeVersion records through FixtureRecordService. That test checks that the export keeps records the service returns. It does not test paging inside the service. The PR also covers only SDKVersion, XcodeVersion, and SimulatorRuntime. It does not cover the RestoreImage, XcodeVersion, and SwiftVersion types named in the issue.

Resolution

Confirm at the reviewed head that SwoopMistKitService.queryAllRecords follows continuation markers, and that a test covers paging through that path. State whether the BushelCloud export change in #17 is tracked in another issue or pull request. Without that evidence, this assessment cannot pass.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7dc3b1ae-4f0b-43b3-bba8-9b48599df308
Commits

Reviewing files that changed from the base of the PR and between b381a08 and 1c64187.

Files ignored due to path filters: 1

  • Package.resolved is excluded by !**/Package.resolved
Files selected for processing: 25

  • .agents/memory/MEMORY.md
  • .agents/memory/release-data-snapshot-export.md
  • AGENTS.md
  • Package.swift
  • README.md
  • Sources/SwoopMistKit/CloudKit/SyncEngine+Snapshot.swift
  • Sources/SwoopMistKit/Configuration/ConfigurationKeys.swift
  • Sources/SwoopMistKit/Configuration/ConfigurationLoader+Loading.swift
  • Sources/SwoopMistKit/Configuration/ExportConfiguration.swift
  • Sources/SwoopMistKit/Snapshot/Date+WholeSeconds.swift
  • Sources/SwoopMistKit/Snapshot/ReleaseDataSnapshotExport+Validation.swift
  • Sources/SwoopMistKit/Snapshot/ReleaseDataSnapshotExport.swift
  • Sources/SwoopMistKit/Snapshot/SnapshotExportError.swift
  • Sources/SwoopMistKit/SwoopMistKit.docc/ExportingData.md
  • Sources/SwoopMistKit/SwoopMistKit.docc/SwoopMistKit.md
  • Sources/SwoopMistKitCLI/Commands/ExportCommand.swift
  • Sources/SwoopMistKitCLI/Commands/SnapshotExportCommand.swift
  • Tests/SwoopMistKitTests/Configuration/ConfigurationLoaderTests+SnapshotFlags.swift
  • Tests/SwoopMistKitTests/Configuration/DocumentedFlag.swift
  • Tests/SwoopMistKitTests/Fixtures/release-data-snapshot-stewedtools.json
  • Tests/SwoopMistKitTests/Snapshot/FixtureRecordService.swift
  • Tests/SwoopMistKitTests/Snapshot/ReleaseDataSnapshotExportFailureTests.swift
  • Tests/SwoopMistKitTests/Snapshot/ReleaseDataSnapshotExportTests.swift
  • Tests/SwoopMistKitTests/Snapshot/ReleaseDataSnapshotExportValidationTests.swift
  • Tests/SwoopMistKitTests/Snapshot/SnapshotFixture.swift

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK
@leogdion
leogdion marked this pull request as ready for review November 27, 2026 17:10
@claude

claude Bot commented Nov 27, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@leogdion
leogdion changed the base branch from main to v1.0.0-alpha.4 November 27, 2026 18:23
leogdion added a commit that referenced this pull request Nov 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK
@leogdion
leogdion added this pull request to stack #48 November 27, 2026 19:54
@leogdion
leogdion merged commit 3e0cca1 into v1.0.0-alpha.4 Nov 27, 2026
17 checks passed
leogdion added a commit that referenced this pull request Nov 27, 2026
Covers #46 (export --snapshot) and #47 (sync action summaries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK
leogdion added a commit that referenced this pull request Nov 27, 2026
* Add swoopmist export --snapshot for the release-data snapshot (#46)

* Add `swoopmist export --snapshot` for the release-data snapshot

Writes SDKVersion, XcodeVersion and SimulatorRuntime as SwoopKit's
ReleaseDataSnapshot, byte for byte what Stewed's StewedTools
`release-data-snapshot` wrote, so Stewed can drop StewedTools
(brightdigit/Stewed#194).

- Queries only those three types with queryAllRecords (paged), maps every
  record with from(recordInfo:), and fails on an empty type or an
  unmapped record.
- Sorted by record name, whole-second fetchedAt, SwoopKit's
  JSONEncoder.iso8601PrettySorted plus a trailing newline.
- Read-only. Development unless --allow-production is passed, which is a
  flag only, with no environment variable.
- A fixture JSON written by StewedTools' own code over fixed records
  proves byte identity.

Needs SwoopKit 1.0.0-beta.2 (brightdigit/SwoopKit#3) for
ReleaseDataSnapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

* Resolve SwoopKit 1.0.0-beta.2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Count SDK versions and runtimes in the sync action's summaries (#47)

The sync and export summaries only counted restore images, Xcode and
Swift versions, so SDKVersion and SimulatorRuntime (added in #44) never
showed up. Add both, plus the SDKVersion records the sync deletes.

Also drop the stale "limited to 200 records per type" notes: MistKit
1.0.0-beta.6's queryAllRecords follows continuation markers (#17).


Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
leogdion added a commit that referenced this pull request Nov 27, 2026
* Add 1.0.0-beta.4 release notes

Covers #46 (export --snapshot) and #47 (sync action summaries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

* Call the release 1.0.0-alpha.4

The next version is 1.0.0-alpha.4, not 1.0.0-beta.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3TXo46UssMPhwYSboRtyK

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Export command only retrieves first 200 records per type due to pagination limitation

1 participant