Skip to content

added search and delete + attempt CI#2

Merged
MiaKoring merged 10 commits into
amethystsoft:mainfrom
MiaKoring:main
May 4, 2026
Merged

added search and delete + attempt CI#2
MiaKoring merged 10 commits into
amethystsoft:mainfrom
MiaKoring:main

Conversation

@MiaKoring
Copy link
Copy Markdown
Member

@MiaKoring MiaKoring commented May 4, 2026

Summary

This PR adds search and delete functionality to the Swift Secret Service library, along with a complete CI/CD integration test setup.

Core Features Added

Search Functionality (searchItems(for:in:))

  • Queries the Secret Service for items matching specified attributes
  • Returns an array of object paths for matching items
  • Includes helper method decodeSearchItems() to parse DBus responses

Delete Functionality (deleteItem(item:))

  • Deletes a specific item from the Secret Service
  • Returns an optional prompt path (returns nil if no prompt is required)
  • Includes helper method decodeDeleteItem() to parse DBus responses

Supporting Changes

Helper Extensions

  • Added asObjectPathArray property to Array<DBusValue> for converting to object paths
  • Added asStringToString dictionary converter for string-to-string DBus value mapping

Integration Testing

  • Implemented comprehensive GitHub Actions workflow (test.yml) that sets up D-Bus and GNOME Keyring for running integration tests
  • Workflow runs on Ubuntu 24.04 ARM with Swift 6.3
  • Added proper teardown logic using the new search/delete methods to clean up test items
  • Updated test to verify end-to-end create, read, delete workflow

Code Quality

The implementation demonstrates excellent consistency with the existing codebase:

  • Error handling patterns align with existing decode methods
  • Async/await patterns match the rest of the SecretService API
  • The new public methods use the same throws(SecSError) pattern
  • CI configuration properly isolates the D-Bus session and handles authentication

The integration test teardown elegantly leverages the new functionality to validate both search and delete operations work correctly while cleaning up test artifacts.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@MiaKoring has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 58 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fb80cdc8-7a6a-459f-8aba-14a232ac8d19

📥 Commits

Reviewing files that changed from the base of the PR and between e1cf8d2 and 36a80d7.

📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • Sources/SecretService/Helper/MessageDecoding.swift
  • Sources/SecretService/SecretService.swift
  • Tests/swift-secret-serviceTests/IntegrationTests/swift_secret_serviceTests.swift
📝 Walkthrough

Walkthrough

This PR adds search and delete operations to the SecretService API. It introduces helper utilities for data conversion, message decoding methods for parsing DBus responses, two new public methods (searchItems() and deleteItem()), integration tests validating the new functionality, and a GitHub Actions workflow to run integration tests in an isolated D-Bus session with GNOME Keyring.

Changes

Search and Delete Operations for SecretService

Layer / File(s) Summary
Helper Utilities
Sources/SecretService/Helper/Array.swift, Sources/SecretService/Helper/Dictionary.swift
New computed properties asObjectPathArray and asStringToString enable conversion of DBusValue arrays to object paths and String dictionaries to DBus format.
Message Decoding
Sources/SecretService/Helper/MessageDecoding.swift
decodeSearchItems() parses search responses into [String] object paths; decodeDeleteItem() parses delete responses into optional prompt paths, treating "/" as nil.
Public API
Sources/SecretService/SecretService.swift
searchItems(for:in:) queries items by attributes; deleteItem(item:) deletes an item. Private send() error type updated from SecretServiceError to SecSError for consistency.
Integration Testing & CI
Tests/.../IntegrationTests/swift_secret_serviceTests.swift, .github/workflows/test.yml
Test renamed to testCreateReadDeleteItem and extended to validate delete and search workflows. GitHub Actions workflow installs dependencies, starts D-Bus session with GNOME Keyring daemon, and runs integration tests.

Sequence Diagram(s)

sequenceDiagram
    participant Test
    participant SecretService
    participant DBus
    participant Keyring as GNOME Keyring

    Test->>SecretService: searchItems(attributes, collection)
    SecretService->>DBus: SearchItems method call
    DBus->>Keyring: search for items
    Keyring-->>DBus: object paths
    DBus-->>SecretService: method return [paths]
    SecretService->>SecretService: decodeSearchItems()
    SecretService-->>Test: [String] paths
Loading
sequenceDiagram
    participant Test
    participant SecretService
    participant DBus
    participant Keyring as GNOME Keyring

    Test->>SecretService: deleteItem(item)
    SecretService->>DBus: Delete method call
    DBus->>Keyring: delete item
    Keyring-->>DBus: prompt path or "/"
    DBus-->>SecretService: method return
    SecretService->>SecretService: decodeDeleteItem()
    SecretService-->>Test: String? prompt
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • amethystsoft/swift-secret-service#1: Extends the same SecretService codebase by building on low-level DBus helpers and message decoding patterns to add search and delete functionality.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% 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 'added search and delete + attempt CI' accurately describes the main changes: implementing search and delete functionality and adding CI/workflow configuration.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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/test.yml:
- Line 9: The workflow's runs-on label uses a Blacksmith-specific runner
(`runs-on: blacksmith-4vcpu-ubuntu-2404-arm`) which GitHub Actions can't
resolve; either replace that label with a standard GitHub-hosted runner (e.g.,
`runs-on: ubuntu-24.04` or `runs-on: ubuntu-latest`) so the job will be queued,
or if you intentionally need the Blacksmith runner keep the existing `runs-on`
value and add an `actionlint.yaml` suppression for the false-positive so
validators know the custom runner is expected.

In `@Sources/SecretService/Helper/MessageDecoding.swift`:
- Around line 92-104: The unexpected-response error in decodeDeleteItem()
currently reports the wrong operation name ("SearchItems"); update the thrown
.unexpectedResponse(...) call inside decodeDeleteItem to use the correct
operation identifier (e.g. "DeleteItem" or the canonical name used elsewhere for
delete replies) so the error message matches the function decodeDeleteItem() and
aids accurate debugging of delete responses (look for decodeDeleteItem(),
.unexpectedResponse(for: ...) and the surrounding messageType/body handling).

In `@Sources/SecretService/SecretService.swift`:
- Line 142: The bindings in searchItems and deleteItem call getSession() and
bind session even though it's unused, causing a compiler warning; replace the
explicit binding with an explicit discard of the return value (or remove the
call entirely if you decide the session precondition is unnecessary) so the call
still enforces connect() but does not bind an unused variable—update the
occurrences in the searchItems and deleteItem methods where getSession() is
called (affecting the current check before Collection.SearchItems and
Item.Delete DBus calls).

In
`@Tests/swift-secret-serviceTests/IntegrationTests/swift_secret_serviceTests.swift`:
- Around line 98-100: The loop creates an unused binding `prompt` from `try
await service.deleteItem(item: item)` which triggers a compiler warning; replace
the unused binding with an explicit discard by changing the call to `_ = try
await service.deleteItem(item: item)` (locate the loop over `items` in
swift_secret_serviceTests.swift and the call to `service.deleteItem`) so the
result is intentionally ignored.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e10ee0d1-1aa6-495e-8afa-d399b04a9664

📥 Commits

Reviewing files that changed from the base of the PR and between 88a265f and e1cf8d2.

📒 Files selected for processing (6)
  • .github/workflows/test.yml
  • Sources/SecretService/Helper/Array.swift
  • Sources/SecretService/Helper/Dictionary.swift
  • Sources/SecretService/Helper/MessageDecoding.swift
  • Sources/SecretService/SecretService.swift
  • Tests/swift-secret-serviceTests/IntegrationTests/swift_secret_serviceTests.swift

Comment thread .github/workflows/test.yml
Comment thread Sources/SecretService/Helper/MessageDecoding.swift
Comment thread Sources/SecretService/SecretService.swift Outdated
@MiaKoring MiaKoring merged commit 4439636 into amethystsoft:main May 4, 2026
3 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