426 Commits

Author SHA1 Message Date
Eric Bailey
9e2b14765a add query and test to pds 2023-08-08 12:14:40 -05:00
Daniel Holmgren
556e438ccc
Filter out blocked posts on getPosts (#1442)
filter out blocked posts on getPosts
2023-08-07 18:52:10 -05:00
devin ivy
b5569121f8
Misc perf improvements on actor search, post deletion, actor invite codes (#1436)
* tighten fuzzy actor search for larger dataset

* add indexes to support post deletion on feed_item, listing user invites on invite_code

* fix migration whitespace

* temp comment migrations and build

* Revert "temp comment migrations and build"

This reverts commit 225d2c00cce1885f2d2cffc4724843eda4b01cee.
2023-08-07 19:38:04 -04:00
devin ivy
6321e7839f
Include pds account info on mod report and action details (#1441)
hydrate pds repo state onto mod report and action subject details
2023-08-07 17:20:26 -04:00
devin ivy
3f3ae4cfd5
Support proxying moderation through to appview (#1233)
* in-progress work on proxying moderation to appview

* tidy

* proxy reports pds to appview, misc tidy

* test proxying of moderation endpoints

* remove report action fkeys from pds for appview sync

* test appview/pds moderation synchronization

* tidy

* tidy

* fix admin proxy tests, build

* temp disable migration

* rm relative @atproto/api imports

* fix a couple more relative imports

* tidy

* reenable migration, comment contents temporarily

* fully enable migration, remove build, misc test fixes

---------

Co-authored-by: dholms <dtholmgren@gmail.com>
2023-08-04 16:06:04 -04:00
Daniel Holmgren
6d04bf76ef
Hive retry logic & logging (#1434)
* better logging & retry logic for hive

* tidy

* fix test

* bump timeout

* tidy pds labeler

* fix test

* build branch

* fix types

* fix types

* rm branch builds

* log hive response

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-08-03 17:42:05 -05:00
devin ivy
e5e24d510e
Push labels to PDS (#1423)
* add lexicon for unspecced applyLabels procedure

* implement label push to pds via unspecced.applyLabels

* add hive retry to bsky appview

* build

* update applyLabels to work with raw label data

* update bsky hive labeler

* remove build
2023-08-03 12:25:56 -04:00
Daniel Holmgren
450dff7fa3
Fix blocks in follow views (#1427)
* fix blocks in follow views

* check blocks between follow subjects & creators

* test
2023-08-03 10:43:30 -05:00
Foysal Ahamed
13b16b33f2
Allow setting a note when enabling/disabling invite codes (#1363)
* Allow setting a note when enabling/disabling invite codes

* Add inviteNote to repoView

*  Add test for inviteNote

*  Set to null when note is empty

*  Change note from text to varchar

* 📝 Better description
2023-08-01 17:43:21 -05:00
devin ivy
30b41029c1
Partitioning in bsky indexer (#1368)
* setup redis infra for appview indexer

* barebones bsky ingester

* add ioredis to bsky

* remove some indexer functionality from bsky api

* setup for bsky indexer

* tidy

* tidy, observe basic pipeline functioning

* process messages on bsky indexer pipeline, tidy tests and lifecycle

* trim partitions when moving cursor

* simplify config for partitions

* misc fixes for redis setup in bsky tests, add namespacing

* fix pds proxy tests

* remove cursor state from indexer partitions, simplify ingester state

* tidy

* utils for testing w/ multiple indexers, fix off-by-one xtrim

* test reingesting

* test indexer repartitioning

* add entrypoints for bsky ingester and indexer, fix db schema config, api entrypoint name, tidy

* setup and test bsky ingester backpressure, add config

* tidy

* add missing test file

* tidy redis calls, add redis sentinel config

* tidy/test some utils used in bsky pipeline

* tidy bsky pipeline tests, move helpers into dev-env

* fix pds crud test

* support redis host and password config

* better loggin/observability in ingester and indexer, make build

* add bsky ingester initial cursor config

* temporarily remove migrations from indexer/ingester

* allow ingester to batch

* packages/pg becomes packages/dev-infra with some cleanup (#1402)

* packages/dev-infra/

* Extract packages/dev-infra/_common.sh and use it

* Use period instead of source because of /bin/sh

* add docs for redis test script

* fix repartition test

* add logs to debug ci

* simplify repartitioning test, remove ci logs

---------

Co-authored-by: Jerry Chen <jerry@redelm.net>
2023-08-01 14:59:00 -04:00
Daniel Holmgren
7ef73467eb
Remove local whats hot from pds (#1393)
* put behind proxy header

* toggle for everyone

* tidy

* tidy

* fix
2023-07-27 19:05:12 -05:00
Patrick Linnane
acd5185984
Fix various typos (#1373) 2023-07-25 22:43:05 -05:00
Daniel Holmgren
a2655a4001
Move rkey check to prepareCreate (#1385)
* move rkey check to prepareCreate

* allow updates on applyWrites

* gen rkey in prepareCreate

* fix up tests
2023-07-25 22:41:10 -05:00
devin ivy
353ff19f99
Apply block rules for third parties on replies and embeds (#1378)
* apply block rules for third parties on replies and embeds

* tidy terminology around blocking and actor relationships

* apply third-party blocking functionality to appview

* tidy, bsky tests
2023-07-24 16:35:04 -04:00
Foysal Ahamed
4619e2b24a
Disable signing up with invite code from takendown account (#1350) 2023-07-21 12:50:41 -04:00
devin ivy
8457800a3e
Include takendown posts for admins (feature branch) (#1361)
* 🚧 WIP including takendown posts on author feed

*  Add takedown id on posts when including taken down posts

* 🧹 Cleanup the auth verifier and other bsky package code

*  Add test for admin getAuthorFeed

* 🧹 Cleanup lexicon and exclude takedownId

* more explicit plumbing for post hydration w/o requester or with takedown info

* pass along flag for soft-deleted actors

* cleanup getAuthorFeed w/ auth

* reorg getAuthorFeed logic around role/access-based auth

---------

Co-authored-by: Foysal Ahamed <cfaion341@gmail.com>
2023-07-21 12:47:03 -04:00
Eric Bailey
b2ef3865bc
Merge pull request #1365 from bluesky-social/eric/search-getPopularFeedGenerators
add optional `ILIKE` query to `getPopularFeedGenerators`
2023-07-20 11:00:51 -05:00
Daniel Holmgren
2836ee38bb
Appview - serve feed skeletons (#1265)
* proxy timeline skeleton construction to appview

* add getFeedSkeleton to appview

* mount route

* smart proxy feed skeletons

* tests

* proper error code

* only proxy specific feeds

* build branch

* update proxyable feed logic, should use feed publisher rather than generator

* fix feed proxy tests, configure feed publisher (in addition to generator)

* hotfix: prevent user-supplied rkey on posts with createRecord (#1313)

* prevent user-supplied rkey on posts with createRecord

* allow empty-string rkey parameter

Co-authored-by: devin ivy <devinivy@gmail.com>

---------

Co-authored-by: devin ivy <devinivy@gmail.com>

* add slurs to reserved words (#1318)

* add slurs to reserved words (#1314)

* Update reserved.ts

Add slurs to reserved words

* Update reserved.ts

fix typo

* Update reserved.ts to clean up the slur list

* linting

* pluralise

---------

Co-authored-by: jess <jesslarkdev+gh@gmail.com>

* identifier: tweaks and additions to slur list (#1319)

* Refactor appview repo subscription for memleak (#1308)

* refactor to remove closure in loop

* move consecutive item out of p-queue

* Handle validation improvements (#1336)

* Handle matches and false positives for unacceptable words in handles

* move handle validation logic to pds

* missed merge

* add cfg flag

* encode lists

* fix build issues

* move words to cfg

* tidy

---------

Co-authored-by: Jaz Volpert <ericvolp12@gmail.com>

* Allow moderators to take and reverse actor takedowns (#1330)

allow moderators to take and reverse actor takedowns

*  Allow searching reports by moderator did (#1283)

*  Allow searching reports by moderator did

*  Remove .only flags on tests

*  Update snapshot

*  Add checks for did match in actions

* v0.4.1

* Make sequencer leader behavior optional on pds (#1250)

* make sequencer leader behavior optional on pds

* tidy

* use 127.0.0.1 in with-test-db.sh for colima (#1297)

So, since Docker Desktop has licensing issues, some folks use colima for
running containers on their macOS machines (The licensing exempted
CLI-only version of Docker only exists on Linux).

Unfortunately, colima binds host ports only on the IPv4 localhost
address (`127.0.0.1`) while the atproto postgres clients will attempt to
connect to the IPv6 localhost address (`::1`) that macOS sets in
/etc/hosts.  See https://github.com/abiosoft/colima/issues/583 and
https://github.com/lima-vm/lima/issues/1330 for the tickets against
colima. (Docker Desktop binds to both IPv4 and IPv6 localhost addresses
and so doesn't have this issue.)

To workaround this silly issue, we can use `localhost` within the docker
containers and docker-compose, but need to set the `DB_POSTGRES_URL` env
var to use the IPv4 localhost explicitly.

(Asking folks to edit /etc/hosts causes other tools to break and will be
overridden on each OS upgrade.)

* Subscription util tests (#1295)

* consecutive list tests

* flesh out subscription util tests

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>

* Content reporting on record fields (#1351)

* content reporting on record fields

* fix test

* tests

* tidy

* Check rkey contents just for non-tids (#1353)

check rkey content for non-tids

*  Added new procedure for sending admin email (#1312)

* 🚧 Added new lexicon for sending admin email

*  Add moderation mailer

*  Switch to text email content from html

* 🧹 Cleanup some early implementation code and reflect PR reivew

*  Use smtp host instead of gmail service config

*  Move to using single smtp url

* v0.4.2

* Patch up a couple sqlite tests (#1355)

patch up a couple sqlite tests

* enable feeds & build branch

* disable branch building & enable without proxy header

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
Co-authored-by: David Buchanan <d@vidbuchanan.co.uk>
Co-authored-by: jess <jesslarkdev+gh@gmail.com>
Co-authored-by: bnewbold <bnewbold@robocracy.org>
Co-authored-by: Jaz Volpert <ericvolp12@gmail.com>
Co-authored-by: Foysal Ahamed <cfaion341@gmail.com>
Co-authored-by: Jeff Hodges <jeff@somethingsimilar.com>
2023-07-19 17:38:43 -05:00
Eric Bailey
77274b31a0 fix lint 2023-07-19 17:37:06 -05:00
Eric Bailey
64137c7e5c add optional ilike query to getPopularFeedGenerators 2023-07-19 17:25:49 -05:00
Daniel Holmgren
bb607ccc55
Patch up a couple sqlite tests (#1355)
patch up a couple sqlite tests
2023-07-18 13:17:20 -05:00
Daniel Holmgren
c9acdd39a2
Content reporting on record fields (#1351)
* content reporting on record fields

* fix test

* tests

* tidy
2023-07-17 16:39:01 -05:00
Foysal Ahamed
b9ca76f012
Allow searching reports by moderator did (#1283)
*  Allow searching reports by moderator did

*  Remove .only flags on tests

*  Update snapshot

*  Add checks for did match in actions
2023-07-14 16:05:56 -07:00
devin ivy
53c4956146
Allow moderators to take and reverse actor takedowns (#1330)
allow moderators to take and reverse actor takedowns
2023-07-14 14:37:32 -07:00
Daniel Holmgren
6b51ecbbb2
Handle validation improvements (#1336)
* Handle matches and false positives for unacceptable words in handles

* move handle validation logic to pds

* missed merge

* add cfg flag

* encode lists

* fix build issues

* move words to cfg

* tidy

---------

Co-authored-by: Jaz Volpert <ericvolp12@gmail.com>
2023-07-13 22:29:01 -05:00
Ansh
08dc2b725d
Pagination on getPopularFeedGenerators (#1293)
* add temporary page-based pagination

* use cursor & limit for pagination

* tests

* add to appview

---------

Co-authored-by: dholms <dtholmgren@gmail.com>
2023-07-07 13:49:02 -05:00
devin ivy
3ea892bc57
Add administrative triage role, update moderator role (#1216)
* setup triage user on pds, update moderator username (invalidates old token)

* initial pass on triage access on pds, limit access to email addrs

* apply moderator vs triage rules on taking and reversing mod actions for pds

* update pds tests for triage auth role

* setup moderator and triage roles on bsky appview

* apply mod and triage access rules to bsky admin endpoints

* reframe admin auth as role-based auth, tidy auth apis

* tidy

* build

* revert change to basic auth username for role-based auth
2023-07-06 15:18:52 -04:00
Daniel Holmgren
60e8284b15
Fix flaky db test (#1287)
fix flaky db test
2023-07-06 09:57:41 -04:00
Daniel Holmgren
4d1f8d3289
Misc scaling (#1284)
* limit backsearch to 1 day instead of 3

* lower like count threshold

* bump to 6

* disable like count check

* disable with friends

* preemptively cache last commit

* inline list mutes

* actor service

* label cache

* placehodler on popular with friends

* bulk sequence

* no limit but chunk

* bump chunk to 5k

* try 10k

* fix notify

* tweaking

* syntax

* one more fix

* increase backfill allowance

* full refresh label cache

* limit 1 on mute list

* reserve aclu handle

* clean up testing with label cache

* note on with-friends

* rm defer from label cache

* label cache error handling

* rm branch build
2023-07-05 16:41:08 -05:00
Foysal Ahamed
03200c1d8b
🐛 Only ignore reports for specific at-uri when ignoreSubject contains at-uri (#1251) 2023-07-03 15:21:16 -04:00
Daniel Holmgren
c793ff9103
Add boolean for enabling generic appview proxying (#1273)
* add boolean config for enabling generic proxying

* tweak

* tweak cfg var name

* tweak
2023-07-03 14:14:49 -05:00
Daniel Holmgren
e7a0d27f1f
Proxy timeline skeleton construction (#1264)
proxy timeline skeleton construction to appview
2023-07-03 11:28:39 -05:00
Daniel Holmgren
4db7aeca57
Rework record embeds (#1262)
* wip

wip

wip

fix tests

tidy

* small fix

* fix flaky proxy test
2023-07-02 20:37:27 -05:00
Daniel Holmgren
e5dc790eda
Ensure not to serve repo endpoints for taken-down actor (#1263)
ensure not to serve repo endpoints for taken-down actor

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-07-02 20:22:35 -05:00
Daniel Holmgren
ee68a4037b
Appview - Invalid handles (#1244)
* run with-test-db in monorepo test

* improve pg script

* tidy

* namespace bsky pg schemas

* differentiate schemas

* clean up script

* first pass at invalid handles in appview

* tests for handle invalidation

* move mock to instance instead of prototype

* change network mocks in general

* fixing pagination on actor-search

* fix snap & normalize handles on index

* handling did pagination + update tests

* one last update
2023-06-30 16:02:47 -05:00
Daniel Holmgren
7cb8c62b54
Repo update advisory lock (#1230)
* use for no key update

* use a tx advisory lock for repo updates

* skip tests for sqlite

* move check of commit swap on rebase

* do lock before formatting rebase

* hash schema in for lock id

* no tx lock in sqlite

* move rebase formatting to tx

* move dialect check

* rm log

* make the lock ids a bit safer

* change how we do lock id

* refactor id generator
2023-06-29 13:42:10 -05:00
Daniel Holmgren
9263ddc64d
Add compression in http res (#1022)
* add compression

* compress carfiles

* update package version

* add tests

* one more test

* remove compressible dep

* add gzip to appview

* fix package.json
2023-06-29 10:24:48 -05:00
Daniel Holmgren
ba870d3dbe
Run test DB for full monorepo tests (#1225)
* run with-test-db in monorepo test

* improve pg script

* tidy

* namespace bsky pg schemas

* differentiate schemas

* clean up script

* tweaking script
2023-06-28 15:12:37 -05:00
Jess Porter
d9ac72e647
firehose tombstones (#1017)
* firehose tombstones

* return tombstones from sequencer requestSeqRange

* firehose tombstone test

* oops semicolons :3

* yes this can be const

* fix verifyTombstoneEvent func signature

* invalidate all sequence events upon tombstone

* don't manually purge all seqs, test for tombstone after delete

* actually fully delete account

* fix linting

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-06-26 18:48:00 -05:00
Daniel Holmgren
2e94c43010
Cleanup @atproto/crypto (#1218)
* remove webcrypto, upgrade @noble/curves, normalize p256 interface

* cleanup

* Test vectors for secp and p256 signature verification (#737)

Add test vectors for secp and p256 signature verification

* fix up test vectors

* add explicit test vectors for high-s signatures

* tidy json to pass verify check

---------

Co-authored-by: devin ivy <devinivy@gmail.com>
2023-06-26 18:47:28 -05:00
Daniel Holmgren
0ee6dc45a5
Improve invite code counting (#1234)
* dont count admin codes for routine codes

* better tests for invites

* variable naming

* change approach

* update comment

* tidy
2023-06-24 13:07:37 -05:00
Ansh
0306f81d37
Add ability to embed lists (#1188)
* add cid to ListView and ListViewBasic

* add test for mute list embed

* add support for list embeds views

* test

* port to appview

* update missing snap

---------

Co-authored-by: dholms <dtholmgren@gmail.com>
2023-06-23 16:30:52 -04:00
devin ivy
3da0324873
Post record language tagging, lexicon language format (#1219)
* Add languages field to post record

* helper for parsing bcp47

* add language format to lexicon

* codegen for post record langs field

* re-export language parsing in api package

* tests and tidy for lexicon language format

* index post langs, in-progress

* update snapshots, fixes record-with-media embed issue

* index post langs on bsky appview

* don't bother indexing post langs in pds appview, tidy
2023-06-23 16:23:16 -04:00
devin ivy
e651ed67a4
Respect takedowns on feedgen records, sync routes (#1119)
* Don't serve high-level details about taken-down feedgens

* Takedown checks on sync routes

* Use simpler check for takedowns on sync routes

* ensure takendown feedgens are handled in bsky appview
2023-06-21 15:07:16 -04:00
Daniel Holmgren
5d85188509
Invite epochs (#1205)
* add invite epoch

* reorg test

* fix dev env

* tidy
2023-06-13 17:49:47 -05:00
Daniel Holmgren
8c4fa530d6
Pds proxy to appview based on headers (#1191)
* pds proxy to appview based on headers

* reorg appview routes forwarding mutes to appview

* tidy

* clean up ctx

* track notif state

* use notif state for notif routes

* add back in missing file

* pr feedback

* wip

* more views

* more views

* update snaps & suggestions test

* better choices for like & reposted

* note

* better block test

* Test pds-proxied mute and notif state

* Update bsky snaps, remove unnecessary #postView

* Update bsky notification tests to use updateSeen

* add getList getFeedGen tests

* Re-disconnect pds from in-process appview indexing for tests

* clean up forSnapshot

* tidy

* feed gen view tests

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-06-12 17:29:32 -05:00
devin ivy
0ed0eb5d5f
Remove appview repo subscription from PDS (#1195)
* Remove repo subscription from pds appview

* Remove appview repo subscription config from pds
2023-06-12 17:01:59 -04:00
Daniel Holmgren
08fbb33fdf
Appview blocks (#1187)
* Model post and profile aggs in bsky

* Add background, onCommit, db and background stats

* Add aggregations for post and profile

* Use background queue in bsky labeler, misc plumbing

* Process background throughout bsky tests

* bsky tidy and fixes

* Build views using agg tables in bsky

* Views of feedgens on bsky

* hook up indexing

* Setup custom feeds on bsky

* graph service + getList routes

* migration

* Feed views refactor for bsky, implement getFeed w/ auth passthrough

* mute lists

* add getListMutes

* mute list tests

* add mutes table & mute/unmuteActor routes

* Passthrough auth from bsky appview to feedgen, fixes/tidy/tests

* add getMutes

* implement mute functionality

* remove unspecced

* mute tests

* mute impl tests

* remove proxy tests

* Test custom algos on bsky

* add mute state to snapshots

* table & indexing plugin

* getBlocks

* bail out of mute subquery when no viewer

* fleshing out services

* Test pds getFeed proxy

* tidy, fix build

* tidy

* Fix minor race in bsky mutelist tests

* blocks in feed views

* db migration, impl block logic & tests

* Update pds proxy snaps based on appview mutes

* missed some files on last commit

* ensure process after unmute

* update snap

* move adminAuth to seedclient param

* apply blocks in getFeed

* update snaps

* upadate one last snap

* pr feedback

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-06-12 11:05:22 -05:00
devin ivy
7981c5948f
Misc. syncing-up bsky appview with on-pds appview (#1189)
* Misc notification and optimization in bsky, tidy

* Handle notifs on message queue in bsky appview

* Sync-up profile labeling behavior in bsky

* No async work during actor unindexing in bsky, include additional indexes

* Prevent deeply nested notifs w/ hellthread exception in bsky appview

* Add indexes to bsky appview for more efficient actor deletion/unindexing

* Update pds proxy snaps for updated bsky profile labeling

* Return custom suggestions in bsky appview
2023-06-11 14:55:43 -04:00
Daniel Holmgren
4f2f3d8d17
Appview mutes (#1184)
* hook up indexing

* graph service + getList routes

* migration

* mute lists

* add getListMutes

* mute list tests

* add mutes table & mute/unmuteActor routes

* add getMutes

* implement mute functionality

* remove unspecced

* mute tests

* mute impl tests

* remove proxy tests

* add mute state to snapshots

* bail out of mute subquery when no viewer

* Fix minor race in bsky mutelist tests

* Update pds proxy snaps based on appview mutes

* ensure process after unmute

* update snap

* move adminAuth to seedclient param

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-06-10 17:12:15 -04:00