133 lines
4.2 KiB
TypeScript
Raw Normal View History

Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
import AtpAgent from '@atproto/api'
import { cborDecode, cborEncode } from '@atproto/common'
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
import { DatabaseSchemaType } from '../../../src/data-plane/server/db/database-schema'
Build system rework (#2169) * refactor(crypto): remove circular dependency * refactor(crypto): expose compress/decompress as part of the DidKeyPlugin interface * fix(crypto): remove import from private file * refactor: isolate tsconfig * fix: remove unused bench file * chore(repo): remove unused deps * fix(ozone): properly list dependencies * fix(services): do lint js files * fix(services/pds): remove unused deps * chore(pds): remove bench * chore(dev-env): remove unused deps * chore(api): remove bench * remove unused babel.config.js files * fix: remove .ts extension from import * fix(pds): remove imports of src files * fix(tsconfig): properly list all projects * fix(dev-env): remove imports of src files * fix(bsky): remove direct import to crypto src * fix(api): remove imports to api internals * chore(build): prevent bundling of built output * chore(dev): add "dev" script to build in watch mode * chore(deps): move ts-node dependency where it is actually used * fix(deps): add dev-env as project dependency * fix(xrpc-server): properly type kexicon * fix(bsky): improve typings * fix(pds): fully type formatRecordEmbedInternal return value * fix(repo): remove imports from @ipld/car/api * feat(dev-env): re-export BskyIngester * fix: properly lint & type jest config & test files * fix(ci): test after build * fix(types): use NodeJS.Timeout instead of NodeJS.Timer * fix(bsky): make types exportable * fix(ozone): make types exportable * fix(xrpc-server): make types exportable * fix(xprc-server): make code compliant with "node" types * fix(xrpc-server): avoid accessing properties of unknown * chore(deps): update @types/node * feat(tsconfig): narrow down available types depending on the package's target environment * fix(pds): remove unused prop * fix(bsync): Database's migrator not always initialized * fix(dev-env): remove unreachable code * fix(xrpc-server): remove unused import * fix(xrpc-server): mark header property as abstract * fix(pds): initialize LeakyTxPlugin's txOver property * fix(bsky): initialize LeakyTxPlugin's txOver property * fix(bsky): remove unused migrator from DatabaseCoordinator * fix(bsky): Properly initialize LabelService's cache property * fix(ozone): Database's migrator not initialized * fix(ozone): initialize LeakyTxPlugin's txOver property * fix(crypto): ignore unused variable error * feat(tsconfig): use stricter rules * feat(tsconfig): enable useDefineForClassFields * feat(xrpc-server): add support for brotli incoming payload * fix(xrpc-server): properly parse & process content-encoding * fix(common:stream): always call cb in _transform * tidy/fix tests and service entrypoints * Revert "fix(xrpc-server): properly parse & process content-encoding" This reverts commit 2b1c66e153820d3e128fc839fcc1834d52a66686. * Revert "feat(xrpc-server): add support for brotli incoming payload" This reverts commit e710c21e6118214ddf215b0515e68cb87299a952. * remove special node env for tests (defaults to jest val of "test") * kill mute sync handler on disconnect * work around connect-es bug w/ request aborts * style(crypto): rename imports from uint8arrays * fix update package-lock * fix lint * force hbs files to be bundled as cjs * fix: use concurrently instead of npm-run-all npm-run-all seems not to be maintained anymore. Additionally, concurrently better forwards signals to child processes. * remove concurrently alltogether * ignore sqlite files in services/pds * fix verify * fix verify * tidy, fix verify * fix blob diversion test * build rework changeset --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2024-03-18 22:10:58 +01:00
import { SeedClient, TestNetwork, basicSeed } from '@atproto/dev-env'
import { PreparedWrite, sequencer } from '@atproto/pds'
import { CommitData } from '@atproto/repo'
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
import { ids } from '../../../src/lexicon/lexicons'
import { forSnapshot } from '../../_util'
Build system rework (#2169) * refactor(crypto): remove circular dependency * refactor(crypto): expose compress/decompress as part of the DidKeyPlugin interface * fix(crypto): remove import from private file * refactor: isolate tsconfig * fix: remove unused bench file * chore(repo): remove unused deps * fix(ozone): properly list dependencies * fix(services): do lint js files * fix(services/pds): remove unused deps * chore(pds): remove bench * chore(dev-env): remove unused deps * chore(api): remove bench * remove unused babel.config.js files * fix: remove .ts extension from import * fix(pds): remove imports of src files * fix(tsconfig): properly list all projects * fix(dev-env): remove imports of src files * fix(bsky): remove direct import to crypto src * fix(api): remove imports to api internals * chore(build): prevent bundling of built output * chore(dev): add "dev" script to build in watch mode * chore(deps): move ts-node dependency where it is actually used * fix(deps): add dev-env as project dependency * fix(xrpc-server): properly type kexicon * fix(bsky): improve typings * fix(pds): fully type formatRecordEmbedInternal return value * fix(repo): remove imports from @ipld/car/api * feat(dev-env): re-export BskyIngester * fix: properly lint & type jest config & test files * fix(ci): test after build * fix(types): use NodeJS.Timeout instead of NodeJS.Timer * fix(bsky): make types exportable * fix(ozone): make types exportable * fix(xrpc-server): make types exportable * fix(xprc-server): make code compliant with "node" types * fix(xrpc-server): avoid accessing properties of unknown * chore(deps): update @types/node * feat(tsconfig): narrow down available types depending on the package's target environment * fix(pds): remove unused prop * fix(bsync): Database's migrator not always initialized * fix(dev-env): remove unreachable code * fix(xrpc-server): remove unused import * fix(xrpc-server): mark header property as abstract * fix(pds): initialize LeakyTxPlugin's txOver property * fix(bsky): initialize LeakyTxPlugin's txOver property * fix(bsky): remove unused migrator from DatabaseCoordinator * fix(bsky): Properly initialize LabelService's cache property * fix(ozone): Database's migrator not initialized * fix(ozone): initialize LeakyTxPlugin's txOver property * fix(crypto): ignore unused variable error * feat(tsconfig): use stricter rules * feat(tsconfig): enable useDefineForClassFields * feat(xrpc-server): add support for brotli incoming payload * fix(xrpc-server): properly parse & process content-encoding * fix(common:stream): always call cb in _transform * tidy/fix tests and service entrypoints * Revert "fix(xrpc-server): properly parse & process content-encoding" This reverts commit 2b1c66e153820d3e128fc839fcc1834d52a66686. * Revert "feat(xrpc-server): add support for brotli incoming payload" This reverts commit e710c21e6118214ddf215b0515e68cb87299a952. * remove special node env for tests (defaults to jest val of "test") * kill mute sync handler on disconnect * work around connect-es bug w/ request aborts * style(crypto): rename imports from uint8arrays * fix update package-lock * fix lint * force hbs files to be bundled as cjs * fix: use concurrently instead of npm-run-all npm-run-all seems not to be maintained anymore. Additionally, concurrently better forwards signals to child processes. * remove concurrently alltogether * ignore sqlite files in services/pds * fix verify * fix verify * tidy, fix verify * fix blob diversion test * build rework changeset --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2024-03-18 22:10:58 +01:00
type Database = TestNetwork['bsky']['db']
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
describe('sync', () => {
let network: TestNetwork
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
let pdsAgent: AtpAgent
let sc: SeedClient
beforeAll(async () => {
network = await TestNetwork.create({
2023-04-25 15:26:14 -05:00
dbPostgresSchema: 'bsky_subscription_repo',
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
})
pdsAgent = network.pds.getClient()
Finalize PDS in-process AppView removal (#1198) * rm tables * rm event-stream & proxied * Remove appview services, move label service to pds * only proxy appview stuff * delete more tables * Start removing message dispatched from pds * more syncing-up removal of message dispatcher in pds * merged * remove feedgens from pds, remove getPopular * remove unused image helper from pds * fixing compiler errors * clean up sharp * rm label service * first pass on cleaning up tests * fix up a bunch of tests * moderation view tests * last admin tests * got a lil overzealous in deletes * clean up unused cfg * clean up label table * simplify admin repo search query/logic * tidy pds entrypoint * in-progress pds config changes * cfg fiddling * finish cleaning up cfg/ctx * comments * building * pds prefix on env * test env * collapse pds migrations down into a single migration * fix up dev-env * tidy * cleanup * fix pds admin tests * fix handle test * fix pds proxy tests * fix subscribe repos test * fix sqlite config in pds tests * add sqlite clause in sequencer-leader * fix actor search w/ sqlite on pds * fixes * fix dev env build * update pds service entrypoint * simple env example * make takedown ids opaque identifiers in the pds * use pds routes for api tests * update pds dockerfile with volume and correct port env var * add a couple env vars to example * add comments to env example * @atproto/pds 0.2.0-beta.0 * @atproto/aws 0.0.1-beta.0 * appview did * @atproto/aws 0.0.1 * enable logs by default * update env example * bugfixing sandbox issues * consistency in pds env var name for appview url * log on pds start and stop, configure version at runtime * @atproto/pds 0.2.0-beta.1 * fix semver matching for pds beta version * v0.2.0-beta.2 * default invites to being not required * fix flaky test * limit db connections in tests * publish 0.2.0-beta.d3 * fix invite required parsing * @atproto/pds 0.2.0-beta.5 * Proxy getPopularFeedGenerators on simplified pds (#1222) proxy getPopularFeedGenerators on pds Co-authored-by: dholms <dtholmgren@gmail.com> * tidy migrations * fix service entry * bump version * change auth order * bump version * bump version * add upgradeRepoVersion & fallback url for cdn * bump version * merging * merge pds * building dev-env * merging tests * merge service entry * test fixing * tidy * fix admin search * tidy * tidy * add snap for getListFeed * add backup nameserver cfg * tidy + pr feedback * tidy * tidy env * bit more * re-add dotenv to root package.json * fix dep * build branch * fix tests * Refactor tests to make better use of dev-env (#1690) * refactor pds tests to use dev env * refactor bsky tests * fix pds test * tidy bsky tests * build pds correctly * fix entry point * default logging to false (for now) * format service entry * Switch takedown ids back to ints on pds distribution (#1694) * switch takedown ids back to ints, consistent with live pds * tidy/fix migration * update migration for sqlite * export moderation action reversal * takedown tests * dont build branch --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-10-02 13:27:45 -05:00
sc = network.getSeedClient()
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
await basicSeed(sc)
})
afterAll(async () => {
await network.close()
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
})
it('indexes permit history being replayed.', async () => {
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
const { db } = network.bsky
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
// Generate some modifications and dupes
const { alice, bob, carol, dan } = sc.dids
await sc.follow(alice, bob)
await sc.follow(carol, alice)
await sc.follow(bob, alice)
await sc.follow(dan, bob)
await sc.like(dan, sc.posts[alice][1].ref) // Identical
await sc.like(alice, sc.posts[carol][0].ref) // Identical
await updateProfile(pdsAgent, alice, { displayName: 'ali!' })
await updateProfile(pdsAgent, bob, { displayName: 'robert!' })
await network.processAll()
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
// Table comparator
const getTableDump = async () => {
const [actor, post, profile, like, follow, dupes] = await Promise.all([
dumpTable(db, 'actor', ['did']),
dumpTable(db, 'post', ['uri']),
dumpTable(db, 'profile', ['uri']),
dumpTable(db, 'like', ['creator', 'subject']),
dumpTable(db, 'follow', ['creator', 'subjectDid']),
dumpTable(db, 'duplicate_record', ['uri']),
])
return { actor, post, profile, like, follow, dupes }
}
// Mark originals
const originalTableDump = await getTableDump()
// Reprocess repos via sync subscription, on top of existing indices
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
await network.bsky.sub.destroy()
// Hard reset of state
network.bsky.sub.cursor = 0
network.bsky.sub.seenSeq = null
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
// Boot streams back up
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
network.bsky.sub.run()
await network.processAll()
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
// Permissive of indexedAt times changing
expect(forSnapshot(await getTableDump())).toEqual(
forSnapshot(originalTableDump),
)
})
it('indexes actor when commit is unprocessable.', async () => {
// mock sequencing to create an unprocessable commit event
Feature branch: PDS v2 (#1789) * cleanup repeat process all * wip * skip actor search test * skip actor search test * tweak processAll * decrease wait to 1 sec * repo_blob -> record_blob * simplify backlink linkTo * return repo_root to one row * sequence before updating repo_root * invite code forUser -> forAccount * ipld_block -> repo_block * use lru-cache fetchMethod * move did_cache to own db * better error handling on did cache * drop did_handle * fix sequencer wait time * debug * debug * more debug * check something * fix bday paradox * fix bday paradox * tidy up pds service auth * rm skipped test * retry http * tidy * improve fanout error handling * fix test * return signing key in did-web * more tests * tidy serivce auth checks * user_account -> account * remove inviteNote * keypair per repo * use an lru cache for keypairs as well * clean up repo * wip * wrap up accoutn manager * tidy * tidy * fix tests * fix disabled codes * fix appview tests * add note * set pragmas * tidy account manager getDb * rename pref transactor * user pref -> account pref * handle blob imports * tidy imports * add reserveSigningKey * wip transferAccount * clean up transferAccount * tests * tidy * tidy * configure entryway url on pds * handle entryway in pds admin endpoints * make importRepo temp * fix imports * make email optional on pds when using entryway * handle diffs * handle pds entryway usage for server, identity, admin endpoints * pds support for credentials from entryway * setup pds tests w/ entryway service * tidy * tidy * update entryway version * wip * test handle updates w/ entryway * split account table into two * tidy * tweak scripts * tidy tests * tidy * better config for actorstore & dbs * clean up cfg more * reorg actorstore fs layout * handle erros on actor db create * pr tidy & fix accoutn deletion test * pr feedback * fix bad merge * unskip test * fix subscribe repos tests * tidy repo root tables * tidy * fix tests * tidy delete tokens * tidy account getters * tidy * bulk deletesg * increase chunk size * handle racing refreshes * wip * fix auth test * invert import flow * clean up actor store on create account failure * tweak sequencer * prevent invite code races on createAccount * rm note * add back in race protection on getAccountInviteCodes * start feature branch * deleted app migration table * patch up new auth test * rm note * g * create accoutn delegated from entryway * tidy * fix test * change plcOp type to unknown * small fixes * sync up w entryway branch * Use proper error when authed account is not found (#1799) provide proper error when account not found in access-takedown check * build branch * build on ghcr * tweak service file * tweak service file * change where we save reserved keys * no tmp dir in blobstore either * fix blobstore temp location again * handle repeat record_blobs * create account before submitting plc op & undo if fail * small tweak * limit the number of local records * push out empty commit on transfer * fix issue with record_blob * add push blob endpoint * Set and validate token audiences on pds v2 (#1793) set and validate token audience on pds v2 * merge * include entryway did on tests * build branch * fix cache issue * xrpc server blob limit * put correct bytes * add auth to routes * handle quarantining/unquarantining a blob that does not exist * tidy * fix transfer tests * fix email request routes for entryway * PDS v2 entryway account deletion (#1819) * add admin lexicon for account deletion * implement admin account deletion endpoint * fix entryway proxying on account email checks * proxy to entryway for acct deletion * read-after-write sanity check * tweak * wip * finish refactor * fix test schema * application retry logic for busy * pr feedback * rm lru-cache * fix test pg schema * fix transfer test * Sqlite instrumentation for pds v2 (#1838) * sqlite instrumentation * build * remove build * dont reimport blobs * send ticks during import * close on error * catch handle validation error * add log * fix test * return emailConfirmedAt on getAccountInfo * Upgrade sharp on pds v2 (#1863) upgrade sharp to 0.32.6 * read all bytes before parsing car * Async car reader (#1867) * asynchronously read in car * dont buffer car * tweak * Gracefully handle indexing of invalid records (#1853) * gracefully handle indexing of invalid records * fix repo tests * Fix role auth for access-or-role verifier, getBlob check on actor takedowns (#1869) fix role auth for access-or-role verifier, fix getBlob actor takedown check * better cleanup of actor-stores * add ability to not ensure leaves * tidy * allow did:web transfer * Migration utility for actor-store (#1873) beginnings of helper for migrating all actors Co-authored-by: Devin Ivy <devinivy@gmail.com> * base case for findBlobRefs * App-level retries for sqlite on pds (#1871) * revamp retry helper to be more flexible re: backoff strategies * sqlite timeout helper * ensure sqlite wal on db creation/migration rather than every open * layer retries for sqlite on writes outside transactions on pds * tidy * fix up lockfile * tidy * fix lex codegen * fix timing bug in threadgate test * No-op update handling (#1916) do no produce commits on no-op updates * Retry on all SQLITE_BUSY error codes (#1917) retry on all sqlite_busy error codes * Pds v2 ensure sqlite ready (#1918) ensure sqlite is ready before making queries * try something * tidy * dont build branch --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-12-04 18:00:09 -06:00
const sequenceCommitOrig = network.pds.ctx.sequencer.sequenceCommit
network.pds.ctx.sequencer.sequenceCommit = async function (
did: string,
commitData: CommitData,
writes: PreparedWrite[],
) {
const seqEvt = await sequencer.formatSeqCommit(did, commitData, writes)
const evt = cborDecode(seqEvt.event) as sequencer.CommitEvt
evt.blocks = new Uint8Array() // bad blocks
seqEvt.event = cborEncode(evt)
Feature branch: PDS v2 (#1789) * cleanup repeat process all * wip * skip actor search test * skip actor search test * tweak processAll * decrease wait to 1 sec * repo_blob -> record_blob * simplify backlink linkTo * return repo_root to one row * sequence before updating repo_root * invite code forUser -> forAccount * ipld_block -> repo_block * use lru-cache fetchMethod * move did_cache to own db * better error handling on did cache * drop did_handle * fix sequencer wait time * debug * debug * more debug * check something * fix bday paradox * fix bday paradox * tidy up pds service auth * rm skipped test * retry http * tidy * improve fanout error handling * fix test * return signing key in did-web * more tests * tidy serivce auth checks * user_account -> account * remove inviteNote * keypair per repo * use an lru cache for keypairs as well * clean up repo * wip * wrap up accoutn manager * tidy * tidy * fix tests * fix disabled codes * fix appview tests * add note * set pragmas * tidy account manager getDb * rename pref transactor * user pref -> account pref * handle blob imports * tidy imports * add reserveSigningKey * wip transferAccount * clean up transferAccount * tests * tidy * tidy * configure entryway url on pds * handle entryway in pds admin endpoints * make importRepo temp * fix imports * make email optional on pds when using entryway * handle diffs * handle pds entryway usage for server, identity, admin endpoints * pds support for credentials from entryway * setup pds tests w/ entryway service * tidy * tidy * update entryway version * wip * test handle updates w/ entryway * split account table into two * tidy * tweak scripts * tidy tests * tidy * better config for actorstore & dbs * clean up cfg more * reorg actorstore fs layout * handle erros on actor db create * pr tidy & fix accoutn deletion test * pr feedback * fix bad merge * unskip test * fix subscribe repos tests * tidy repo root tables * tidy * fix tests * tidy delete tokens * tidy account getters * tidy * bulk deletesg * increase chunk size * handle racing refreshes * wip * fix auth test * invert import flow * clean up actor store on create account failure * tweak sequencer * prevent invite code races on createAccount * rm note * add back in race protection on getAccountInviteCodes * start feature branch * deleted app migration table * patch up new auth test * rm note * g * create accoutn delegated from entryway * tidy * fix test * change plcOp type to unknown * small fixes * sync up w entryway branch * Use proper error when authed account is not found (#1799) provide proper error when account not found in access-takedown check * build branch * build on ghcr * tweak service file * tweak service file * change where we save reserved keys * no tmp dir in blobstore either * fix blobstore temp location again * handle repeat record_blobs * create account before submitting plc op & undo if fail * small tweak * limit the number of local records * push out empty commit on transfer * fix issue with record_blob * add push blob endpoint * Set and validate token audiences on pds v2 (#1793) set and validate token audience on pds v2 * merge * include entryway did on tests * build branch * fix cache issue * xrpc server blob limit * put correct bytes * add auth to routes * handle quarantining/unquarantining a blob that does not exist * tidy * fix transfer tests * fix email request routes for entryway * PDS v2 entryway account deletion (#1819) * add admin lexicon for account deletion * implement admin account deletion endpoint * fix entryway proxying on account email checks * proxy to entryway for acct deletion * read-after-write sanity check * tweak * wip * finish refactor * fix test schema * application retry logic for busy * pr feedback * rm lru-cache * fix test pg schema * fix transfer test * Sqlite instrumentation for pds v2 (#1838) * sqlite instrumentation * build * remove build * dont reimport blobs * send ticks during import * close on error * catch handle validation error * add log * fix test * return emailConfirmedAt on getAccountInfo * Upgrade sharp on pds v2 (#1863) upgrade sharp to 0.32.6 * read all bytes before parsing car * Async car reader (#1867) * asynchronously read in car * dont buffer car * tweak * Gracefully handle indexing of invalid records (#1853) * gracefully handle indexing of invalid records * fix repo tests * Fix role auth for access-or-role verifier, getBlob check on actor takedowns (#1869) fix role auth for access-or-role verifier, fix getBlob actor takedown check * better cleanup of actor-stores * add ability to not ensure leaves * tidy * allow did:web transfer * Migration utility for actor-store (#1873) beginnings of helper for migrating all actors Co-authored-by: Devin Ivy <devinivy@gmail.com> * base case for findBlobRefs * App-level retries for sqlite on pds (#1871) * revamp retry helper to be more flexible re: backoff strategies * sqlite timeout helper * ensure sqlite wal on db creation/migration rather than every open * layer retries for sqlite on writes outside transactions on pds * tidy * fix up lockfile * tidy * fix lex codegen * fix timing bug in threadgate test * No-op update handling (#1916) do no produce commits on no-op updates * Retry on all SQLITE_BUSY error codes (#1917) retry on all sqlite_busy error codes * Pds v2 ensure sqlite ready (#1918) ensure sqlite is ready before making queries * try something * tidy * dont build branch --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-12-04 18:00:09 -06:00
await network.pds.ctx.sequencer.sequenceEvt(seqEvt)
}
// create account and index the initial commit event
await sc.createAccount('jack', {
handle: 'jack.test',
email: 'jack@test.com',
password: 'password',
})
await network.processAll()
// confirm jack was indexed as an actor despite the bad event
Feature: Appview v2 (#1924) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * filler commit * rm filler * server boilerplate * follows impl * posts impl * posts & likes impl * repost impl * profiles & handle null values * list impl * mutes impl * blocks impl * misc * feed gen impl * label impl * notifs impl * feeds impl * threads impl * early sketchwork * wip * stub out thick client * in-progress work on hydrator * tweak * hydrate profile labels, detail lists * feedgen hydration * protobuf tweaks * more protobuf tweaks * wip * snake case * moar snake case * tidy actor hydration * tidy parsing * type fixes, renaming, comments in hydrator * hydrate list items and likes * hydrate notifications * feed hydration * graph & label hydration * more record protobufs * pluralize * tweak pbs * use new methods * Setup dataplane grpc client/mock server (#1921) * add buf & connectrpc, codegen client * lint * prettier ignore * fix prettier ignore * tidy & add tests * add record getter mocks * post view hydration * fix up mock dataplane to match new protos * missed one * wire up dataplane in ctx & dev-env * adding some basic views * feed hydration, add blocks to post hydration * pass over notification hydration * tidy * merge * implement getProfile * hydrate post aggregation and viewer state * fix * fix codegen * get some tests passing! * add takedowns & some like bugfixing * all profile tests passing! * likes test * follow endpoints using data plane * reorg follow block rules * reposts * post views! * implement getList w/ dataplane caveat * adjust dataplane getListMembers to return listitem uris * implement getListMutes and -Blocks w/ dataplane * suggestions * timeline * misc view fixes * view fixes for mutes, self-mute/block * author feed * feed gen routes * tidy * misc block/mute fixes * list feed & actor likes * implement getLists, fix some empty cursors * implement getMutes, empty profile description fix * implement getBlocks, block application fix * implement getSuggestedFollowsByActor, needs some fixes * feed generation * search routes * threads * tidy * fix some snaps * fix getSuggestedFollowsByActor * implement listNotifications * implement getUnreadCount w/ dataplane * implement notifications.updateSeen w/ dataplane * 3rd party blocking tests * blocked profile viewer * add search mocks * refactor getFeed * createPipeline -> createPipelineNew * basic replygating functionality on dataplane w/o filtering violating replies * hack threadgates into dataplane, apply gates * deterministic thread orders in dataplane * misc cleanup around dataplane * upgrade typescript to v5.3 * update typescript linter deps * sync bsky proto, codegen * update dataplane, sync with bsky proto updates * remove indexer, ingester, daemon, moderation services from appview * convert more bsky internals to dataplane, remove custom feedgens, implement mute/unmuting in mock dataplane * remove bsky services. db and indexing logic into mock dataplane. * remove tests not needed by appview v2, misc reorg * add basic in-mem repo subscription to dataplane mock * fix dev-env, bsky tests, bsky build * cull bsky service entrypoint * add bsky service readme * build * tidy * tidy, fix pds proxy tests * fix * fix bsky entrypoint deps * support http2 grpc client * build * fix dataplane bad tls config/default * support multiple dataplane urls, retry when unavailable * build * tidy/fix * move dataplane mock tests into their own dir * cover label hydration through timeline test * bring back labels in appview tests * remove unused db primary/replica/coordinator from bsky dataplane * bsky proto add cids to contracts, buf codegen * sync-up bsky data-plane w/ codegen updates * start using dataplane interaction endpoints * add file * avoid overfetching from dataplane, plumb feed items and cids * pass refs through for post viewer state * switch list feeds to use feed item in dataplane * handle not found err on get-thread dataplane call * support use of search service rather than dataplane methods * mark some appview v2 todos * tidy * still use dataplane on search endpoints when search service is not configured * fix pds test * fix up bsky tests & snaps * tidy migrations * fix appview-v2 docker build * Support label issuer tied to appview v2 (#2033) support label issuer tied to appview * Appview v2: handle empty cursor on list notifications (#2017) handle empty cursor on appview listnotifs * Update appview v2 to use author feed enum (#2047) * update bsky protos with author feed enum, misc feed item changes * support new author feed enums in dataplane * fix build * Appview v2: utilize sorted-at field in bsky protos (#2050) utilize new sorted-at field in bsky protos * remove all dataplane usage of GetLikeCounts, switch to GetInteractionCounts * Appview v2, sync w/ changes to protos (#2071) * sync bsky protos * sync-up bsky implementation w/ proto changes * Appview v2 initial implementation for getPopularFeedGenerators (#2072) add an initial implementation for getPopularFeedGenerators on appview v2 * merge * fixes * fix feed tests * fix bsync mock * format * remove unused config * fix lockfile * another lockfile fix * fix duplicate type * fix dupplicate test * Appview v2 handling clearly bad cursors (#2092) * make mock dataplane cursors different from v1 cursors * fail open on clearly bad appview cursors * fix pds appview proxy snaps * Appview v2 no notifs seen behavior (#2096) * alter behavior for presenting notifications w/ no last-seen time * fix pds proxy tests * Appview v2 dataplane retries based on client host (#2098) choose dataplane client for retries based on host when possible/relevant * don't apply negated labels * display suspensions on actor profile in appview v2 * Appview v2 use dataplane for identity lookups (#2095) * update bsky proto w/ identity methods * setup identity endpoints on mock dataplane * move from idresolver to dataplane for identity lookups on appview * tidy * Appview v2: apply safe takedown refs to records, actors (#2107) apply safe takedown refs to records, actors * Fix timing on appview v2 repo rev header (#2113) fix timing on appview repo rev * fix post thread responses * Appview v2 don't apply 3p self blocks (#2112) do not apply 3p self-blocks * Appview v2 search for feed generators (#2118) * add protos for feedgen search * support feed search on getPopularFeedGenerators * Appview v2 config tidy (#2117) * remove mod and triage roles from appview * rename cdn and search config * remove custom feed harness from appview v2 * Appview v2: don't apply missing modlists (#2122) * dont apply missing mod lists * update mock dataplane * Update packages/bsky/src/hydration/hydrator.ts Co-authored-by: devin ivy <devinivy@gmail.com> * refactor & document a bit better * fix up other routes --------- Co-authored-by: devin ivy <devinivy@gmail.com> * Appview v2 enforce post thread root boundary (#2120) * enforce post thread root boundary * test thread root boundary * Appview v2 fix admin environment variable (#2137) fix admin env in appview v2 * Remove re-pagination from getSuggestions (#2145) * remove re-pagination from getSuggestions * fix test * Adjust wording for account suspension (#2153) adjust wording for account suspension * Appview v2: fix not-found and blocked uris in threads (#2201) * fix uris of not-found and blocked posts in threads * update snaps * :sparkles: Show author feed of takendown author to admins only (#2197) * fold in cid, auth, tracing, node version changes * remove dead config from bsky service entrypoint * build * remove ozone test codepaths for appview v2 * tidy, docs fix --------- Co-authored-by: Devin Ivy <devinivy@gmail.com> Co-authored-by: Foysal Ahamed <foysal@blueskyweb.xyz>
2024-02-27 14:22:55 -06:00
const actors = await dumpTable(network.bsky.db, 'actor', ['did'])
expect(actors.map((a) => a.handle)).toContain('jack.test')
Feature branch: PDS v2 (#1789) * cleanup repeat process all * wip * skip actor search test * skip actor search test * tweak processAll * decrease wait to 1 sec * repo_blob -> record_blob * simplify backlink linkTo * return repo_root to one row * sequence before updating repo_root * invite code forUser -> forAccount * ipld_block -> repo_block * use lru-cache fetchMethod * move did_cache to own db * better error handling on did cache * drop did_handle * fix sequencer wait time * debug * debug * more debug * check something * fix bday paradox * fix bday paradox * tidy up pds service auth * rm skipped test * retry http * tidy * improve fanout error handling * fix test * return signing key in did-web * more tests * tidy serivce auth checks * user_account -> account * remove inviteNote * keypair per repo * use an lru cache for keypairs as well * clean up repo * wip * wrap up accoutn manager * tidy * tidy * fix tests * fix disabled codes * fix appview tests * add note * set pragmas * tidy account manager getDb * rename pref transactor * user pref -> account pref * handle blob imports * tidy imports * add reserveSigningKey * wip transferAccount * clean up transferAccount * tests * tidy * tidy * configure entryway url on pds * handle entryway in pds admin endpoints * make importRepo temp * fix imports * make email optional on pds when using entryway * handle diffs * handle pds entryway usage for server, identity, admin endpoints * pds support for credentials from entryway * setup pds tests w/ entryway service * tidy * tidy * update entryway version * wip * test handle updates w/ entryway * split account table into two * tidy * tweak scripts * tidy tests * tidy * better config for actorstore & dbs * clean up cfg more * reorg actorstore fs layout * handle erros on actor db create * pr tidy & fix accoutn deletion test * pr feedback * fix bad merge * unskip test * fix subscribe repos tests * tidy repo root tables * tidy * fix tests * tidy delete tokens * tidy account getters * tidy * bulk deletesg * increase chunk size * handle racing refreshes * wip * fix auth test * invert import flow * clean up actor store on create account failure * tweak sequencer * prevent invite code races on createAccount * rm note * add back in race protection on getAccountInviteCodes * start feature branch * deleted app migration table * patch up new auth test * rm note * g * create accoutn delegated from entryway * tidy * fix test * change plcOp type to unknown * small fixes * sync up w entryway branch * Use proper error when authed account is not found (#1799) provide proper error when account not found in access-takedown check * build branch * build on ghcr * tweak service file * tweak service file * change where we save reserved keys * no tmp dir in blobstore either * fix blobstore temp location again * handle repeat record_blobs * create account before submitting plc op & undo if fail * small tweak * limit the number of local records * push out empty commit on transfer * fix issue with record_blob * add push blob endpoint * Set and validate token audiences on pds v2 (#1793) set and validate token audience on pds v2 * merge * include entryway did on tests * build branch * fix cache issue * xrpc server blob limit * put correct bytes * add auth to routes * handle quarantining/unquarantining a blob that does not exist * tidy * fix transfer tests * fix email request routes for entryway * PDS v2 entryway account deletion (#1819) * add admin lexicon for account deletion * implement admin account deletion endpoint * fix entryway proxying on account email checks * proxy to entryway for acct deletion * read-after-write sanity check * tweak * wip * finish refactor * fix test schema * application retry logic for busy * pr feedback * rm lru-cache * fix test pg schema * fix transfer test * Sqlite instrumentation for pds v2 (#1838) * sqlite instrumentation * build * remove build * dont reimport blobs * send ticks during import * close on error * catch handle validation error * add log * fix test * return emailConfirmedAt on getAccountInfo * Upgrade sharp on pds v2 (#1863) upgrade sharp to 0.32.6 * read all bytes before parsing car * Async car reader (#1867) * asynchronously read in car * dont buffer car * tweak * Gracefully handle indexing of invalid records (#1853) * gracefully handle indexing of invalid records * fix repo tests * Fix role auth for access-or-role verifier, getBlob check on actor takedowns (#1869) fix role auth for access-or-role verifier, fix getBlob actor takedown check * better cleanup of actor-stores * add ability to not ensure leaves * tidy * allow did:web transfer * Migration utility for actor-store (#1873) beginnings of helper for migrating all actors Co-authored-by: Devin Ivy <devinivy@gmail.com> * base case for findBlobRefs * App-level retries for sqlite on pds (#1871) * revamp retry helper to be more flexible re: backoff strategies * sqlite timeout helper * ensure sqlite wal on db creation/migration rather than every open * layer retries for sqlite on writes outside transactions on pds * tidy * fix up lockfile * tidy * fix lex codegen * fix timing bug in threadgate test * No-op update handling (#1916) do no produce commits on no-op updates * Retry on all SQLITE_BUSY error codes (#1917) retry on all sqlite_busy error codes * Pds v2 ensure sqlite ready (#1918) ensure sqlite is ready before making queries * try something * tidy * dont build branch --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
2023-12-04 18:00:09 -06:00
network.pds.ctx.sequencer.sequenceCommit = sequenceCommitOrig
})
Bsky app view (#716) * Init pulling bsky app view from pds package into its own package, remove sqlite db dialect * Cull bsky config, services, auth, etc. * Sweep app view xrpc methods, tidy deps, add storage back for img server * Run repo subscription on bsky app view * Collapse db migrations down for bsky app view * Tidy app view bin * Remove mute functionality from app view, delegate to pds * Initial tidy/culling of bsky app view tests * Passing bsky app view db, server, and repo subscription tests * Passing bsky app view duplicate-records tests * Bsky app view test tidy/cull * In bsky app view replace repo_root, ipld_block, did_handle with actor and record tables. Remove assertions/confirmations. * Update bsky impl for simpler actor and record tables, removed asserion/confirmations. Skip indexing unknown collections. * Setup actor handles by did in bsky app view * Passing indexing tests on bsky app view * Passing image tests on bsky app view * Fix bsky actor reindexing, support custom lock id for testing repo subs * Sweep bsky view tests, misc tests, passing * Tidy bsky deps * Include did in resized image uris * Update bsky image process server to use getBlob * Update image server tests, misc fixes * Implement bsky blob resolver * Wire local image processing server to local blob resolver, test blob resolver * Tidy * Tidy * Tidy * Tidy app view init * Fix handle resolution, tidy * Add utils for partitioning indexing by did * Update repo sub to parallelize work per repo * Dep tidy * Tidy bsky tests for updated repo sub destroy() * Update thead indexing to handle out-of-order posts * Sketch out strategy in bsky for handling too-big commits * Set content-type on sync.getBlob * Add logging for failed transmissions in bsky blob resolver * Tidy * Tidy bsky repo indexing and supporting repo interfaces * Sort in app view based on combo of creation and indexing times * Fix types * Add retry utils to bsky * Add retries to http requests made by bsky * Test repo indexing * Update bsky db/model for lex refactor * Update bsky lexicons for lex refactor * Update bsky actor service for lex refactor * Update bsky feed service for lex refactor * Update bsky indexing service for lex refactor * Update bsky repo subscription for lex refactor * Tidy bsky repo sub * Add unspecced endpoints to bsky app view, update entrypoint * Update bsky xrpc utils for lex refactor * Update bsky xrpc methods for lex refactor * Update bsky test seeds for lex refactor, tidy api entrypoint * Update bsky non-view tests for lex refactor * Update bsky likes view test for lex refactor, minor fix * Update bsky author feed tests for lex refactor, minor test util fix * Update bsky follow, profile, repost, search view tests for lex refactor * Update bsky timeline view tests for lex refactor * Replace bsky out-of-order thread indexing logic * Update bsky thread view tests for lex refactor, general test tidying * Handle rebases and too-big commits in repo subscription, tracking commit data cid * Tidy * Ensure did resolver reports "not found" only when positively not found * Handle tombstones and handle updates in bsky * Test indexing handle updates and did tombstones * Support cors on bsky * Allow app view to serve most routes unauthed * Tests for bsky unauthed views * Tidy bsky service entrypoint and dockerfile * Remove unused storage interfaces from bsky * Bsky entrypoint and dockerfile fixes, tidy * Add workflow for bsky build to aws * Use more standard db env variables, make migration creds optional * Make bsky repo subscription optional * Fix lex->json serialization in bsky * Split bsky actor sync state into its own table * Skip invalid records on indexing full repo, tidy * Tidy * Leader test timing * Tidy/lint * Fix bsky config overrides
2023-04-06 18:47:46 -04:00
async function updateProfile(
agent: AtpAgent,
did: string,
record: Record<string, unknown>,
) {
return await agent.api.com.atproto.repo.putRecord(
{
repo: did,
collection: ids.AppBskyActorProfile,
rkey: 'self',
record,
},
{ headers: sc.getHeaders(did), encoding: 'application/json' },
)
}
})
async function dumpTable<T extends keyof DatabaseSchemaType>(
db: Database,
tableName: T,
pkeys: (keyof DatabaseSchemaType[T] & string)[],
) {
const { ref } = db.db.dynamic
let builder = db.db.selectFrom(tableName).selectAll()
pkeys.forEach((key) => {
builder = builder.orderBy(ref(key))
})
return await builder.execute()
}