# A digest in two workspaces

Constructed database example for [The Same Hash, Two Separate Reviews](https://www.invarlock.ai/blog/scope-local-artifact-identity-for-ml-review-systems), November 9, 2026.

This is a small schema experiment, not a test of InvarLock's platform, an HTTP service or customer data. No model runs or evaluation outcomes are involved.

## What was observed

PostgreSQL **18.6**, Linux ARM64. The pinned image is `postgres@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5`; selected image metadata is in `observed/image.json`. The input is the UTF-8 string `shared evidence example` followed by one LF newline. `observed/input-sha256.txt` retains its SHA-256 digest.

Both tables use row security with `USING (workspace = current_user)` and the same `WITH CHECK`. Setup runs administratively; the observed operations use `workspace_b`, which is neither a table owner nor a superuser and has no `BYPASSRLS` privilege. The tables are owned by the setup role. Roles A and B have only SELECT and INSERT privileges on these tables.

| Observed operation | Result |
| --- | --- |
| B reads either table after A registers the digest | Zero rows |
| B inserts its own row into the globally unique digest table | SQLSTATE 23505, unique violation |
| B inserts its own row into the workspace/digest table | Success; B sees exactly one row, its own |
| B repeats its own workspace/digest insertion | SQLSTATE 23505, unique violation |
| B inserts a different digest under workspace A | SQLSTATE 42501, insufficient privilege |
| Administrator inspects the workspace/digest table afterward | Two records, one distinct digest |

The script catches only the expected error classes and asserts the final state. The runner checks all listed observations. `observed/transcript.txt` retains the complete successful SQL session; `manifest.json` binds the inputs, runner and retained output bytes.

## Reproduce

Requirements: Docker, Bash, Python 3 and `shasum`. Download this directory, or clone the website repository and enter `public/evidence/scoped-identity`. Pull the pinned public image once:

```sh
docker pull postgres@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5
bash reproduce.sh reproduced
```

The runner uses only an already available image. The disposable container has no network, published host ports or host-directory mounts. Database files live on a 256 MiB memory filesystem. Cleanup removes the exact container created by the run on exit or interruption. Results remain in the requested output directory; the committed observed files are not overwritten by this command.

`example.sql` contains the complete schema and checks. The runner computes the synthetic digest independently; PostgreSQL recomputes it for the expected-duplicate cases. The first preparation attempt reached the image's temporary initialization server and stopped before executing SQL. The runner was corrected to wait for the final TCP listener. The failed transcript is retained in the site's dated publication review; it contains no database findings.

## Scope

This demonstrates one sequential database path. It does not establish complete tenant isolation, error-message behavior in an application, resistance to timing or concurrency attacks, or the safety of a storage or approval cache. A distinguishable duplicate response could reveal that matching content exists elsewhere; it does not reveal the other workspace's identity or decision. The article's review-history diagram is illustrative and is not implemented by these tables.

Primary references: [PostgreSQL row security](https://www.postgresql.org/docs/18/ddl-rowsecurity.html) and [constraints](https://www.postgresql.org/docs/18/ddl-constraints.html).
