Skip to content

test(keeper): assert one contract's failure cannot stop a tick #7

Description

@0dillon

Summary

runTick wraps each maintainContract call in a try/catch so that one contract's failure is
logged and the loop continues. This is the property that keeps a keeper maintaining twenty contracts
when the first one is broken, and nothing tests it.

It is also the property most likely to be destroyed by a well-meaning refactor. Moving the try/catch
outward, or letting an await escape it, turns one bad contract into a daemon that stops working
and gives no clear sign why.

Acceptance Criteria

  • A test runs a tick over several contracts where a middle one throws, and asserts every other
    contract was still maintained.
  • The failure is asserted to have been logged with the failing contract's ID.
  • A test covers the first contract failing and the last contract failing, since off-by-one
    handling differs at the ends.
  • The existing abort behaviour is not broken: a tick aborted mid-loop still stops immediately
    and logs contractsMaintained and contractsRemaining.
  • Verified by mutation: remove the try/catch, confirm the test fails.

Tech Stack

TypeScript 5.7 on Node 22+ (CI runs 22 and 24), ESM with moduleResolution: "NodeNext" — relative
imports need the .js extension. @stellar/stellar-sdk is pinned to an exact version; verify RPC
API shape against the installed copy, not against documentation. Tests are Vitest under test/ and
run without a network. npm run format:check, npm run lint, npm run build and npm test must
all be clean.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: keepersrc/keeper, the daemon and its decisionscomplexity: lowAn hour or two, no design decisionstype: testAdds or fixes coverage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions