pet.trezy.getDiagnostics

trezy.pet

Documentation

Everything the server knows about the CALLER's own game state. Read-only; writes nothing. Takes no input at all, and that is the security model: with no `did` parameter there is no way to ask about anybody else, so cross-account access is impossible by construction rather than gated by a check that could later be loosened. A PROCEDURE rather than a query for one concrete reason: HappyView enforces authentication on procedures at the transport, so an unauthenticated call gets a 401 and this script never runs, and `caller_did` is therefore guaranteed to be set. A query would receive `caller_did` too — it is `string?` in the query globals — but a Lua script cannot set its own HTTP status (src/error.rs:143 maps every raise to 500), so a query could only answer an anonymous caller with a 200 carrying an error, or a 500. The 401 has to come from the transport. It exists because diagnosing a stuck pet took an admin log, four greps and a chain of inference off two public endpoints. The ledger, the grant and the index are the three things that disagree in practice, and none of them was observable. This reports what each says and lets the reader compare, rather than deciding who is right.

main procedure

Everything the server knows about the CALLER's own game state. Read-only; writes nothing. Takes no input at all, and that is the security model: with no `did` parameter there is no way to ask about anybody else, so cross-account access is impossible by construction rather than gated by a check that could later be loosened. A PROCEDURE rather than a query for one concrete reason: HappyView enforces authentication on procedures at the transport, so an unauthenticated call gets a 401 and this script never runs, and `caller_did` is therefore guaranteed to be set. A query would receive `caller_did` too — it is `string?` in the query globals — but a Lua script cannot set its own HTTP status (src/error.rs:143 maps every raise to 500), so a query could only answer an anonymous caller with a 200 carrying an error, or a 500. The 401 has to come from the transport. It exists because diagnosing a stuck pet took an admin log, four greps and a chain of inference off two public endpoints. The ledger, the grant and the index are the three things that disagree in practice, and none of them was observable. This reports what each says and lets the reader compare, rather than deciding who is right.

Output

Encodingapplication/json
config ref#config Optional

The caps as this instance actually reads them, not as the record on disk says.

did string Optional

The caller, echoed back. Always the authenticated DID — there is no way to ask about another account.

error string Optional

Reserved. Every failure this script can have is per-store and reported through `unreadable` instead, because a diagnostic that answers nothing is less useful than one that answers what it could reach and names what it could not.

Known values: unreadable
grant ref#grant Optional

The starter grant row, absent when the player never had one.

message string Optional

No description available.

money ref#money Optional

No description available.

pets array Optional

Every row in the pet ledger for this player, retired ones included, each paired with whether the index has the matching record. A row with indexed=false is the state that made a pet invisible and unrecoverable on 2026-07-30.

rejections array Optional

Rejection rows by reason. A stale row here is what put a false accusation in front of a player once, so seeing them matters.

unreadable array Optional

Which stores could not be read on this call, by name: pet-ledger, pet-index, grants, wallet-record, highwater, rejections, game-config. NOT cosmetic — every absent value elsewhere in this answer is ambiguous until you have read this. An unreadable pet-index would otherwise make every pet look un-indexed, which is the exact wrong conclusion to hand somebody debugging a missing pet.

wallet ref#wallet Optional

No description available.

Try It

Requests are sent directly from your browser. Some servers may block requests due to CORS.

Base URL for XRPC calls (e.g., https://bsky.social)
View raw schema
{
  "type": "procedure",
  "output": {
    "schema": {
      "type": "object",
      "required": [],
      "properties": {
        "did": {
          "type": "string",
          "description": "The caller, echoed back. Always the authenticated DID — there is no way to ask about another account."
        },
        "pets": {
          "type": "array",
          "items": {
            "ref": "#pet",
            "type": "ref"
          },
          "description": "Every row in the pet ledger for this player, retired ones included, each paired with whether the index has the matching record. A row with indexed=false is the state that made a pet invisible and unrecoverable on 2026-07-30."
        },
        "error": {
          "type": "string",
          "description": "Reserved. Every failure this script can have is per-store and reported through `unreadable` instead, because a diagnostic that answers nothing is less useful than one that answers what it could reach and names what it could not.",
          "knownValues": [
            "unreadable"
          ]
        },
        "grant": {
          "ref": "#grant",
          "type": "ref",
          "description": "The starter grant row, absent when the player never had one."
        },
        "money": {
          "ref": "#money",
          "type": "ref"
        },
        "config": {
          "ref": "#config",
          "type": "ref",
          "description": "The caps as this instance actually reads them, not as the record on disk says."
        },
        "wallet": {
          "ref": "#wallet",
          "type": "ref"
        },
        "message": {
          "type": "string"
        },
        "rejections": {
          "type": "array",
          "items": {
            "ref": "#reasonCount",
            "type": "ref"
          },
          "description": "Rejection rows by reason. A stale row here is what put a false accusation in front of a player once, so seeing them matters."
        },
        "unreadable": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Which stores could not be read on this call, by name: pet-ledger, pet-index, grants, wallet-record, highwater, rejections, game-config. NOT cosmetic — every absent value elsewhere in this answer is ambiguous until you have read this. An unreadable pet-index would otherwise make every pet look un-indexed, which is the exact wrong conclusion to hand somebody debugging a missing pet."
        }
      }
    },
    "encoding": "application/json"
  },
  "description": "Everything the server knows about the CALLER's own game state. Read-only; writes nothing.\n\nTakes no input at all, and that is the security model: with no `did` parameter there is no way to ask about anybody else, so cross-account access is impossible by construction rather than gated by a check that could later be loosened.\n\nA PROCEDURE rather than a query for one concrete reason: HappyView enforces authentication on procedures at the transport, so an unauthenticated call gets a 401 and this script never runs, and `caller_did` is therefore guaranteed to be set. A query would receive `caller_did` too — it is `string?` in the query globals — but a Lua script cannot set its own HTTP status (src/error.rs:143 maps every raise to 500), so a query could only answer an anonymous caller with a 200 carrying an error, or a 500. The 401 has to come from the transport.\n\nIt exists because diagnosing a stuck pet took an admin log, four greps and a chain of inference off two public endpoints. The ledger, the grant and the index are the three things that disagree in practice, and none of them was observable. This reports what each says and lets the reader compare, rather than deciding who is right."
}
config object

No description available.

Properties

activePetCap integer Optional

No description available.

stageMoneyCap integer Optional

No description available.

starterGrantCap integer Optional

No description available.

View raw schema
{
  "type": "object",
  "required": [],
  "properties": {
    "activePetCap": {
      "type": "integer"
    },
    "stageMoneyCap": {
      "type": "integer"
    },
    "starterGrantCap": {
      "type": "integer"
    }
  }
}
grant object

No description available.

Properties

amount integer Required

No description available.

grantedAt string Optional

No description available.

View raw schema
{
  "type": "object",
  "required": [
    "amount"
  ],
  "properties": {
    "amount": {
      "type": "integer"
    },
    "grantedAt": {
      "type": "string"
    }
  }
}
money object

The balance decomposed, so an unexpected number can be attributed instead of guessed at. balance = collected + granted - spent, and every term is reported because two of them being wrong in opposite directions looks exactly like both being right.

Properties

balance integer Optional

No description available.

collected integer Optional

No description available.

granted integer Optional

No description available.

spent integer Optional

No description available.

View raw schema
{
  "type": "object",
  "required": [],
  "properties": {
    "spent": {
      "type": "integer"
    },
    "balance": {
      "type": "integer"
    },
    "granted": {
      "type": "integer"
    },
    "collected": {
      "type": "integer"
    }
  },
  "description": "The balance decomposed, so an unexpected number can be attributed instead of guessed at. balance = collected + granted - spent, and every term is reported because two of them being wrong in opposite directions looks exactly like both being right."
}
pet object

No description available.

Properties

active boolean Optional

No description available.

createdAt string Optional

No description available.

indexed boolean Optional

Whether happyview_records holds the record this ledger row claims. False means the game cannot see a pet it believes the player owns. ABSENT means the index could not be read, which is not the same as false — check `unreadable` before concluding anything from its absence.

name string Optional

No description available.

price integer Optional

No description available.

retired boolean Optional

No description available.

species string Optional

No description available.

uri string at-uri Required

An AT Protocol URI (e.g., at://did:plc:xyz/app.bsky.feed.post/abc).

View raw schema
{
  "type": "object",
  "required": [
    "uri"
  ],
  "properties": {
    "uri": {
      "type": "string",
      "format": "at-uri"
    },
    "name": {
      "type": "string"
    },
    "price": {
      "type": "integer"
    },
    "active": {
      "type": "boolean"
    },
    "indexed": {
      "type": "boolean",
      "description": "Whether happyview_records holds the record this ledger row claims. False means the game cannot see a pet it believes the player owns. ABSENT means the index could not be read, which is not the same as false — check `unreadable` before concluding anything from its absence."
    },
    "retired": {
      "type": "boolean"
    },
    "species": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    }
  }
}
reasonCount object

No description available.

Properties

count integer Required

No description available.

reason string Required

No description available.

View raw schema
{
  "type": "object",
  "required": [
    "reason",
    "count"
  ],
  "properties": {
    "count": {
      "type": "integer"
    },
    "reason": {
      "type": "string"
    }
  }
}
wallet object

No description available.

Properties

highwaterCollected integer Optional

The high-water total, which is what a repair rebuilds from.

highwaterLastUpdated string Optional

No description available.

recordCollected integer Optional

The collected total the indexed wallet record carries, when there is one.

recordIndexed boolean Required

Whether the player's pet.trezy.wallet record is in the index.

recordLastUpdated string Optional

No description available.

View raw schema
{
  "type": "object",
  "required": [
    "recordIndexed"
  ],
  "properties": {
    "recordIndexed": {
      "type": "boolean",
      "description": "Whether the player's pet.trezy.wallet record is in the index."
    },
    "recordCollected": {
      "type": "integer",
      "description": "The collected total the indexed wallet record carries, when there is one."
    },
    "recordLastUpdated": {
      "type": "string"
    },
    "highwaterCollected": {
      "type": "integer",
      "description": "The high-water total, which is what a repair rebuilds from."
    },
    "highwaterLastUpdated": {
      "type": "string"
    }
  }
}

Lexicon Garden

@