Skip to content

get_authoring_meta stops at the first AuthoringMetaV1 map on failure and collapses all failure modes into None #201

Description

@thedavidmeister

Unit

crates/cli/src/meta/query/mod.rsDeployerResponse::get_authoring_meta (AMT group g3-graphql-query-processing, adversarial pass).

Intent oracle

Doc comment: "get authoring meta bytes of this deployer meta". The constructor meta bytes are a cbor sequence that can contain several documents; the loop shape (for meta_map in &meta_maps) says the whole sequence is meant to be searched for the AuthoringMetaV1 document.

Violated property

Two escapes cut the search short and erase the reason:

  1. On the FIRST map whose magic is AuthoringMetaV1, a validation/decode failure does return None instead of continuing the scan — a later valid AuthoringMetaV1 document in the same sequence is unreachable (mirror of the metas[0] issue in fetch_for_contract, fetch_for_contract only considers metas[0] and the first cbor document: a valid authoring meta later in the list is unreachable #157, but here the loop exists and is then short-circuited).
  2. All failure modes (corrupt cbor, unpack failure, abi decode failure, validation failure, simply no authoring-magic map) collapse into None; callers (Store::search_deployer, set_deployer_from_query_response) cache the deployer with authoring_meta: None, so "this deployer has no authoring meta" and "the authoring meta was malformed" become permanently indistinguishable in the cache.

Verified repro

On commit bba50a7, build meta_bytes as a cbor sequence of two documents: first an AuthoringMetaV1-magic map with an invalid payload, second a valid AuthoringMetaV1 document. get_authoring_meta returns None on the first map although a valid document follows; swapping the order returns Some.

Triage framing

Flagging for a maintainer decision: continue-on-failure (Err(_) => continue) would make the scan order-independent, and an error-carrying return type would let callers distinguish absence from corruption — but the current Option shape may be a deliberate best-effort contract. Not adjudicating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adversarialFound by adversarial review/mutation testingauditAudit finding; counted by the org health scan

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions