-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Milestone 4 - Voting & Final Publish Flow #162
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
Changes from all commits
2272364
0333221
7c72540
0b37ae7
0880d26
e53f99a
5463a48
6c5059b
13c502f
622e384
5d8dfe2
65b987d
945f026
786f68a
d03d6a7
fe8b72e
05c1039
b0355f9
1a7d6ee
6e251bd
deb6c20
6c80462
5ad891b
0c186f9
af013fe
494bd94
f395336
f8bc462
ec1a510
6b0ed10
ee7b92b
f0dbd9a
2779749
e889229
c78f947
ccd953a
54d1c62
d46953b
e805094
9a9f44c
cc74087
9127a89
be7edc1
b9c3b4b
1f76469
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: db-tests | ||
| on: | ||
| # Manual trigger remains available | ||
| workflow_dispatch: | ||
| # Run weekly for drift detection | ||
| schedule: | ||
| - cron: '0 6 * * 1' # weekly Monday 06:00 UTC | ||
| # Run automatically on PRs when DB‑related files change | ||
| pull_request: | ||
| paths: | ||
| - 'db/**' | ||
| - 'server/rpc.js' | ||
| - 'server/journal.js' | ||
| - 'server/watcher.js' | ||
| - 'server/schemas.js' | ||
| - 'bin/db8.js' | ||
| - 'server/test/**' | ||
| types: [opened, synchronize, reopened] | ||
| jobs: | ||
| db-integration: | ||
| # Avoid duplicate concurrent runs for the same PR/branch | ||
| concurrency: | ||
| group: db-tests-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
| ports: ['5432:5432'] | ||
| env: | ||
| POSTGRES_PASSWORD: test | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_DB: postgres | ||
| # NOTE: Do not include shell line-continuation backslashes here; the | ||
| # options string is passed directly to `docker create`. | ||
| options: >- | ||
| --health-cmd="pg_isready -U postgres" | ||
| --health-interval=10s | ||
| --health-timeout=5s | ||
| --health-retries=5 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - run: npm ci | ||
| - name: Install web dependencies | ||
| run: npm ci --prefix web | ||
| - name: Create test database | ||
| env: | ||
| PGPASSWORD: test | ||
| run: | | ||
| until pg_isready -h localhost -p 5432 -U postgres; do sleep 2; done | ||
| psql -h localhost -U postgres -c 'CREATE DATABASE db8_test;' | ||
| - name: Prepare schema/RPC/RLS | ||
| env: | ||
| DATABASE_URL: postgresql://postgres:test@localhost:5432/db8_test | ||
| DB8_TEST_OUTPUT: quiet | ||
| run: node scripts/prepare-db.js | ||
| - name: Run lint (server/db only) | ||
| run: | | ||
| # Limit lint to non-web paths for this DB-focused job to avoid resolver noise | ||
| npx eslint server bin scripts eslint.config.js vitest.config.js | ||
| - name: Run DB-gated tests (glob) | ||
| env: | ||
| DB8_TEST_PG: '1' | ||
| DB8_TEST_DATABASE_URL: postgresql://postgres:test@localhost:5432/db8_test | ||
| run: | | ||
| npx vitest run "server/test/**/*.db.*.js" server/test/journal.byidx.test.js --reporter verbose | ||
|
Comment on lines
+64
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify glob pattern matching and check additional file
echo "=== Files matching *.db.*.js pattern in server/test/ ==="
fd -e js -t f "\.db\..*\.js$" server/test/ 2>/dev/null || echo "No matches found"
echo ""
echo "=== Checking for journal.byidx.test.js ==="
if [ -f "server/test/journal.byidx.test.js" ]; then
echo "Found: server/test/journal.byidx.test.js"
head -5 server/test/journal.byidx.test.js
else
echo "NOT FOUND: server/test/journal.byidx.test.js"
fi
echo ""
echo "=== All .test.js files in server/test/ (first 20) ==="
fd -e js -t f "\.test\.js$" server/test/ | head -20
echo ""
echo "=== Check if any other DB-related test files exist ==="
fd -e js -t f "db" server/test/ | head -20Repository: flyingrobots/db8 Length of output: 1593 Naming convention inconsistency: The glob pattern 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ web/.next/ | |
|
|
||
| # generated assets or external | ||
| public/ | ||
| docs/debates/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, check the full content of .markdownlintignore to understand the pattern
cat -n .markdownlintignoreRepository: flyingrobots/db8 Length of output: 242 🏁 Script executed: # Check if docs/debates/ directory exists and what files are in it
find docs/debates -type f 2>/dev/null | head -20Repository: flyingrobots/db8 Length of output: 1501 🏁 Script executed: # Check the overall docs structure to understand the pattern
ls -la docs/ 2>/dev/null || echo "docs directory not found"Repository: flyingrobots/db8 Length of output: 1556 🏁 Script executed: # Search for any markdown files in docs/debates
find . -path "*/docs/debates/*.md" 2>/dev/nullRepository: flyingrobots/db8 Length of output: 2554 🏁 Script executed: # Check git history or any comments about why this is being added
git log --oneline -n 20 -- .markdownlintignore 2>/dev/null | head -10Repository: flyingrobots/db8 Length of output: 109 🏁 Script executed: # Check a sample file to see if it already has frontmatter and understand its nature
head -20 docs/debates/fixed-timestep-vs-event-driven/debate-setup.mdRepository: flyingrobots/db8 Length of output: 1101 🏁 Script executed: # Check another sample to confirm the pattern
head -20 docs/debates/fixed-timestep-vs-event-driven/opening-statements/expert-001.mdRepository: flyingrobots/db8 Length of output: 794 🏁 Script executed: # Look for any markers indicating auto-generation or external source
grep -r "generated\|auto\|automated\|external" docs/debates/ 2>/dev/null | head -10Repository: flyingrobots/db8 Length of output: 1994 🏁 Script executed: # Check if there's a script or build process that generates these files
find . -name "*.py" -o -name "*.js" -o -name "*.sh" | xargs grep -l "debates" 2>/dev/null | head -5Repository: flyingrobots/db8 Length of output: 42 Bypass of frontmatter requirements without legitimate cause. Files in Either add proper frontmatter to these files and keep them under linting enforcement, or explicitly document why this directory is exempt from repository documentation standards. 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bypass vulnerability: Text-based merge detection is trivially circumventable and incomplete.
This implementation has critical flaws:
Security bypass: Any developer can write a manual commit message starting with "Merge branch" to skip Conventional Commits validation entirely. If this hook exists to enforce policy, it's now opt-in.
Incomplete pattern: The regex misses legitimate Git-generated merge messages:
Merge tag 'v1.0'Merge commit 'abc123'Design flaw acknowledged in comments: Line 7's comment admits "checking the message content rather than repository state"—but that's precisely the vulnerability. Merge commits have multiple parents; checking repository state is the correct, unforgeable approach.
🔎 Proposed fix: Check actual merge state, not message text
This checks if the current commit actually has multiple parents (true merge) rather than trusting user-supplied text. Note: This won't work for the initial merge commit before it exists; you may need to check
git rev-parse --verify MERGE_HEADas a fallback during merge-in-progress state.🤖 Prompt for AI Agents