Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Summary

-

## Verification

- [ ] `npm run verify:cheap`
- [ ] `npm run verify:ui` when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
- [ ] `npm run verify:release` before release or handoff confidence claims
- [ ] `npm run format:check`
- [ ] `npm run check:production-readiness` when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed

## Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

- [ ] Source-backed claims still require linked source verification before clinical use
- [ ] No patient-identifiable document workflow was introduced or expanded without explicit governance approval
- [ ] Supabase target remains `Clinical KB Database` (`sjrfecxgysukkwxsowpy`)
- [ ] Service-role keys and private document access remain server-only
- [ ] Demo/synthetic content remains clearly separated from real clinical sources
- [ ] Source metadata, review status, and outdated/unknown-source behavior remain conservative
- [ ] Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

## Notes

-
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Production readiness (CI-safe)
run: npm run check:production-readiness:ci

- name: Lint
run: npm run lint

Expand All @@ -38,3 +41,9 @@ jobs:

- name: Build
run: npm run build

- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium

- name: Chromium UI smoke
run: npm run test:e2e:chromium
94 changes: 47 additions & 47 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ name: "CodeQL Advanced"

on:
push:
branches: [ "main", "protection" ]
branches: ["main", "protection"]
pull_request:
branches: [ "main", "protection" ]
branches: ["main", "protection"]
schedule:
- cron: '20 12 * * 2'
- cron: "20 12 * * 2"
workflow_dispatch:

jobs:
Expand All @@ -44,12 +44,12 @@ jobs:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
- language: actions
build-mode: none
- language: javascript-typescript
build-mode: none
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
Expand All @@ -59,46 +59,46 @@ jobs:
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1
# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: Run manual build steps
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: Run manual build steps
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ sample-documents/
dev-server*.log
package-lock.json
public/demo-documents/
.tmp-visual/
scratch/
13 changes: 13 additions & 0 deletions .tmp-visual/capture.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { chromium } from 'playwright';

(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1200 } });
await page.goto('http://localhost:4298', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'C:/Dev/Apps/Database/.tmp-visual/desktop-home.png', fullPage: true });

await page.setViewportSize({ width: 390, height: 844 });
await page.goto('http://localhost:4298', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'C:/Dev/Apps/Database/.tmp-visual/mobile-home.png', fullPage: true });
await browser.close();
})();
53 changes: 53 additions & 0 deletions .tmp-visual/check-search-api.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { chromium } from 'playwright';

(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1200 } });
const events = [];
page.on('response', async (resp) => {
const url = resp.url();
if (url.includes('/api/')) {
try {
const text = await resp.text();
events.push({
url,
status: resp.status(),
ok: resp.ok(),
text: text.slice(0, 220),
});
} catch {
events.push({
url,
status: resp.status(),
ok: resp.ok(),
text: '',
});
}
}
});

await page.goto('http://localhost:4298', { waitUntil: 'networkidle' });
const input = page.locator('input[placeholder="Ask a question"]');
await input.fill('What monitoring is required after starting lithium?');

const askButton = page.locator('button[aria-label="Generate source-backed answer"]').first();
await askButton.click();

await page.waitForTimeout(12000);
await page.waitForLoadState('networkidle');

const state = await page.evaluate(() => ({
body: (document.body.innerText || '').replace(/\s+/g, ' ').slice(0, 2200),
statusLine: document.querySelector('.text-sm, p, h2, h3')?.textContent || '',
hasResultsText: (document.body.innerText || '').includes('Retrieved passages appear after a question') || false,
headingText: Array.from(document.querySelectorAll('h2, h3')).map((el) => (el.textContent || '').trim()),
ctaText: Array.from(document.querySelectorAll('button, a')).map((el) => (el.textContent || '').trim()).filter((t) => /Open source|Source PDF|Add scope|Ask|Search|Citations|Sources|Gaps|Verify/.test(t)),
}));

await browser.close();

console.log('RESULTS:' + JSON.stringify({
api: events.filter((e) => e.url.includes('/api/search') || e.url.includes('/api/tools') || e.url.includes('/api/documents') || e.url.includes('/api/local-project-id')),
state,
}, null, 2));
})();
Binary file added .tmp-visual/desktop-home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .tmp-visual/final-query-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .tmp-visual/final-query-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions .tmp-visual/inspect-ask-controls.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { chromium } from 'playwright';

(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto('http://localhost:4298', { waitUntil: 'domcontentloaded' });

const input = page.locator('input[placeholder="Ask a question"]');
await input.waitFor({ state: 'attached', timeout: 12000 });

const controls = await page.evaluate(() => {
const inp = Array.from(document.querySelectorAll('input')).find((el) => el.getAttribute('placeholder') === 'Ask a question');
if (!inp) return null;
const form = inp.closest('form');
const allButtons = Array.from(document.querySelectorAll('button, input[type="submit"]')).map((el) => ({
text: (el.textContent || '').trim(),
type: el.getAttribute('type') || (el.tagName === 'BUTTON' ? 'button' : ''),
value: el.getAttribute('value') || '',
aria: el.getAttribute('aria-label') || '',
id: el.id || '',
}));
const formButtons = form ? Array.from(form.querySelectorAll('button, input[type="submit"]')).map((el) => ({
text: (el.textContent || '').trim(),
type: el.getAttribute('type') || (el.tagName === 'BUTTON' ? 'button' : ''),
value: el.getAttribute('value') || '',
aria: el.getAttribute('aria-label') || '',
id: el.id || '',
})) : [];

return {
inputCount: document.querySelectorAll('input[placeholder="Ask a question"]').length,
inputOuterHTML: inp.outerHTML.slice(0, 400),
formAction: form ? form.getAttribute('action') : null,
formMethod: form ? form.getAttribute('method') : null,
formButtons,
allButtons: allButtons.slice(0, 80),
};
});

console.log(JSON.stringify(controls, null, 2));
await browser.close();
})();
41 changes: 41 additions & 0 deletions .tmp-visual/inspect-home.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { chromium } from 'playwright';

(async () => {
const page = await chromium.launch({ headless: true }).then(async (browser) => {

Check warning on line 4 in .tmp-visual/inspect-home.mjs

View workflow job for this annotation

GitHub Actions / verify

'page' is assigned a value but never used

Check warning on line 4 in .tmp-visual/inspect-home.mjs

View workflow job for this annotation

GitHub Actions / verify

'page' is assigned a value but never used
const p = await browser.newPage();
await p.goto('http://localhost:4298', { waitUntil: 'networkidle' });
const body = await p.evaluate(() => document.body.innerText || '');
const links = await p.evaluate(() => {
return Array.from(document.querySelectorAll('a')).map((a) => ({
text: (a.textContent || '').trim(),
href: a.getAttribute('href') || '',
})).filter((x) => x.text || x.href);
});

const buttons = await p.evaluate(() => {
return Array.from(document.querySelectorAll('button')).map((b) => ({
text: (b.textContent || '').trim(),
type: b.getAttribute('type') || '',
}));
});

const inputs = await p.evaluate(() => Array.from(document.querySelectorAll('input, textarea')).map((el) => ({
tag: el.tagName,
type: el.getAttribute('type') || '',
placeholder: el.getAttribute('placeholder') || '',
id: el.id || '',
name: el.getAttribute('name') || '',
})));

console.log('TITLE:' + (await p.title()));
console.log('URL:' + p.url());
console.log('HREFS:' + JSON.stringify(links.slice(0, 80), null, 2));
console.log('BUTTONS:' + JSON.stringify(buttons.slice(0, 80), null, 2));
console.log('INPUTS:' + JSON.stringify(inputs, null, 2));
console.log('TEXT_SNIPPET_START');
console.log(body.slice(0, 1200));
console.log('TEXT_SNIPPET_END');

await browser.close();
});
})();
Binary file added .tmp-visual/mobile-home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .tmp-visual/query-answer-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .tmp-visual/query-answer-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions .tmp-visual/query-answer-stream.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { chromium } from "playwright";

(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1200 } });

let reqPayload = null;
let respSnippet = null;

page.on('request', (req) => {
if (req.url().includes('/api/answer/stream')) {
reqPayload = {
method: req.method(),
postData: req.postData(),
};
}
});

page.on('response', async (resp) => {
if (resp.url().includes('/api/answer/stream')) {
try {
respSnippet = await resp.text();
} catch (error) {

Check warning on line 23 in .tmp-visual/query-answer-stream.mjs

View workflow job for this annotation

GitHub Actions / verify

'error' is defined but never used

Check warning on line 23 in .tmp-visual/query-answer-stream.mjs

View workflow job for this annotation

GitHub Actions / verify

'error' is defined but never used
respSnippet = "read-failed";
}
}
});

await page.goto('http://localhost:4298', { waitUntil: 'networkidle' });
await page.fill('input[placeholder="Ask a question"]', 'What monitoring is required after starting lithium?');
await page.locator('button[aria-label="Generate source-backed answer"]').click();
await page.waitForTimeout(5000);

const statusText = await page.evaluate(() => (document.body.innerText || '').replace(/\s+/g, ' '));

await page.screenshot({ path: 'C:/Dev/Apps/Database/.tmp-visual/query-stream-desktop.png', fullPage: true });
await browser.close();

console.log('RESULTS:' + JSON.stringify({
request: reqPayload,
responseSnippet: (respSnippet || '').slice(0, 1200),
statusText: statusText.slice(0, 2200),
hasNoDataMarkers: {
noPassages: statusText.includes('Retrieved passages appear after a question'),
searching: statusText.includes('Searching indexed documents'),
notReady: statusText.includes('Search setup is not ready') || statusText.includes('setup is not ready')
}
}, null, 2));
})();
Loading
Loading