Skip to content

run the plugin against a real backend, and wire Linux into CI - #155

Merged
hpoul merged 3 commits into
mainfrom
integration-test-scaffold
Aug 25, 2026
Merged

run the plugin against a real backend, and wire Linux into CI#155
hpoul merged 3 commits into
mainfrom
integration-test-scaffold

Conversation

@hpoul

@hpoul hpoul commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Nothing has ever executed the Linux implementation — not in this repository, not in CI. The forceInit bookkeeping, the GHashTable lifetime and six rewritten response sites all shipped in 6.0.0-dev.3 verified by compiling and reading alone. That was the weakest evidence anywhere in this release. This closes it.

The scaffold

example/integration_test/ is new. The example had no integration_test dependency and no scaffold at all, which is why "add a Linux runtime test" was never a small job.

Six tests, run through the method channel against the real platform backend:

The fifth earns its place separately. A round-trip suite alone never reaches handleInit's new branch, because it never initialises the same name twice — so the logic this release added to four platforms would have stayed unexecuted even with integration tests present. It has to be asked for deliberately.

Every store uses authenticationRequired: false. An authenticated one needs a real biometric or credential gesture that no CI runner can give; the emulator work in #151 shows what that costs.

CI

gnome-keyring, dbus-x11 and xvfb added to the Linux job, and the suite runs under a session bus with an unlocked keyring — libsecret needs the bus, the desktop runner needs a display.

The empty-password unlock is the fragile part, and worth knowing about: if a future runner image breaks it, the failure will look like a plugin bug rather than an environment one.

Verification

Run against the real Android keystore on an emulator — all six pass, including install, launch, channel, native backend and teardown. So the scaffold itself is proven; the Linux leg is what CI proves.

macOS cannot run it locally: the example's keychain-access-groups entitlement needs a development certificate, the same reason macOS is absent from the build matrix.

What this does not buy

Functional coverage, not leak detection — catching something like the FlValue leak fixed in #153 needs a separate leak-check run. And it is one platform's runtime; the scaffold now exists for the others, but wiring macOS or Windows into it is a separate change.

🤖 Generated with Claude Code

hpoul and others added 2 commits August 25, 2026 20:00
Nothing has ever executed the Linux implementation — not here, not in CI. Its
forceInit bookkeeping, the GHashTable's lifetime and six rewritten response
sites all shipped in 6.0.0-dev.3 verified by compiling and reading alone. That
was the weakest evidence in the release, and this closes it.

example/integration_test/ is new: the example had no integration_test dependency
and no scaffold at all. Six tests exercising the real backend through the method
channel — round-trip with non-ASCII, overwrite, the empty value that used to
throw on win32, absent-read, and canAuthenticate mapping to a known enum member
rather than the StateError that was #148.

The fifth test earns its place separately: it calls getStorage twice, with and
without forceInit. A round-trip suite alone never reaches handleInit's new
branch, because it never initialises the same name twice — so the logic this
release added to four platforms would have stayed unexecuted even with
integration tests present.

Every store uses authenticationRequired: false. An authenticated one needs a
real biometric or credential gesture, which no runner can give; the emulator
work in #151 shows what that costs.

CI gains gnome-keyring, dbus-x11 and xvfb, and runs the suite under a session
bus with an unlocked keyring. libsecret needs the bus, the desktop runner needs
a display.

Verified by running the suite against the real Android keystore on an emulator:
all six pass. The Linux leg is what CI will prove.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The first run failed exactly where the fragility was predicted. The daemon
started, but an empty unlock password creates no keyring, and the graphical
prompter it falls back to cannot open a display — so every write failed with
"Object does not exist at /org/freedesktop/secrets/collection/login" while the
reads, the absent-read, forceInit and canAuthenticate all passed. That split is
the evidence: the channel and the plugin were fine, there was nowhere to store.

A non-empty password and an existing ~/.local/share/keyrings are what make the
login keyring appear.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hpoul
hpoul force-pushed the integration-test-scaffold branch from d6a2e0b to 23562f5 Compare August 25, 2026 18:01
Three points from review, all about assertions that pass for the wrong
reason.

The teardown wrapped `delete()` in a bare `catch (_)`, justified as
"a test that failed mid-way may have left nothing". That case does not
throw: Android guards on `exists()`, libsecret reports `removed = false`
with no error set, the keychain maps `errSecItemNotFound` to `true`, and
win32 maps `ERROR_NOT_FOUND` to `false`. So the only exception the catch
could ever swallow was a store that genuinely failed — the class of bug
this suite exists to surface — sitting in the one file whose whole
purpose is to be loud. The win32 unit suite already uses the bare form.

`canAuthenticate` asserted `isA<CanAuthenticateResponse>()`, which the
return type makes a tautology. The real test was always the await: an
unmapped native string throws a StateError inside `canAuthenticate`,
which is how #148 surfaced. `completes` is the same test, and says so,
so a later reader does not "fix" the tautology by deleting it. Linux
hard-codes "ErrorHwUnavailable" in the C, so on that one platform the
native-string-to-enum mapping itself can be pinned.

The forceInit test asserted only the exception type. That is already
discriminating on the method-channel platforms — nothing but the native
repeat-plus-forceInit branch emits `AlreadyInitialized`, and any other
native response stays a `PlatformException` — but naming the code
matches the unit suite and guards the day a second code is translated.

Verified: `flutter analyze --fatal-infos` clean in both packages,
`flutter test` green, and the Linux job runs the suite against real
libsecret.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hpoul
hpoul force-pushed the integration-test-scaffold branch from af38417 to 92c672e Compare August 25, 2026 18:17
@hpoul
hpoul merged commit 26537b8 into main Aug 25, 2026
29 checks passed
@hpoul
hpoul deleted the integration-test-scaffold branch August 25, 2026 18:23
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