Skip to content

[Spike] Assess verification against real wallet versions #118 - #131

Open
EmmanuelAdah wants to merge 19 commits into
Gryd-lock:mainfrom
EmmanuelAdah:main
Open

[Spike] Assess verification against real wallet versions #118#131
EmmanuelAdah wants to merge 19 commits into
Gryd-lock:mainfrom
EmmanuelAdah:main

Conversation

@EmmanuelAdah

Copy link
Copy Markdown

Add protocol-drift detection infrastructure for real Freighter/Albedo wallet testing

Summary

Adds a spike report and initial infrastructure for detecting when real Freighter/Albedo
extension releases drift from what Gryd Lock's synthetic e2e fixtures assume. Splits
CI into fast/blocking checks vs. slower/non-blocking real-wallet canary checks, and adds
a first real-wallet interception test against a live Freighter build.

What's included

Docs

  • protocol-drift-spike.md — synthetic coverage analysis, wallet compatibility matrix
    template, protocol-fixture proposal, CI/scheduled recommendation, follow-up plan.

External protocol contracts

  • src/intercept/externalWalletProtocol.ts — zod schemas + type guards for Freighter's
    SUBMIT_TRANSACTION request/response and Albedo's intent request/response, built from
    the real fixtures already used in src/tests/walletContracts.test.ts. Distinct from
    the existing src/intercept/protocol.ts, which governs Gryd Lock's own internal
    message bus and can't drift the way an upstream wallet can.
  • Only the decline/reject path is confirmed against real fixtures for both wallets.
    Success-response shapes for both are explicitly marked unconfirmed in comments.

Real-wallet e2e (new, isolated from the synthetic suite)

  • e2e/real/real-freighter-version.spec.ts — loads a real, version-pinned Freighter
    build alongside dist/, captures whatever messages the real extension actually sends,
    and validates them against the schemas above. Skips gracefully if no vendored build
    is present.
  • playwright.canary.config.ts — new, scoped to e2e/real, longer timeout than the
    synthetic config.
  • playwright.e2e.config.ts — added testIgnore: '**/real/**' so the default
    npm run test:e2e never picks up real-wallet tests.
  • scripts/download-wallet-release.sh — fetches a pinned Freighter/Albedo tag.
    Clones source only — does not build it yet (see Known gaps).
  • tests/wallet-versions.json — single source of truth for pinned wallet versions.

CI

  • .github/workflows/ci.yml — added npm audit --omit=dev (blocking, production deps
    only) and full npm audit (informational, continue-on-error); removed a redundant
    duplicate Playwright browser install; added npm run check:versions to the PR-blocking
    path.
  • .github/workflows/wallet-canary.yml — new, non-blocking, scheduled nightly (pinned
    versions) + weekly (latest versions), files/updates a GitHub issue on failure.

Misc

  • .gitignore — fixed a real bug in the fixtures/wallets/**/ pattern (git won't
    descend into an already-ignored directory to apply the .pinned-version negation);
    added coverage/, playwright-report/, .env*.

Known gaps — do not merge assuming these are solved

  • scripts/download-wallet-release.sh doesn't build anything. Needs the real
    Freighter/Albedo build commands wired in once confirmed.
  • The real Freighter test currently fails on a fresh profile, because Freighter
    has no onboarded account and lands on #/welcome. e2e/real/helpers/onboardFreighter.ts
    is a scaffold with placeholder selectors (marked TODO-SELECTOR), not working
    code — it needs real selectors from a recorded onboarding session
    (scripts/record-freighter-onboarding.mjs) before this test can pass end-to-end.
  • No golden-capture fixtures or docs/wallet-compatibility.md yet — the matrix in
    the spike doc has unverified cells pending a real run.
  • No packaging/zip step implementing releaseArchiveName() from scripts/versioning.mjs.
  • PyCharm's Playwright plugin isn't correctly picking up e2e/real/*.spec.ts — runs
    fine from terminal (npx playwright test --config=playwright.canary.config.ts), IDE
    integration untested/unresolved.

Testing

  • npx playwright test --config=playwright.canary.config.ts -g "Real-wallet protocol drift: Freighter" — currently fails at the onboarding gap described above (expected,
    not a regression).
  • Synthetic suite (npm run test:e2e) and unit/contract tests (npm run test:all)
    unaffected by this PR — no changes to existing passing tests.

Follow-ups (not in this PR)

  • Complete onboardFreighter() with real recorded selectors.
  • Wire real build commands into download-wallet-release.sh.
  • Repeat the same pattern for Albedo (structurally different — popup-first, no ambient
    interception point).
  • Populate docs/wallet-compatibility.md from actual PoC runs.

…and Albedo, replace outdated POC coverage report, and adjust diagnostics parsing.
…hter, update Playwright config for real-wallet tests, and add wallet contract validation tests.
…ghter and Albedo releases, including testing strategy recommendations, compatibility matrix, and protocol contract schema PoC.
Add a spike report analyzing why the existing synthetic e2e suite can't
detect Freighter/Albedo protocol drift, plus the first real infrastructure
toward closing that gap.

- Add protocol-drift-spike.md: synthetic coverage/blind-spot analysis,
  wallet compatibility matrix template, protocol-fixture proposal,
  CI-vs-scheduled recommendation, and a follow-up plan.

- Add src/intercept/externalWalletProtocol.ts: zod schemas and type
  guards for Freighter's SUBMIT_TRANSACTION request/response and
  Albedo's intent request/response. Built directly from the real
  fixtures already used by src/tests/walletContracts.test.ts, not
  from documentation or assumption. Distinct in purpose from the
  existing src/intercept/protocol.ts, which governs Gryd Lock's own
  internal message bus and cannot drift the way an upstream wallet's
  protocol can. Only the decline/reject path is confirmed against
  real fixtures for both wallets; success-response shapes remain
  explicitly marked unconfirmed.

- Add e2e/real/real-freighter-version.spec.ts: loads a real,
  version-pinned Freighter build alongside dist/, captures whatever
  the real extension actually sends, and validates it against the
  schemas above. Skips gracefully when no vendored build is present.
  Isolated from the synthetic suite via playwright.canary.config.ts
  and a new testIgnore entry in playwright.e2e.config.ts, since
  real-wallet runs are slower and can fail for reasons unrelated to
  Gryd Lock (wallet-side bugs, network flakiness).

- Add scripts/download-wallet-release.sh and tests/wallet-versions.json
  to pin and fetch wallet versions deliberately rather than testing
  against "latest" in any blocking path. NOTE: the script currently
  clones wallet source only; it does not yet build it.

- Add scripts/record-freighter-onboarding.mjs and a scaffolded (not
  functional) e2e/real/helpers/onboardFreighter.ts. Discovered mid-work
  that a fresh Freighter profile has no onboarded account, so the
  real interception test currently reaches Freighter's #/welcome
  screen and captures nothing — expected given no account exists to
  sign with, not a broken trigger. Onboarding automation is blocked
  on real selectors from a recorded session; placeholders are marked
  TODO-SELECTOR and are not safe to run as-is.

- Update .github/workflows/ci.yml: add npm run check:versions to the
  blocking path, add npm audit --omit=dev (blocking, production deps
  only) plus a full npm audit (informational, continue-on-error),
  and remove a redundant duplicate Playwright browser install.

- Add .github/workflows/wallet-canary.yml: non-blocking scheduled
  job (nightly pinned versions, weekly latest), files/updates a
  GitHub issue on failure rather than blocking any PR.

- Fix .gitignore: the previous fixtures/wallets/**/ pattern ignored
  the wallet build directories themselves, which meant git never
  descended into them to apply the !.pinned-version negation — that
  metadata file was silently never tracked despite the exception
  rule. Also add coverage/, playwright-report/, and .env* (untracked
  previously).

Known gaps, tracked as follow-ups rather than blocking this commit:
wallet build step unimplemented, onboarding selectors unverified,
no golden-capture fixtures or docs/wallet-compatibility.md yet, no
release-zip step implementing releaseArchiveName(), Albedo path not
yet started, PyCharm Playwright plugin integration unresolved (CLI
runs work correctly).
… to v1.18.0, and `bignumber.js` to v11.1.4.
…est/coverage-v8` to v4.1.11, and `vite` to v8.2.2; remove outdated and unused packages.
Add a spike report analyzing why the existing synthetic e2e suite can't
detect Freighter/Albedo protocol drift, plus the first real infrastructure
toward closing that gap.

- Add protocol-drift-spike.md: synthetic coverage/blind-spot analysis,
  wallet compatibility matrix template, protocol-fixture proposal,
  CI-vs-scheduled recommendation, and a follow-up plan.

- Add src/intercept/externalWalletProtocol.ts: zod schemas and type
  guards for Freighter's SUBMIT_TRANSACTION request/response and
  Albedo's intent request/response. Built directly from the real
  fixtures already used by src/tests/walletContracts.test.ts, not
  from documentation or assumption. Distinct in purpose from the
  existing src/intercept/protocol.ts, which governs Gryd Lock's own
  internal message bus and cannot drift the way an upstream wallet's
  protocol can. Only the decline/reject path is confirmed against
  real fixtures for both wallets; success-response shapes remain
  explicitly marked unconfirmed.

- Add e2e/real/real-freighter-version.spec.ts: loads a real,
  version-pinned Freighter build alongside dist/, captures whatever
  the real extension actually sends, and validates it against the
  schemas above. Skips gracefully when no vendored build is present.
  Isolated from the synthetic suite via playwright.canary.config.ts
  and a new testIgnore entry in playwright.e2e.config.ts, since
  real-wallet runs are slower and can fail for reasons unrelated to
  Gryd Lock (wallet-side bugs, network flakiness).

- Add scripts/download-wallet-release.sh and tests/wallet-versions.json
  to pin and fetch wallet versions deliberately rather than testing
  against "latest" in any blocking path. NOTE: the script currently
  clones wallet source only; it does not yet build it.

- Add scripts/record-freighter-onboarding.mjs and a scaffolded (not
  functional) e2e/real/helpers/onboardFreighter.ts. Discovered mid-work
  that a fresh Freighter profile has no onboarded account, so the
  real interception test currently reaches Freighter's #/welcome
  screen and captures nothing — expected given no account exists to
  sign with, not a broken trigger. Onboarding automation is blocked
  on real selectors from a recorded session; placeholders are marked
  TODO-SELECTOR and are not safe to run as-is.

- Update .github/workflows/ci.yml: add npm run check:versions to the
  blocking path, add npm audit --omit=dev (blocking, production deps
  only) plus a full npm audit (informational, continue-on-error),
  and remove a redundant duplicate Playwright browser install.

- Add .github/workflows/wallet-canary.yml: non-blocking scheduled
  job (nightly pinned versions, weekly latest), files/updates a
  GitHub issue on failure rather than blocking any PR.

- Fix .gitignore: the previous fixtures/wallets/**/ pattern ignored
  the wallet build directories themselves, which meant git never
  descended into them to apply the !.pinned-version negation — that
  metadata file was silently never tracked despite the exception
  rule. Also add coverage/, playwright-report/, and .env* (untracked
  previously)
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