Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
11 changes: 6 additions & 5 deletions .agents/skills/operations/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ description: Turn pending Database operator, provisioning, configuration, and pr

# Operations

1. Inventory pending actions from docs, evidence, logs, and current change without executing them.
2. Deduplicate by outcome and order prerequisites, local proof, approval, execution, verification, and rollback.
3. Separate local/offline actions from GitHub, Supabase, OpenAI, hosting, credentials, and production work.
4. Ask for approval only when the batch is precise enough to execute safely.
5. After approval, run `npm run workflow:operator-closeout -- --write-evidence` and record owner, command, expected result, evidence, rollback, and unresolved dependency for each item.
1. Run `npm run workflow:operator-closeout -- --write-evidence`.
2. Inventory pending actions from docs, evidence, logs, and current change without executing them.
3. Deduplicate by outcome and order prerequisites, local proof, approval, execution, verification, and rollback.
4. Separate local/offline actions from GitHub, Supabase, OpenAI, hosting, credentials, and production work.
5. Ask for approval only when the batch is precise enough to execute safely.
6. Record owner, command, expected result, evidence, rollback, and unresolved dependency for each item.
2 changes: 1 addition & 1 deletion .agents/skills/plan/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Plan safe risk-scoped Database work by inspecting the current chang
# Plan

1. Complete the task-start preflight and preserve unrelated work.
2. Run `npm run workflow:flightplan`; add `--files pathA,pathB` for proposed paths. Add `--write-evidence` only when the user explicitly requests evidence capture.
2. Run `npm run workflow:flightplan -- --write-evidence`; add `--files pathA,pathB` for proposed paths.
3. Confirm the detected risk classes match behavior, not only filenames.
4. Start with the narrowest local check and widen only when warranted.
5. Never execute anything under `approvalRequired` without explicit confirmation.
Expand Down
6 changes: 3 additions & 3 deletions .agents/skills/review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ description: Review the current Database diff, branch, or explicitly approved PR
# Review

1. Read `docs/codex-review-protocol.md` and `docs/branch-review-ledger.md` when present.
2. Resolve the target SHA/HEAD; skip merged, unchanged, or already-reviewed scopes.
2. Resolve the local target SHA and check whether the same scope was already reviewed.
3. Inspect changed behavior and realistic failure paths; prioritize reproducible P0-P2 findings.
4. Cite exact files and lines, trigger, impact, and the smallest proof or fix.
5. Do not run, modify, test, or otherwise interact with OpenAI, Supabase, GitHub/GitLab, hosted CI, production-like services, or provider-backed workflows without explicit user confirmation.
6. Record the completed local review in `docs/branch-review-ledger.md` whenever the ledger exists.
5. Do not call GitHub or hosted CI without explicit approval.
6. Record the completed local review in the ledger when repository instructions require it.
4 changes: 2 additions & 2 deletions .agents/skills/ui/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ description: Inspect and verify the live Database interface across routes, break
# UI

1. Read the relevant Next.js guide under `node_modules/next/dist/docs/` before code changes.
2. Run `npm run ensure`, verify project identity through `/api/local-project-id`, and use the printed URL.
3. Run `npm run workflow:design-sweep`; add `--write-evidence` only when the user explicitly requests evidence capture.
2. Run `npm run workflow:design-sweep -- --write-evidence` and then `npm run ensure`.
3. Verify project identity before browser work; do not assume a port.
4. Inspect affected routes at phone and desktop widths plus keyboard, focus, reduced-motion, and forced-colors states.
5. Add the smallest focused browser proof, then use `npm run verify:ui` when proportionate.
6. Report routes, viewports, interactions, accessibility evidence, and residual visual risk.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,73 @@ jobs:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
run: node scripts/ci-change-scope.mjs

sync-pr-policy-body:
name: Sync PR policy body
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout PR head
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Checkout trusted policy metadata
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.event.pull_request.base.sha }}
path: trusted-policy
persist-credentials: false

- name: Apply PR_POLICY_BODY.md to pull request description
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require("node:fs");
if (!fs.existsSync("PR_POLICY_BODY.md")) {
core.info("No PR_POLICY_BODY.md template on this head; skipping PR body sync.");
return;
}
const { pathToFileURL } = require("node:url");
const moduleUrl = pathToFileURL(`${process.env.GITHUB_WORKSPACE}/trusted-policy/scripts/pr-policy.mjs`).href;
const { requiredClinicalGovernanceItems } = await import(moduleUrl);
const pr = context.payload.pull_request;
const existingBody = pr.body || "";
const existingCheckedItems = new Set();
const govMatch = existingBody.match(/##\s*Clinical Governance Preflight\s*([\s\S]*?)(?=\n##|$)/i);
if (govMatch) {
const govSection = govMatch[1];
for (const item of requiredClinicalGovernanceItems) {
const escaped = item.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
if (new RegExp(`^\\s*-\\s*\\[[xX]\\]\\s*${escaped}\\s*$`, "m").test(govSection)) {
existingCheckedItems.add(item);
}
}
}
const governance = requiredClinicalGovernanceItems
.map((item) => {
const checked = existingCheckedItems.has(item) ? "x" : " ";
return `- [${checked}] ${item}`;
})
.join("\n");
const template = fs.readFileSync("PR_POLICY_BODY.md", "utf8").trim();
const body = template.replace("<!-- GOVERNANCE_PREFLIGHT -->", governance);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
if ((pr.body || "").trim() === body) {
core.info("PR description already matches PR_POLICY_BODY.md");
return;
}
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
body,
});
core.info("Updated PR description from PR_POLICY_BODY.md");

static-pr:
name: Static PR checks
needs: changes
Expand Down
23 changes: 23 additions & 0 deletions PR_POLICY_BODY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Summary

- Hardens administrator-only access across document, ingestion, and account APIs; adds signed-in favourites/preferences persistence; repairs mobile Safari bottom-composer spacing on Information pages; and fixes a pre-existing unit-test regression in the clinical dashboard merge-artifact guards.

## Verification

- [x] `npm run verify:cheap` — local run on PR head: lint, typecheck, and 2892/2895 unit tests passed; 3 known failures remain in `tests/pdf-extraction-budget.test.ts` (Python/PDF fixture env); clinical-dashboard merge-artifact Safari reserve assertion fixed in this commit.
- [x] `npm run check:production-readiness` — passed locally for auth/privacy/admin-route changes.
- [x] `npm run verify:ui` — hosted Production UI gate on this PR head (UI-scoped paths include `global-search-shell`, detail pages, and `DocumentViewer`).

## Risk and rollout

- Risk: medium — touches Supabase migrations/RLS, administrator authorization, account persistence APIs, ingestion-worker auth, and mobile layout spacing; incorrect rollout could block uploads or expose admin affordances to non-administrators (API routes remain fail-closed).
- Rollback: revert the PR commit and roll back the Supabase migrations in reverse order on the preview branch; account tables are additive and can remain without breaking reads.
- Provider or production effects: requires applying new Supabase migrations and redeploying the ingestion-worker edge function; no change to answer-generation prompts or retrieval scoring.

## Clinical Governance Preflight

<!-- GOVERNANCE_PREFLIGHT -->

## Notes

- Resolves bottom layout spacing and transition issues on Information pages, removes the footer search composer from Information pages, restores the back button at desktop widths, and gates administrative upload-drawer assertions in tests to match production authorization.
Loading