Skip to content

test: add Cashu Fault Lab mint recovery lane - #415

Open
Egge21M wants to merge 3 commits into
masterfrom
agent/cashu-fault-lab-mint-test
Open

test: add Cashu Fault Lab mint recovery lane#415
Egge21M wants to merge 3 commits into
masterfrom
agent/cashu-fault-lab-mint-test

Conversation

@Egge21M

@Egge21M Egge21M commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

Coco has durable mint-operation recovery, but its response-loss behavior is not exercised by an external fault-injection oracle. A mint may commit issuance while the wallet never receives the response, so the same persisted output plan must be reconciled without a duplicate credit.

Summary

  • add a test-only Cashu Fault Lab lifecycle HTTP adapter backed by Coco and SQLite
  • run the published cashu-fault-lab@0.2.0 mint-response-lost scenario through pinned mintd and Fault Lab gateway images
  • add local commands, focused adapter contract coverage, documentation, and a narrowly scoped GitHub Actions workflow
  • keep the integration optional and limited to the mint operation with process durability
  • cover WebSocket error logging deterministically so aggregate core coverage does not depend on incidental socket timing

Verification

  • bun run test:fault-lab:adapter
  • bunx tsc -p test/fault-lab/tsconfig.json
  • bash -n test/fault-lab/run-mint-response-lost.sh
  • bun run test:coverage:core (1,243 tests passed locally)
  • parsed test/fault-lab/compose.yml and the workflow as YAML
  • GitHub Actions cashu-fault-lab / mint-response-lost: passed with a 64 sat credit and persisted output-plan evidence
  • repository build, format, integration, adapter, and dependency checks: passed
  • the GitHub core-unit job remains timing-sensitive in existing PollingTransport tests; three retries failed at three different waitFor assertions, while the full suite passes locally

Changeset

  • not added; this changes test tooling and CI only, with no published package or public API change

@github-project-automation github-project-automation Bot moved this to Backlog in coco Aug 5, 2026
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 637dd7c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.40%. Comparing base (eb21988) to head (637dd7c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #415      +/-   ##
==========================================
- Coverage   93.40%   93.40%   -0.01%     
==========================================
  Files         113      113              
  Lines       17930    17930              
==========================================
- Hits        16748    16747       -1     
- Misses       1182     1183       +1     
Flag Coverage Δ
core-integration 49.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Egge21M
Egge21M force-pushed the agent/cashu-fault-lab-mint-test branch from 295405a to c9acc89 Compare August 5, 2026 19:35
@Egge21M
Egge21M marked this pull request as ready for review August 6, 2026 06:46

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 637dd7ca94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread test/fault-lab/adapter.ts
Comment on lines +268 to +269
await manager.mint.addMint(input.mint, { trusted: true });
const quote = await manager.quotes.mint.create({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reserve operation IDs before creating mint side effects

If two requests with the same operationId overlap—or a request fails after quote creation but before the row is inserted—both pass the existence check and create separate paid quotes and Coco operations; only the later insert detects the collision, leaving an orphaned operation or funds behind. Persist or lock the lifecycle identity atomically before creating the quote, and roll it forward from that reservation.

AGENTS.md reference: AGENTS.md:L164-L167

Useful? React with 👍 / 👎.

Comment on lines +5 to +8
pull_request:
paths:
- 'test/fault-lab/**'
- '.github/workflows/cashu-fault-lab.yml'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the recovery lane when core recovery code changes

For pull requests that modify only packages/core/**, including MintOperationService or the NUT-09 recovery handlers this scenario is intended to validate, this workflow is skipped because its path filter includes only the Fault Lab files and its own YAML. Consequently, the external response-loss regression test does not protect the production recovery changes it targets; include the relevant core and storage package paths in this trigger.

Useful? React with 👍 / 👎.

Comment thread test/fault-lab/adapter.ts
Comment on lines +180 to +181
sourceDigest: `sha256:${digest('cashu-fault-lab/coco/source/v1', version)}`,
buildDigest: `sha256:${digest('cashu-fault-lab/coco/adapter/v1', 'mint')}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive provenance digests from the tested revision

In the supplied runner COCO_FAULT_LAB_VERSION is unset, so version is always workspace and both digest inputs are constants; every Coco revision and dependency build therefore reports the same sourceDigest and buildDigest. This misidentifies Fault Lab artifacts and prevents results from being tied to the code that produced them, so derive these values from the checked-out revision and actual build inputs.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant