polls-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev c06cea4889e9
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 334801de44cb0fe911d5a88b
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
policy-tests/qa.json
{
  "version": "1",
  "name": "audience questions stored by the API (anonymous authorship), moderation and one upvote per person",
  "actors": {
    "Host": "host_user",
    "Ann": "ann_user",
    "Ben": "ben_user",
    "Eve": "eve_user",
    "Api": "api_principal"
  },
  "constants": {
    "BOUNDED_PUBLIC_PRINCIPAL_API": "api_principal"
  },
  "steps": [
    {
      "op": "setTime",
      "epoch": 1800000000
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "setMany",
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa",
          "data": {
            "title": "Talk",
            "code": "654321",
            "current": "qa",
            "qa": true,
            "moderate": false,
            "allowChange": true,
            "createdBy": "$Host",
            "createdAt": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/joins/host_user",
          "data": {
            "at": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/owners/host_user",
          "data": {
            "at": 1800000000
          }
        },
        {
          "path": "eventkeys/evaaaaaaaaaaaaaaaaaa",
          "data": {
            "key": "kkkkkkkkkkkkkkkkkkkkkkkk"
          }
        },
        {
          "path": "codes/654321",
          "data": {
            "event": "evaaaaaaaaaaaaaaaaaa",
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ann_user/q/q1",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/ann_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Why?",
        "name": "",
        "status": "live",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "text": "Why?",
            "name": "",
            "status": "live",
            "upvotes": 0,
            "createdAt": 1800000000
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ann_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ben_user/q/q1",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ann_user/q/q1",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "as",
      "who": "Api"
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Why is the sky blue?",
        "name": "Ann",
        "status": "live",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/api_principal",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Why?",
        "name": "",
        "status": "live",
        "upvotes": 50,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Why?",
        "name": "",
        "status": "pending",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "",
        "name": "",
        "status": "live",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Why is the sky blue?",
        "name": "Ann",
        "status": "live",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "status": "hidden"
      }
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "status": "answered"
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "text": "Edited"
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/ben_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "upvotes": 1
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ben_user/q/q1",
      "data": {
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": 2
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ben_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": 1
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ann_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "setMany",
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": {
              "operation": "increment",
              "value": 1
            }
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ben_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "expect",
      "expr": "get(/events/evaaaaaaaaaaaaaaaaaa/questions/q1).upvotes == 1"
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": {
              "operation": "increment",
              "value": 1
            }
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ben_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ben_user/q/q1",
      "data": {
        "at": 1800000001
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Ann"
    },
    {
      "op": "setMany",
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": 2
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/ann_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "expect",
      "expr": "get(/events/evaaaaaaaaaaaaaaaaaa/questions/q1).upvotes == 2"
    },
    {
      "op": "as",
      "who": "Eve"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/joins/eve_user",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/eve_user/q/q1",
      "data": {
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ann_user/q/q1",
      "data": {
        "at": 1800000000
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "status": "hidden"
      },
      "shouldFail": true
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": 3,
            "status": "answered"
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/eve_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "delete",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "upvotes": 100
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "status": "done"
      },
      "shouldFail": true
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
      "data": {
        "status": "answered"
      }
    },
    {
      "op": "as",
      "who": "Eve"
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q1",
          "data": {
            "upvotes": 3
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/eve_user/q/q1",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa",
      "data": {
        "moderate": true
      }
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/asked/ben_user/q/q2",
      "data": {
        "at": 1800000000
      }
    },
    {
      "op": "as",
      "who": "Api"
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q2",
      "data": {
        "text": "Unmoderated?",
        "name": "",
        "status": "live",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q2",
      "data": {
        "text": "Waiting for approval",
        "name": "",
        "status": "pending",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    },
    {
      "op": "as",
      "who": "Ben"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q2",
      "data": {
        "status": "live"
      },
      "shouldFail": true
    },
    {
      "op": "as",
      "who": "Eve"
    },
    {
      "op": "setMany",
      "shouldFail": true,
      "writes": [
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q2",
          "data": {
            "upvotes": 1
          }
        },
        {
          "path": "events/evaaaaaaaaaaaaaaaaaa/upvotes/eve_user/q/q2",
          "data": {
            "at": 1800000000
          }
        }
      ]
    },
    {
      "op": "as",
      "who": "Host"
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q2",
      "data": {
        "status": "live"
      }
    },
    {
      "op": "set",
      "path": "events/evaaaaaaaaaaaaaaaaaa",
      "data": {
        "qa": false
      }
    },
    {
      "op": "as",
      "who": "Api"
    },
    {
      "op": "set",
      "shouldFail": true,
      "path": "events/evaaaaaaaaaaaaaaaaaa/questions/q3",
      "data": {
        "text": "Q&A is off",
        "name": "",
        "status": "pending",
        "upvotes": 0,
        "createdAt": 1800000000
      }
    }
  ]
}

Change history

Point OpenApps links to openapps.free
c06cea4889 · 17 hours ago
Bind agent address in policy constants
a7de116d52 · 19 hours ago
Use OpenApps service URLs and add contribution strip
e8ce0b0bf0 · 19 hours ago
Bounded source sync
dcdc4d56e6 · 1 day ago
Bounded source sync
7acdace1e1 · 1 day ago
Bounded source sync
2140a66ea0 · 1 day ago
Bounded source sync
0db2fe3ca0 · 1 day ago
Bounded source sync
996f633a3c · 1 day ago