---
type:
- TestCase
status: draft
name: Actor Objects must have properties inbox and outbox
description: |
  This rule checks whether a given Actor Object has the properties inbox and outbox.
uuid: acaacb5f-8f7e-4f28-8d81-c7955070a767
attributedTo:
- https://bengo.is

"@context":
- TestCase:
    "@id": http://www.w3.org/ns/earl#:TestCase
  type:
    "@type": "@id"

respec:
  config:
    format: markdown
    editors:
    - name: "Benjamin Goering"
      company: "bengo.is"
      companyURL: "https://bengo.is"
---

# Actor Objects Must Have Properties `inbox` and `outbox`

## Background

[ActivityPub][activitypub] says
> Actor objects MUST have... the following properties: inbox... outbox...

## About this Test

This is a Test Case describing a rule to determine whether an ActivityPub Object is in partial conformance with the following behaviors required by [ActivityPub][activitypub].

* Actor Objects must have inbox property [cc3f730a-37a9-4af9-948f-7c8a0b7f6c41](https://socialweb.coop/activitypub/behaviors/cc3f730a-37a9-4af9-948f-7c8a0b7f6c41/)
* Actor Objects must have outbox property [b8647b47-defb-483c-b468-8602d1124169](https://socialweb.coop/activitypub/behaviors/b8647b47-defb-483c-b468-8602d1124169/)

### Identifier

The identifier of this test is `acaacb5f-8f7e-4f28-8d81-c7955070a767`.

## Test Subject

The subject of this test is any data claiming to conform to the specification of an ActivityPub Actor Object.

This test is *not* directly applicable to an ActivityPub Server, nor is there any normative basis for deriving applicable Actor URIs from a given Server.
An ActivityPub Server serves 0 or more Actor Objects.
An ActivityPub Server for a big community might serve hundreds of ActivityPub Actor Objects.
An ActivityPub Server for a single human may serve only that person's ActivityPub Actor Object.
This test is *not* directly applicable to an ActivityPub Server, nor is there any normative basis for deriving applicable Actor URIs from a given Server.
An ActivityPub Server serves 0 or more Actor Objects.
An ActivityPub Server for a big community might serve hundreds of ActivityPub Actor Objects.
An ActivityPub Server for a single human may serve only that person's ActivityPub Actor Object.

This test applies to Actor *Objects*, but *not* all Actor Object are addressable by an HTTPS URL.
The URI that addresses an Actor Object is not the same as the Actor Object.
A given URL may resolve to different Actor Objects in different contexts, and a given Actor Object may not be universally addressable across context by any one URL.

## Inputs

This test requires the following [inputs](https://www.w3.org/TR/act-rules-format/#input):

* `actor` - the actor object that should be tested
    * type: bytes
        * will be interpreted as JSON

## Applicability

This test applies directly to the `actor` input.

If `actor` is not an Actor Object, outcome is `inapplicable`

* see assumption "How to Determine Whether Input is an Actor Object" below

If `actor` JSON does not have a `type` property, outcome is `inapplicable`.

### Test Targets

* `inbox` - the (expected) inbox property (or lack thereof) in the input `actor` JSON object
* `outbox` - the (expected) outbox property (or lack thereof) in the input `actor` JSON object

## Expectations

1. `actor` JSON has a property whose name is `inbox`.
    * If there is no `inbox` property, the outcome is `failed` for test target `inbox`

2. `actor` JSON has a property whose name is `outbox`
    * If there is no `outbox` property, the outcome is `failed` for test target `outbox`

## Assumptions

### 1. How to Determine Whether Input is an Actor Object

For the purposes of determining whether the input `actor` is in fact an actor object and whether this test is applicable to that input,
this test assumes that a valid way of determining whether the input is an Actor Object is:

* valid JSON
* has a `type` property
* `type` property value is either a string or array of strings
* one of those `type` value strings is one of `Application`, `Group`, `Organization`, `Person`, `Service`
    * rationale:
        * [ActivityPub 4.3 Actors](https://www.w3.org/TR/activitystreams-core/#actors):
      > The Activity Vocabulary provides the normative definition of five specific types of Actors: Application | Group | Organization | Person | Service.

[activitypub]: https://www.w3.org/TR/activitypub/

### 2. This Test Does Not Assert Conformance to any Requirements about the *value* of these properties

* [ ] bengo.is - read the text more and determine whether we should revisit this assumption or consider it final.

## Test Cases

These are test cases for this rule itself.

1. simple valid actor -> `passed`
    * inputs
      * `actor`

        ```json
          {
            "type": "Person",
            "inbox": "https://bengo.is/inbox",
            "outbox": "https://bengo.is/outbox"
          }
          ```

    * test targets
      * `inbox`: present
        * outcome: `passed`
      * `outbox`: present
        * outcome: `passed`

2. missing inbox -> `failed`
    * inputs
      * `actor`

        ```json
          {
            "type": "Person",
            "outbox": "https://bengo.is/outbox"
          }
          ```

    * test targets
      * `inbox`: not present
        * outcome: `failed`
      * `outbox`: present
        * outcome: `passed`

3. missing outbox -> `failed`
    * inputs
      * `actor`

        ```json
          {
            "type": "Person",
            "inbox": "https://bengo.is/inbox",
          }
          ```

    * test targets
      * `inbox`: present
        * outcome: `passed`
      * `outbox`: present
        * outcome: `failed`

4. no inbox nor outbox -> `failed`
    * inputs
      * `actor`

        ```json
          {
            "type": "Person"
          }
          ```

    * test targets
      * `inbox`: present
        * outcome: `failed`
      * `outbox`: present, value is `https://bengo.is/outbox`
        * outcome: `failed`

5. not valid json -> `inapplicable`
    * inputs
      * `actor`

        ```text
        abc
        ```

    * test targets
      * `inbox`: present
        * outcome: `inapplicable`
      * `outbox`: present, value is `https://bengo.is/outbox`
        * outcome: `inapplicable`

6. not an actor -> `inapplicable`
    * inputs
      * `actor`

          ```json
          {}
          ```

    * test targets
      * `inbox`: present
        * outcome: `inapplicable`
      * `outbox`: present, value is `https://bengo.is/outbox`
        * outcome: `inapplicable`

7. `actor`

    ```json
    {}
    ```

    * because it is not an Actor Object

8. `actor`

    ```json
    {
      "inbox": "https://bengo.is/inbox"
    }
    ```

    * because it is not an Actor Object. There is no `type` property indicating this is an Actor Object.

## Glossary

### `outcome`

An outcome is a conclusion that comes from evaluating a test on a test subject.
An outcome can be one of the three following types:

* `inapplicable`: No part of the test subject matches the applicability
* `passed`: A test target meets all expectations
* `failed`: A test target does not meet all expectations

## Requirements Mapping

* [ActivityPub requirement cc3f730a-37a9-4af9-948f-7c8a0b7f6c41](https://socialweb.coop/activitypub/behaviors/cc3f730a-37a9-4af9-948f-7c8a0b7f6c41/) - actor objects must have an inbox property
    * Required for Conformance to [ActivityPub][activitypub]
    * Outcome Mapping
        * when test target `inbox` has outcome `passed`, requirement is satisfied
        * when test target `inbox` has outcome `failed`, requirement is not satisfied
        * when test target `inbox` has outcome `inapplicable`, further testing is needed to determine requirement satisfaction

* [ActivityPub requirement b8647b47-defb-483c-b468-8602d1124169](https://socialweb.coop/activitypub/behaviors/b8647b47-defb-483c-b468-8602d1124169/) - actor objects must have an outbox property
    * Required for Conformance to [ActivityPub][activitypub]
    * Outcome Mapping for test target `outbox`
        * when test target `outbox` has outcome `passed`, requirement is satisfied
        * when test target `outbox` has outcome `failed`, requirement is not satisfied
        * when test target `outbox` has outcome inapplicable, further testing is needed to determine requirement satisfaction

## Change Log

* 2023-11-03T03:41:20.725Z - first draft

## Issues List

* Reconsider Assumption #2 and whether this test should also have expectations about the value of the e.g. `inbox` property based on the requirements that it tests
