Skip to content

fix: support OpenBSD#3

Merged
mozharovsky merged 9 commits into
mainfrom
codex/openbsd-support
Jun 25, 2026
Merged

fix: support OpenBSD#3
mozharovsky merged 9 commits into
mainfrom
codex/openbsd-support

Conversation

@mozharovsky

@mozharovsky mozharovsky commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • exercise the package test suite on OpenBSD 7.8
  • align directory-stream interop with OpenBSD's imported C ABI
  • make the DOS-date upper-bound regression test independent of the runner's time zone
  • keep documentation checks stable while Swift's shared workflow regression is unresolved

Why

swift-zip-archive already uses portable POSIX and Swift System APIs, but its DIR * compatibility alias did not include OpenBSD. Continuous testing keeps that ABI support from regressing.

The reusable soundness workflow currently fetches its documentation helper from main, where swiftlang/github-workflows#291 passes quoted .spi.yml target names to SwiftPM. This PR disables only that reusable subjob and runs the same official helper at an explicit known-good revision, so documentation validation remains enabled and reproducible.

Testing

  • the initial OpenBSD job reproduced the compiler failure: cannot find type 'DIR' in scope
  • the next OpenBSD run compiled the package and exposed a time-zone-dependent DOS-date fixture
  • swift test: 91 tests passed locally after both fixes
  • CI covers macOS, Linux with Swift 6.1/6.2/6.3, Windows, and OpenBSD 7.8

Summary by CodeRabbit

  • New Features
    • Expanded CI coverage to run tests on OpenBSD.
    • Improved documentation verification in the quality workflow with a dedicated documentation check run.
  • Bug Fixes
    • Improved Unix-like directory handling for better cross-platform compatibility, including OpenBSD.
    • Updated a DOS timestamp date-encoding test case to align with representable ranges.
  • Documentation
    • Updated README platform status to explicitly include Apple OSs, Linux, OpenBSD, and Windows for ZipArchive.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 26a8d9e9-509a-41fe-a21b-3d4aebf6f336

📥 Commits

Reviewing files that changed from the base of the PR and between 7293ae1 and c4aff84.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

OpenBSD support is added to platform handling, CI, and soundness workflows, and one reader test input is adjusted. The status text now lists OpenBSD among supported platforms.

Changes

OpenBSD support and workflow updates

Layer / File(s) Summary
OpenBSD platform handling
Sources/ZipArchive/System+directory.swift, README.md, Tests/ZipArchiveTests/ZipArchiveReaderTests.swift
system_DIRPtr now uses OpaquePointer for Linux, Android, FreeBSD, and OpenBSD; the status text includes OpenBSD; and the reader test uses a later timestamp input.
OpenBSD CI job
.github/workflows/ci.yml
Adds an openbsd CI job with OpenBSD Swift container setup, cloud-init user data, repository copy steps, and result reporting from the guest run.
Soundness documentation checks
.github/workflows/soundness.yml
Repins the reusable workflow, disables docs_check_enabled, and adds a documentation job that runs the docs checker in a Swift container.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

ᕱᕱ I hop through CI with a cheer,
OpenBSD now nibbles here and there.
The docs check shuffles, the tests still sing,
And zippered code gets another spring. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding and hardening OpenBSD support across CI, tests, and code paths.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/openbsd-support

Comment @coderabbitai help to get the list of available commands.

@mozharovsky
mozharovsky marked this pull request as ready for review June 25, 2026 23:06
@mozharovsky

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

67-76: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Make the OpenBSD job's token scope explicit.

This job executes repository code in the guest, but it currently inherits whatever the repository default GITHUB_TOKEN permissions are. Add a job-level permissions: block so this job cannot silently widen if the repo default changes later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 67 - 76, The openbsd job currently
relies on inherited GITHUB_TOKEN defaults, so its repository access scope is
implicit. Add an explicit job-level permissions block on the openbsd job in the
workflow to lock down token access, and keep the scope minimal so future
repository default changes cannot silently broaden it.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 107-113: The cloud-init setup in the workflow is copying the
entire workspace into the OpenBSD guest, which can bring the checkout credential
along with the .git directory. Update the actions/checkout step to use
persist-credentials: false, and adjust the Prepare cloud-init copy in the same
job so the repo transfer excludes .git unless the guest explicitly needs it. Use
the Checkout and Prepare cloud-init steps in the workflow to locate the fix.
- Around line 70-71: The CI workflow currently uses mutable references for the
OpenBSD container image and the checkout action, so update the workflow to pin
both dependencies to immutable versions. In the workflow definition that sets
the container image and the step using actions/checkout, replace the tag-based
image reference and the v6 action ref with a specific image digest and the full
commit SHA for the checkout action, keeping the existing job structure and
symbol locations unchanged.

In @.github/workflows/soundness.yml:
- Around line 12-20: The workflow is using the mutable swift:latest image in
both the reusable workflow input and the documentation job, so update the
soundness workflow to use the same pinned Swift release and digest in both
places. Replace the container image values referenced by
api_breakage_check_container_image and the documentation job’s container.image
with an immutable Swift tag plus digest so both checks stay consistent over
time.
- Around line 22-31: Both checkout steps are still using a floating
actions/checkout version and are leaving persisted credentials enabled. Update
the two checkout uses in the workflow to a full commit SHA for actions/checkout,
and set persist-credentials to false in both the repository checkout and the
documentation checker checkout so the workflow is fully pinned and does not
retain credentials.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 67-76: The openbsd job currently relies on inherited GITHUB_TOKEN
defaults, so its repository access scope is implicit. Add an explicit job-level
permissions block on the openbsd job in the workflow to lock down token access,
and keep the scope minimal so future repository default changes cannot silently
broaden it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44f408c6-5353-4d15-b6ec-4a9b90900d47

📥 Commits

Reviewing files that changed from the base of the PR and between a611fb9 and e8ca33a.

📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • .github/workflows/soundness.yml
  • README.md
  • Sources/ZipArchive/System+directory.swift
  • Tests/ZipArchiveTests/ZipArchiveReaderTests.swift

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/soundness.yml Outdated
Comment thread .github/workflows/soundness.yml
@mozharovsky
mozharovsky merged commit a08621b into main Jun 25, 2026
18 checks passed
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.

1 participant