Skip to content

test(maintainable): cover extend_all when a declared persistent key has no entry #3

Description

@0dillon

Summary

The macro extends every key in its inlined list without checking that the entry exists. A contract
can legitimately declare a key it has not written yet — long_escrow declares DataKey::Balance
before any deposit. Nothing in the suite pins down what happens on that path, so a future change to
the generated code could turn it into a panic without any test noticing.

Find out what the host actually does for extend_ttl on a missing key, then write the test that
records it.

Acceptance Criteria

  • A test in crates/maintainable/src/test.rs calls extend_all on a contract with a declared
    persistent key that was never written.
  • The test asserts the observed behaviour rather than assuming it — either the call succeeds and
    the key is skipped, or it returns a specific error.
  • The returned count is asserted, so a change in what counts as "extended" fails the test.
  • The macro's rustdoc states the behaviour the test pins down.

Tech Stack

Rust (edition 2021, toolchain 1.93.0 pinned in rust-toolchain.toml), soroban-sdk 27.0.4,
target wasm32v1-none. Build with stellar contract build, never cargo build. Tests are
#[cfg(test)] modules on Env::default(); run them with cargo test --all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions