ReviewOS

also looking at this

reviewos/reviewos.org

fix: allow runtime arenas within a finite runner address budget

#7
Merged chris wants to merge codex/runner-virtual-address-budget into main
13 files +298 -12

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

app/Actions/Feed/read.tsmodified+1-0
Changes to app/Actions/Feed/read.ts
@@ -1,3 +1,4 @@
1import { db } from '@stacksjs/database'
12import { describeEntry } from '../../Activity/verbs'
23
34/**
docs/todo/06-search-explore.mdmodified+4-0
Changes to docs/todo/06-search-explore.md
@@ -71,6 +71,10 @@ because that is what actually listens.
7171 hide.
7272- [x] A Discover feed of public activity, with trending and recently active repositories beside it
7373
74 The shared feed reader imports its database binding explicitly, so static rendering does not
75 depend on application preloader globals. A fresh-process regression uses a local adapter
76 fixture without a database service; normal preview CI also renders against migrated Postgres.
77
7478 The event's recorded visibility and the repository's current visibility both
7579 matter. The first stops a repository made public today from exposing events
7680 written while it was private. The second stops a repository made private
tests/unit/feed-database-binding.test.tsadded+44-0
Changes to tests/unit/feed-database-binding.test.ts
@@ -0,0 +1,44 @@
1import { expect, test } from 'bun:test'
2import { fileURLToPath } from 'node:url'
3
4// The app preloader supplies db to ordinary requests. SSG imports the same
5// reader without that preloader, so test its dependency in a fresh process.
6// The adapter fixture performs no real database access or service startup.
7test('the feed reader owns its database binding without application globals', async () => {
8 const program = `
9 const assert = require('node:assert/strict')
10 const { mock } = require('bun:test')
11 assert.equal(typeof globalThis.db, 'undefined')
12 let reads = 0
13 const query = {
14 innerJoin() { return this },
15 select() { return this },
16 where() { return this },
17 orderBy() { return this },
18 limit() { return this },
19 async execute() { return [] },
20 }
21 mock.module('@stacksjs/database', () => ({
22 db: { selectFrom() { reads++; return query } },
23 }))
24 const { discoverFeed } = await import('./app/Actions/Feed/read.ts')
25 assert.deepEqual(await discoverFeed(), { entries: [], cursor: null })
26 assert.equal(reads, 1)
27 assert.equal(typeof globalThis.db, 'undefined')
28 console.log('feed database dependency resolved without globals')
29 `
30 const child = Bun.spawn([process.execPath, '--no-env-file', '--config=/dev/null', '-e', program], {
31 cwd: fileURLToPath(new URL('../..', import.meta.url)),
32 env: { PATH: process.env.PATH },
33 stdout: 'pipe',
34 stderr: 'pipe',
35 signal: AbortSignal.timeout(5_000),
36 })
37 const [output, error, code] = await Promise.all([
38 new Response(child.stdout).text(),
39 new Response(child.stderr).text(),
40 child.exited,
41 ])
42 expect({ code, error }).toEqual({ code: 0, error: '' })
43 expect(output.trim()).toBe('feed database dependency resolved without globals')
44}, 10_000)