Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalize PDS in-process AppView removal #1198

Merged
merged 113 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
e71a5e3
rm tables
dholms Jun 12, 2023
a141d44
rm event-stream & proxied
dholms Jun 12, 2023
3b32f2b
Remove appview services, move label service to pds
devinivy Jun 12, 2023
44e4715
only proxy appview stuff
dholms Jun 12, 2023
e600fab
delete more tables
dholms Jun 12, 2023
dc240c2
Start removing message dispatched from pds
devinivy Jun 12, 2023
ac35923
more syncing-up removal of message dispatcher in pds
devinivy Jun 12, 2023
b241fba
merged
dholms Jun 12, 2023
1b10634
remove feedgens from pds, remove getPopular
devinivy Jun 12, 2023
d318f3e
remove unused image helper from pds
devinivy Jun 12, 2023
49010ed
fixing compiler errors
dholms Jun 12, 2023
b458780
clean up sharp
dholms Jun 12, 2023
c9c561d
rm label service
dholms Jun 12, 2023
2774c17
first pass on cleaning up tests
dholms Jun 12, 2023
69f3727
fix up a bunch of tests
dholms Jun 13, 2023
9c4667d
moderation view tests
dholms Jun 13, 2023
6940a76
last admin tests
dholms Jun 13, 2023
810273e
got a lil overzealous in deletes
dholms Jun 13, 2023
b228090
clean up unused cfg
dholms Jun 13, 2023
5ad2e09
clean up label table
dholms Jun 13, 2023
1ad57ba
simplify admin repo search query/logic
devinivy Jun 13, 2023
12cfdfd
tidy pds entrypoint
devinivy Jun 13, 2023
5172554
in-progress pds config changes
devinivy Jun 13, 2023
b7b3d60
cfg fiddling
dholms Jun 13, 2023
dcdeeaa
finish cleaning up cfg/ctx
dholms Jun 13, 2023
68a2daf
comments
dholms Jun 13, 2023
bde6307
building
dholms Jun 13, 2023
def6dc4
pds prefix on env
dholms Jun 13, 2023
03b4b88
test env
dholms Jun 13, 2023
8efa874
collapse pds migrations down into a single migration
devinivy Jun 13, 2023
27ab9e6
fix up dev-env
dholms Jun 13, 2023
906513d
tidy
dholms Jun 13, 2023
197d1a2
cleanup
dholms Jun 13, 2023
0c38164
fix pds admin tests
devinivy Jun 13, 2023
caf670d
fix handle test
dholms Jun 13, 2023
6632166
fix pds proxy tests
devinivy Jun 13, 2023
88e7de4
fix subscribe repos test
dholms Jun 13, 2023
8eb6cf6
fix sqlite config in pds tests
devinivy Jun 13, 2023
453c0d2
add sqlite clause in sequencer-leader
dholms Jun 13, 2023
b8d1f0f
fix actor search w/ sqlite on pds
devinivy Jun 13, 2023
9644851
Merge branch 'simplify-pds' of github.com:bluesky-social/atproto into…
devinivy Jun 13, 2023
853dc05
fixes
dholms Jun 13, 2023
4a5a7a4
fix dev env build
dholms Jun 13, 2023
61b77bc
update pds service entrypoint
devinivy Jun 13, 2023
a569bac
simple env example
dholms Jun 13, 2023
e555345
make takedown ids opaque identifiers in the pds
devinivy Jun 13, 2023
397b10b
use pds routes for api tests
dholms Jun 13, 2023
6863417
update pds dockerfile with volume and correct port env var
devinivy Jun 14, 2023
09095c8
add a couple env vars to example
dholms Jun 14, 2023
1077d87
add comments to env example
dholms Jun 14, 2023
8646d8d
@atproto/pds 0.2.0-beta.0
devinivy Jun 14, 2023
9c81f68
@atproto/aws 0.0.1-beta.0
devinivy Jun 14, 2023
e4da951
appview did
dholms Jun 14, 2023
89c412a
@atproto/aws 0.0.1
devinivy Jun 14, 2023
2d4fa3a
enable logs by default
dholms Jun 14, 2023
2c604c2
update env example
dholms Jun 14, 2023
a109e14
bugfixing sandbox issues
dholms Jun 15, 2023
78effb3
consistency in pds env var name for appview url
devinivy Jun 14, 2023
94a4fec
log on pds start and stop, configure version at runtime
devinivy Jun 14, 2023
ba609d8
@atproto/pds 0.2.0-beta.1
devinivy Jun 14, 2023
dc584ef
fix semver matching for pds beta version
devinivy Jun 14, 2023
5099be5
v0.2.0-beta.2
dholms Jun 15, 2023
719dfd6
default invites to being not required
dholms Jun 15, 2023
999e45a
fix flaky test
dholms Jun 15, 2023
9df4f35
Merge remote-tracking branch 'origin/main' into simplify-pds
devinivy Jun 16, 2023
3e0582a
limit db connections in tests
devinivy Jun 16, 2023
2ffca7b
publish 0.2.0-beta.d3
dholms Jun 20, 2023
2d04df1
Merge branch 'main' into simplify-pds
dholms Jun 20, 2023
a8bd59a
fix invite required parsing
dholms Jun 20, 2023
3752284
@atproto/pds 0.2.0-beta.5
devinivy Jun 20, 2023
e6db8e9
merge main
dholms Jun 29, 2023
c8f1d2e
Proxy getPopularFeedGenerators on simplified pds (#1222)
devinivy Jun 29, 2023
a17a589
big nasty merge
dholms Sep 14, 2023
2ecfe87
tidy migrations
dholms Sep 14, 2023
cd78e8a
fix service entry
dholms Sep 14, 2023
85fb95f
bump version
dholms Sep 14, 2023
c1cafd7
change auth order
dholms Sep 14, 2023
3a9d3aa
bump version
dholms Sep 14, 2023
d948ca6
bump version
dholms Sep 14, 2023
7f99cbf
add upgradeRepoVersion & fallback url for cdn
dholms Sep 15, 2023
4927150
bump version
dholms Sep 15, 2023
dc53474
merging
dholms Sep 26, 2023
8972adc
merge pds
dholms Sep 26, 2023
1351560
building dev-env
dholms Sep 26, 2023
08fde87
merging tests
dholms Sep 27, 2023
e6ec83b
merge service entry
dholms Sep 27, 2023
33db3db
test fixing
dholms Sep 27, 2023
a903798
merge
dholms Sep 27, 2023
701fba8
tidy
dholms Sep 27, 2023
660ad21
fix admin search
dholms Sep 27, 2023
0e4821c
tidy
dholms Sep 27, 2023
58d527b
tidy
dholms Sep 27, 2023
c3f4860
add snap for getListFeed
dholms Sep 27, 2023
1c30e8c
add backup nameserver cfg
dholms Sep 27, 2023
b2864ca
tidy + pr feedback
dholms Sep 28, 2023
75f3653
tidy
dholms Sep 28, 2023
5603a19
tidy env
dholms Sep 28, 2023
6dd27aa
bit more
dholms Sep 28, 2023
497d100
re-add dotenv to root package.json
dholms Sep 28, 2023
046f82c
merge
dholms Sep 28, 2023
fb75e28
fix dep
dholms Sep 28, 2023
20b97c2
build branch
dholms Sep 28, 2023
1134fd8
fix tests
dholms Sep 28, 2023
5b2f4d1
Refactor tests to make better use of dev-env (#1690)
dholms Sep 29, 2023
c7285a8
build pds correctly
dholms Sep 29, 2023
7506d5d
fix entry point
dholms Sep 29, 2023
3efaa1d
default logging to false (for now)
dholms Sep 29, 2023
d3e194f
format service entry
dholms Sep 29, 2023
f2d06c4
Switch takedown ids back to ints on pds distribution (#1694)
devinivy Sep 30, 2023
7e5920f
export moderation action reversal
dholms Oct 1, 2023
dc0360f
Merge branch 'main' into simplify-pds
dholms Oct 1, 2023
4fef68b
takedown tests
dholms Oct 1, 2023
fc193ac
dont build branch
dholms Oct 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsky-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- simplify-pds
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-bsky-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- simplify-pds
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"verify": "lerna run verify --stream",
"prettier": "lerna run prettier",
"build": "lerna run build",
"test": "NODE_ENV=development lerna run test --stream",
"test:withFlags": "NODE_ENV=development lerna run test --stream --"
"test": "LOG_ENABLED=false NODE_ENV=development lerna run test --stream",
"test:withFlags": "LOG_ENABLED=false NODE_ENV=development lerna run test --stream --"
},
"devDependencies": {
"@babel/core": "^7.18.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
},
"devDependencies": {
"@atproto/lex-cli": "*",
"@atproto/pds": "*"
"@atproto/pds": "* | >=0.2.0-beta.0"
}
}
19 changes: 15 additions & 4 deletions packages/api/tests/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('agent', () => {

// put the agent through the auth flow
AtpAgent.configure({ fetch: tokenExpiredFetchHandler })
const res1 = await agent.api.app.bsky.feed.getTimeline()
const res1 = await createPost(agent)
AtpAgent.configure({ fetch: defaultFetchHandler })

expect(res1.success).toEqual(true)
Expand Down Expand Up @@ -267,9 +267,9 @@ describe('agent', () => {
// put the agent through the auth flow
AtpAgent.configure({ fetch: tokenExpiredFetchHandler })
const [res1, res2, res3] = await Promise.all([
agent.api.app.bsky.feed.getTimeline(),
agent.api.app.bsky.feed.getTimeline(),
agent.api.app.bsky.feed.getTimeline(),
createPost(agent),
createPost(agent),
createPost(agent),
])
AtpAgent.configure({ fetch: defaultFetchHandler })

Expand Down Expand Up @@ -462,3 +462,14 @@ describe('agent', () => {
})
})
})

const createPost = async (agent: AtpAgent) => {
return agent.api.com.atproto.repo.createRecord({
repo: agent.session?.did ?? '',
collection: 'app.bsky.feed.post',
record: {
text: 'hello there',
createdAt: new Date().toISOString(),
},
})
}
38 changes: 26 additions & 12 deletions packages/api/tests/bsky-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ describe('agent', () => {
await close()
})

const getProfileDisplayName = async (
agent: BskyAgent,
): Promise<string | undefined> => {
try {
const res = await agent.api.app.bsky.actor.profile.get({
repo: agent.session?.did || '',
rkey: 'self',
})
return res.value.displayName ?? ''
} catch (err) {
return undefined
}
}

it('upsertProfile correctly creates and updates profiles.', async () => {
const agent = new BskyAgent({ service: server.url })

Expand All @@ -29,8 +43,8 @@ describe('agent', () => {
password: 'password',
})

const profile1 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile1.data.displayName).toBeFalsy()
const displayName1 = await await getProfileDisplayName(agent)
expect(displayName1).toBeFalsy()

await agent.upsertProfile((existing) => {
expect(existing).toBeFalsy()
Expand All @@ -39,8 +53,8 @@ describe('agent', () => {
}
})

const profile2 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile2.data.displayName).toBe('Bob')
const displayName2 = await await getProfileDisplayName(agent)
expect(displayName2).toBe('Bob')

await agent.upsertProfile((existing) => {
expect(existing).toBeTruthy()
Expand All @@ -49,8 +63,8 @@ describe('agent', () => {
}
})

const profile3 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile3.data.displayName).toBe('BOB')
const displayName3 = await await getProfileDisplayName(agent)
expect(displayName3).toBe('BOB')
})

it('upsertProfile correctly handles CAS failures.', async () => {
Expand All @@ -62,8 +76,8 @@ describe('agent', () => {
password: 'password',
})

const profile1 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile1.data.displayName).toBeFalsy()
const displayName1 = await await getProfileDisplayName(agent)
expect(displayName1).toBeFalsy()

let hasConflicted = false
let ranTwice = false
Expand All @@ -88,8 +102,8 @@ describe('agent', () => {
})
expect(ranTwice).toBe(true)

const profile2 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile2.data.displayName).toBe('Bob')
const displayName2 = await await getProfileDisplayName(agent)
dholms marked this conversation as resolved.
Show resolved Hide resolved
expect(displayName2).toBe('Bob')
})

it('upsertProfile wont endlessly retry CAS failures.', async () => {
Expand All @@ -101,8 +115,8 @@ describe('agent', () => {
password: 'password',
})

const profile1 = await agent.getProfile({ actor: agent.session?.did || '' })
expect(profile1.data.displayName).toBeFalsy()
const displayName1 = await await getProfileDisplayName(agent)
dholms marked this conversation as resolved.
Show resolved Hide resolved
expect(displayName1).toBeFalsy()

const p = agent.upsertProfile(async (existing) => {
await agent.com.atproto.repo.putRecord({
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@atproto/api": "*",
"@atproto/dev-env": "*",
"@atproto/lex-cli": "*",
"@atproto/pds": "*",
"@atproto/pds": "* | >=0.2.0-beta.0",
"@atproto/xrpc": "*",
"@did-plc/server": "^0.0.1",
"@types/cors": "^2.8.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const enabledSystems = (process.env.LOG_SYSTEMS || '')

const enabledEnv = process.env.LOG_ENABLED
const enabled =
enabledEnv === 'true' || enabledEnv === 't' || enabledEnv === '1'
enabledEnv !== 'false' && enabledEnv !== 'f' && enabledEnv !== '0'

const level = process.env.LOG_LEVEL || 'info'

Expand Down
2 changes: 1 addition & 1 deletion packages/dev-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@atproto/bsky": "*",
"@atproto/crypto": "*",
"@atproto/identity": "*",
"@atproto/pds": "*",
"@atproto/pds": "* | >=0.2.0-beta.0",
"@atproto/uri": "*",
"@atproto/xrpc-server": "*",
"@did-plc/lib": "^0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-env/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const run = async () => {
[ created by Bluesky ]`)

const network = await TestNetworkNoAppView.create({
pds: { port: 2583, publicUrl: 'http://localhost:2583' },
pds: { port: 2583, hostname: 'localhost' },
plc: { port: 2582 },
})
await generateMockSetup(network)
Expand Down
49 changes: 25 additions & 24 deletions packages/dev-env/src/mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,30 +186,31 @@ export async function generateMockSetup(env: TestNetworkNoAppView) {
},
)

const ctx = env.pds.ctx
if (ctx) {
await ctx.db.db
.insertInto('label')
.values([
{
src: ctx.cfg.labelerDid,
uri: labeledPost.uri,
cid: labeledPost.cid,
val: 'nudity',
neg: 0,
cts: new Date().toISOString(),
},
{
src: ctx.cfg.labelerDid,
uri: filteredPost.uri,
cid: filteredPost.cid,
val: 'dmca-violation',
neg: 0,
cts: new Date().toISOString(),
},
])
.execute()
}
// @TODO get from appview instead
// const ctx = env.pds.ctx
// if (ctx) {
// await ctx.db.db
// .insertInto('label')
// .values([
// {
// src: ctx.cfg.labelerDid,
// uri: labeledPost.uri,
// cid: labeledPost.cid,
// val: 'nudity',
// neg: 0,
// cts: new Date().toISOString(),
// },
// {
// src: ctx.cfg.labelerDid,
// uri: filteredPost.uri,
// cid: filteredPost.cid,
// val: 'dmca-violation',
// neg: 0,
// cts: new Date().toISOString(),
// },
// ])
// .execute()
// }

// a set of replies
for (let i = 0; i < 100; i++) {
Expand Down
6 changes: 5 additions & 1 deletion packages/dev-env/src/network-no-appview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ export class TestNetworkNoAppView {
const dbPostgresUrl = params.dbPostgresUrl || process.env.DB_POSTGRES_URL
const dbPostgresSchema =
params.dbPostgresSchema || process.env.DB_POSTGRES_SCHEMA
const dbSqliteLocation =
dbPostgresUrl === undefined ? ':memory:' : undefined

const plc = await TestPlc.create(params.plc ?? {})
const pds = await TestPds.create({
dbPostgresUrl,
dbPostgresSchema,
plcUrl: plc.url,
dbPostgresPoolSize: 5,
dholms marked this conversation as resolved.
Show resolved Hide resolved
dbSqliteLocation,
didPlcUrl: plc.url,
...params.pds,
})

Expand Down
5 changes: 3 additions & 2 deletions packages/dev-env/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ export class TestNetwork extends TestNetworkNoAppView {
port: pdsPort,
dbPostgresUrl,
dbPostgresSchema,
plcUrl: plc.url,
bskyAppViewEndpoint: bsky.url,
dbPostgresPoolSize: 5,
didPlcUrl: plc.url,
bskyAppViewUrl: bsky.url,
bskyAppViewDid: bsky.ctx.cfg.serverDid,
...params.pds,
})
Expand Down
Loading