Skip to content

fix(contracts): format escrow test helper to resolve failing CI check - #208

Merged
oluwaseyi1996-netizen merged 4 commits into
vatal-system:mainfrom
oluwaseyi1996-netizen:fix/ci-contracts-fmt
Oct 20, 2026
Merged

oluwaseyi1996-netizen merged 4 commits into
vatal-system:mainfrom
oluwaseyi1996-netizen:fix/ci-contracts-fmt

Conversation

@oluwaseyi1996-netizen

Copy link
Copy Markdown
Contributor

What it fixes

Fixes the failing CI workflow on main where the Contracts – fmt, clippy, test, wasm job failed during the cargo fmt --all -- --check step (e.g., GitHub Actions run #39443557135).

Root cause

In PR #206 (fix/four-reported-issues), the test helper function create_raw was added/updated in contracts/escrow/src/test.rs to parse XDR payloads via from_xdr. The invocation was formatted across multiple lines:

let parsed = <xdr::ScVal as ReadXdr>::from_xdr(
    &mut milestones_xdr.as_bytes(),
    Format::Base64,
)
.map_err(|_| std::string::String::from("milestone XDR does not parse"))?;

Under standard rustfmt rules (enforced by the stable toolchain pinned in .github/workflows/ci.yml), arguments of this length are collapsed into a single line. Because the pull request was merged without running cargo fmt --all -- --check, main entered a failing CI state on the formatting step.

The fix and why

Ran cargo fmt --all in contracts/, collapsing the from_xdr call in contracts/escrow/src/test.rs into its canonical Rustfmt representation:

let parsed = <xdr::ScVal as ReadXdr>::from_xdr(&mut milestones_xdr.as_bytes(), Format::Base64)
    .map_err(|_| std::string::String::from("milestone XDR does not parse"))?;

This directly resolves the formatting diff without altering any test logic or contract execution behavior.

How it was tested

  1. Contracts formatting: Ran cargo fmt --all -- --check in contracts/ — exited cleanly with code 0 and zero diff.
  2. Frontend suite:
    • npm run lint — passed with 0 errors/warnings.
    • npx tsc --noEmit — passed with 0 type errors.
    • npm test — all 361 unit/integration tests passed.
    • npm run build — production build succeeded.
  3. Backend suite:
    • npx prisma generate — generated client cleanly.
    • npx tsc --noEmit — passed with 0 type errors.
    • npm test -- ciWorkflows — all CI workflow configuration tests passed.

Follow-up worth filing separately

  • Consider adding a pre-commit git hook (e.g., via Husky or Git pre-commit script) or a pull request template checklist to ensure contributors run cargo fmt --all -- --check locally prior to opening PRs, preventing format regressions from reaching the integration branches.

@oluwaseyi1996-netizen
oluwaseyi1996-netizen merged commit caf931a into vatal-system:main Oct 20, 2026
3 of 4 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