Commit Graph
599 Commits
Author SHA1 Message Date
Johanna LarssonandTangled c56801bcf5 fix: ensure s3 blob uploads are streaming
The existing code buffered the whole thing into vec which defeated the purpose of `put_stream`.
2026-09-26 19:07:04 +00:00
Johanna LarssonandTangled 1475bdfe30 test(storage): use s3s to test S3BlobStorage
Introduces s3s and s3s-fs to run an in-memory s3 server in tests. With this we can promote s3 tests to run in `just test`, they won't need containers, and they're super fast. Adds `just test-s3` to run them more easily.

```
 Nextest run ID db9a9530-738e-4c92-ad3a-23289252cac2 with nextest profile: default                                                                                                              Starting 6 tests across 1 binary                                                                                                                                                                PASS [   0.356s] tranquil-storage::s3 put_stream_error_aborts_upload                                                                                                                        PASS [   0.356s] tranquil-storage::s3 put_stream_empty_aborts_upload                                                                                                                        PASS [   0.358s] tranquil-storage::s3 copy                                                                                                                                                  PASS [   0.360s] tranquil-storage::s3 put_get_head_delete                                                                                                                                   PASS [   0.360s] tranquil-storage::s3 put_stream                                                                                                                                            PASS [   0.447s] tranquil-storage::s3 put_stream_multipart                                                                                                                          ────────────                                                                                                                                                                                     Summary [   0.448s] 6 tests run: 6 passed, 0 skipped
```

Also optimizes more hashing functions because it matters in tests.
2026-09-26 19:07:04 +00:00
Johanna LarssonandTangled 5fd900ee1a build: switch governor to system time
We can make this test only by adding a feature for it and checking, but it didn't seem immediately worth it to me. Ping me if you want me to change it.

Shaves about 15-20% off of a j2 test run, because we spent about 200ms on every one of the 500 tests against the server just initializing the governor clock.
2026-09-25 16:42:41 +00:00
Johanna LarssonandTangled b758372457 ci: speed up test by running against /dev/shm 2026-09-25 15:45:00 +00:00
Johanna LarssonandTangled 845eee122d test: introduce test jail to hide lewis' sins
We've got a bunch of tests that never pass because they time out on their own, or that take 10s because they test a 10s timeout, that we can rethink. Together they introduce a lot of slowness.

This puts anything over 10s in CI into test jail.
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled 779733f6c9 test: lower bcrypt cost in tests
The default is 12 but we can go down to 4 to waste less time on this.
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled 3230740097 ci: split workflow into two and apply flags
Taking some flags from the knot2 build and splitting it in the hopes that that's enough time to finish
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled b5ad3a92cc build: set tikv-jemalloc-sys opt-level to 1
`gcc` uses fortify to do bounds checking or some other important thing and in CI it's failing because it's defaulting to -o0
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled e86d117418 style: format everything
Guess we haven't run cargo fmt over the whole thing ina  while!
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled 5714eb12f3 ci: Introduce a basic test+lint workflow
This removes the old workflows that had not been working for a while and introduces a new microvm based one that does some basic checks and runs the default test suite.
2026-09-25 13:16:17 +00:00
Johanna LarssonandTangled 4302611e45 build: use ring over aws-lc
All of the codebase uses ring explicitly or implicitly, but the HTTP client used for S3 requests was using aws-lc instead. This commit removes that extra dependency.

Anecdotally it shaves 10s off a dev build on my machine, but slower machines would benefit more from it.
2026-09-25 13:06:17 +00:00
Johanna LarssonandTangled 1210ef9c70 fix: verify comms enqueue by ID
Grabbing latest comms means you sometimes get the signup email instead of the one sent by the test.
2026-09-25 13:02:33 +00:00
Johanna LarssonandTangled 9768b47772 chore: skip fsync in more test suites
Many of these don't finish anyway on my computer, I gave up around 40 minutes. But for the ones that did, it's a big speed up! For the others I guess they need more love.

gauntlet-pr: 67.9s with it, 120.9s without

test-store: 508.8s with it, still running at 1313s (I gave up)

test-store-sim-nightly: ran for like 40 minutes each attempt without finishing. I just gave up.

test-store-asan: only linux? but no reason why we can't apply the fix here too
2026-09-25 09:53:13 +00:00
Johanna LarssonandTangled 4eb59e4f6c Creating a mega test binary
Overall `just test` runs about 10-20s faster on this branch than current main, for me, with around 170s instead of around 180-190s. But the cool thing is the compile time. Making a simple edit to any file involved and running `just test` on main takes about 60s to recompile the test binaries. On this branch it takes less than 15s.

This is done by replacing a ton of separate test binaries with a single megabinary.

Only test files that looked safe have been included, avoiding ones that do stuff like setting env.
2026-09-24 13:09:23 +00:00
Johanna LarssonandTangled 0c5eda6117 Drop rustls 0.21 copy
It's not being used anyway, so just wasted CPU cycles.
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 7978246c66 Remove redundant cargo test build and set SQLX_OFFLINE=true
The pg tests were missing SQLX_OFFLINE
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled ffc8ef4e01 Disable fsync for postgres too
Summary [ 166.110s] 1453 tests run: 1453 passed (1 slow), 15 skipped

Above is before this commit, below is after.

     Summary [ 140.410s] 1453 tests run: 1453 passed, 15 skipped

The mechanism here is the same as for the metastore tests. By skipping fsync we can run the tests much faster, and fsync doesn't matter in tests. Unless you're testing postgres itself I guess
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 7c0ca21de5 Remove sleeps from tests
Replace sleeps with the existing polling function instead. Exposes that the stress test isn't much of a stress test, it probably needs more data or something, but if it's heavy it should maybe not be part of `just test`
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 5214dd1c23 Remove forced serialization where not needed
Tests already run in isolation, so this is only relevant when messing with env vars and stuff, I think!
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 8a72d2c0e7 Stop talking to docker in tests that don't need docker
`just test` doesn't use docker, but the cleanup was still pruning containers over and over. This switches to only cleaning up containers created by the tests.
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 939b5a8cc4 Stop pg tests from duplicating tranquil-store tests 2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled e483fa139f Remove tests that require postgres from just test
These suites got added but actually need the postgres setup, and so can't succeed and are just annoying everyone.
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled e87952616d Avoid compiling and running tests twice
test-unit was building a second copy of the code with different features, and then the main test command ran the same tests anyway, so we just built and ran the tests twice

Locally shaves a minute off of a full build+test, on this branch (so both runs include the fsync change etc)

We're at [ 173.444s] overall for `just test` now
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 43dfd2f2f3 Stop compiling tranqil-store for just-test
Takes off ~140s CPU time for me, but no wall time improvement. Still, less work!
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 781be29d7b Speed up bcrypt and blowfish in tests
Build optimized versions of bcrypt and blowfish to speed them up, referencing things like https://github.com/oxidecomputer/omicron/blob/main/Cargo.toml#L981-L982

Password hashing is not a dominating cost, so this doesn't have a significant impact on the overall time, but a lot of tests like `**tranquil-pds::legacy_2fa** **test_legacy_2fa_code_consumed_after_use**` speed up. It goes from 5.6s to 2.7s on my machine.
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled 06b1255733 Skip fsync when running tests
Flushing to disk all the time ensures no partial states when writing to disk during awkwardnesses like crashes in prod risking real user data. That's good!

We're also doing it while running tests. Less good! Well, at least not important!

Comparing a clean test run (`just test --no-fail-fast`) and a run on this branch, on my MacOS M4 Pro, I get:

`**Summary** [ 517.723s] **1424** tests run: **1405** **passed** (**7** **slow**), **19** **failed**, **15** **skipped**`

before and

`**Summary** [ 326.369s] **1424** tests run: **1405** **passed**, **19** **failed**, **15** **skipped**`

after.

The reason I run `--no-fail-fast` is that a bunch of tests always fail and time out and stuff
2026-09-23 17:24:44 +00:00
Johanna LarssonandTangled eebce28926 fix: handle wildcard + aud in OAuth scopes
`rpc:*?aud=did:web:api.bsky.app#bsky_appview` fails in the permissions check even though it's a valid scope. This makes it resolve correctly.

Also this commit fixes a bug where `rpc` as a bare scope is interpreted as all methods for all services, but it's really an invalid scope. Can drop it if it's a problem, but it just looks like a bug in the implementation rather than something intended?

Note that the parser treats `rpc:*` as "allow everything for no services", but aud is actually required, so it's not a valid scope? Didn't mess with it though because delegation uses it and that part of the code treats it as allow everything for every service. We should maybe split the scope parsers so we have one for delegated scopes and one for regular?

However, to avoid the same bug as bare `rpc`, I changed the enforcement step in "regular" OAuth to disallow `rpc:*` (this matches the existing behavior on main, no actual change, just a little acknowledgement).
2026-09-23 15:42:29 +00:00
LewisandTangled b260ee10c7 tranquil-store: make it seem a little less 'experimental'
Lewis: May this revision serve well! <did:plc:3fwecdnvtcscjnrx2p4n7alz>
2026-09-23 14:54:51 +00:00
LewisandTangled 91114c491a comms: Comms ought to have better-typed channel recipients
Lewis: May this revision serve well! <did:plc:3fwecdnvtcscjnrx2p4n7alz>
2026-09-22 17:05:06 +00:00
juneandTangled 3d0376c476 feat(docs): alpine linux installation guide
meow meow no container, using the upstream package by yours truly :3
2026-09-22 14:25:40 +00:00
Louis EscherandTangled f1d963988e fix: actually pass the scope's aud with the service fragment 2026-09-22 13:19:21 +00:00
Johanna LarssonandTangled cc9ac301ca Little tweaks for multi-arch image building
Updates the default runner debian image sha to the multi-arch image instead of amd64-only. Also symlinks .containerignore -> .dockerignore since docker refuses to read .containerignore.

With that one can build and push multi-arch, like so:

```
docker buildx create --name tranquil-multiarch --driver docker-container --bootstrap

docker buildx build \
  --builder tranquil-multiarch \
  --platform linux/amd64,linux/arm64 \
  -t atcr.io/tranquil.farm/tranquil-pds:0.6.7 \
  --push \
  .

docker buildx imagetools create \
  -t atcr.io/tranquil.farm/tranquil-pds:latest \
  atcr.io/tranquil.farm/tranquil-pds:0.6.7
```

if one were so inclined, that is.
2026-09-21 14:41:54 +00:00
nelind 75c341b94b chore: bump version to 0.6.7 v0.6.7 2026-09-20 22:29:26 +02:00
nelind 0b29c40b27 docs: list jola.dev as a core team maintainer 2026-09-20 18:51:59 +02:00
Anastasia CalicoandTangled 34ece34296 feat: Implement s3_path in storage config. 2026-09-20 16:47:22 +00:00
Johanna LarssonandTangled 833356116a Set inputmode on inputs
This improves mobile behavior for the inputs without affecting other things.

Two inputs set to email, rest to URL pre recommendation in https://tangled.org/tranquil.farm/tranquil-pds/issues/140

Also disables autocapitalize, autocorrect, and spellcheck, while we're at it. All really annoying when typing in handles on a mobile phone.
2026-09-19 14:10:15 +00:00
Johanna LarssonandTangled 643e1bb902 Make ownership repair job report failures more loudly 2026-09-17 12:35:55 +00:00
Johanna LarssonandTangled 9f05ea5f31 Introduce job to repair missing blobs
My last PR introduced a migration to blobs, changing them from being unique per cid to being unique per cid+user. This is because two users can upload the same blob, get the same cid, and then previously in tranquil the second user would never actually get their ownership recorded, meaning listBlobs was missing the blob, and a migration _off_ of tranquil would leave them sans blob https://tangled.org/tranquil.farm/tranquil-pds/pulls/261/round/3

This PR attempts to add a job to repair existing instances where blobs have been deduplicated and not attributed to each owning user. It does this by pulling all records for each user, and then in batches crawling the records to find blob references. For each blob reference, it checks whether that user has its ownership recorded, and if not, repairs it by adding the entry.

To avoid re-running this potentially heavy job on every startup, I've used the config table to store a little record of whether it has been run.
2026-09-17 12:35:55 +00:00
TrezyandTangled 71cd282d1e feat: show repo actions narrowed out by client metadata on consent
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
TrezyandTangled 0e40bdca19 fix: store filtered scopes on tokens so refresh can skip the client metadata check
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
TrezyandTangled 156066fe1b fix: reject PAR requests missing the atproto scope
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
TrezyandTangled 311530a9a9 test: give the mock client a scope so NotRegistered actually gets exercised
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
TrezyandTangled 08cd3fa100 chore: remove unreachable scope format check in consent
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
TrezyandTangled 12a8712eae fix: unrecognized scopes can no longer fail PAR
Signed-off-by: Trezy <tre@trezy.com>
2026-09-16 16:20:17 +00:00
LunaandTangled cdd5fa70c9 fix: add MIME version to outgoing mail 2026-09-14 13:40:08 +00:00
xan.lolandTangled 218741050d add a period (spelling fix) 2026-09-13 22:47:12 +00:00
Johanna LarssonandTangled b3ff62c221 Simplify blob migration 2026-09-12 15:34:46 +00:00
Johanna LarssonandTangled 2088f59197 Stop deleting logo blob when switching
This also means we can clean up the last blob operations that were per cid rather than user+cid 🪓

We should be setting ourselves up to be able to go garbage collect blobs safely so deleting the logo blobs manually won't matter anyway.
2026-09-12 15:34:46 +00:00
Johanna LarssonandTangled 2fc5f2e308 Wrap in counter lock and stop deleting blobs by cid 2026-09-12 15:34:46 +00:00
Johanna LarssonandTangled 877b587481 Ensure listing missing blobs always checks per user blobs 2026-09-12 15:34:46 +00:00