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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm rebuild better-sqlite3
- run: pnpm -r typecheck
- run: pnpm test

desktop:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Performance Review Manager — a local, single-user ("solo EM") pnpm monorepo. S
- `.session` stores the auth token only (not the AES key). After an API process restart you must unlock again even if the UI still has a token.

### Known pre-existing issues (not environment problems)
- `pnpm build` (production) and `pnpm -r typecheck` may still fail on residual TypeScript strictness issues in the UI/API; Dev servers (`tsx`/`vite`) run fine because they do not strict-typecheck.
- `pnpm build` (production) may still fail on residual packaging issues; prefer `pnpm -r typecheck` + `pnpm test` as the merge gate. Dev servers (`tsx`/`vite`) run fine because they do not strict-typecheck.
- Core loop evaluation & capture gaps: `docs/CORE_LOOP_EVAL.md`.

### Cursor MCP (`@prm/mcp`)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Product context lives under `docs/`. Cloud-agent notes: `AGENTS.md`.
## Before you open a PR

1. Keep diffs surgical — touch only what the change needs
2. Run `pnpm test` (API unit tests; this is what CI gates on `main`)
2. Run `pnpm -r typecheck` and `pnpm test` (CI gates both on `main`)
3. For API behavior changes, add or extend tests under `apps/api/src/*.test.ts`
4. Do not commit `data/`, `.env`, secrets, or real PII
5. Align docs with shipped behavior (prefer honesty over aspirational claims)

`pnpm -r typecheck` / production `pnpm build` may still fail on residual strictness issues; prefer fixing types you touch rather than widening `any`.
Production `pnpm build` may still have packaging rough edges; typecheck + tests are the merge bar.

## Desktop

Expand Down
21 changes: 13 additions & 8 deletions apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import type {
IntegrationSyncResult,
PersonExternalLinkDTO,
TeamPerformanceDTO,
ReviewDTO,
} from "@prm/shared";
import { COMPETENCY_CATALOG, MIDDLE_BAND, competencyLabel } from "@prm/shared";
import { seedWorkspace } from "./seed.js";
Expand Down Expand Up @@ -1395,10 +1396,10 @@ app.get("/api/packets/:cycleId/:personId", (c) => {
const currentRole = loadRole(participant?.roleDefinitionId ?? a?.roleDefinitionId);
const nextRole = loadRole(participant?.targetNextRoleDefinitionId ?? a?.targetNextRoleDefinitionId);
const revs = db.select().from(reviews).where(and(eq(reviews.cycleId, cycleId), eq(reviews.subjectPersonId, personId))).all();
const mapRev = (r: typeof reviews.$inferSelect) => ({
const mapRev = (r: typeof reviews.$inferSelect): ReviewDTO => ({
id: r.id,
type: r.type as PacketDTO["selfReview"] extends infer T ? NonNullable<T>["type"] : never,
status: r.status as PacketDTO["managerReview"] extends infer T ? NonNullable<T>["status"] : never,
type: r.type as ReviewDTO["type"],
status: r.status as ReviewDTO["status"],
subjectPersonId: r.subjectPersonId,
authorName: r.authorName,
payload: JSON.parse(r.payloadJson) as Record<string, unknown>,
Expand Down Expand Up @@ -4375,15 +4376,14 @@ app.post("/api/exports/readonly-bundle", async (c) => {
};

if (include.has("director_briefing")) {
parts.directorBriefing = buildDirectorBriefing(db, {
const briefing = buildDirectorBriefing(db, {
cycleId: cycle.id,
personId: body.personId,
loadRole,
assignmentFor,
});
parts.directorBriefingHtml = parts.directorBriefing
? renderDirectorBriefingHtml(parts.directorBriefing as NonNullable<typeof parts.directorBriefing>)
: null;
parts.directorBriefing = briefing;
parts.directorBriefingHtml = briefing ? renderDirectorBriefingHtml(briefing) : null;
}
if (include.has("calib_room")) {
// Reuse JSON shape from calib-room endpoint logic via briefing distribution + consistency-like cards
Expand Down Expand Up @@ -4429,7 +4429,12 @@ app.post("/api/exports/readonly-bundle", async (c) => {

registerP1Routes(app, {
loadRole,
assignmentFor,
assignmentFor: (personId) => {
const a = assignmentFor(personId);
return a
? { roleDefinitionId: a.roleDefinitionId, frameworkVersionId: a.frameworkVersionId }
: null;
},
getPublishedVersion: () => {
const v = getPublishedVersion();
if (!v) return null;
Expand Down
7 changes: 6 additions & 1 deletion apps/api/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,12 @@ export function checksum(payload: string | Buffer) {
return createHash("sha256").update(payload).digest("hex");
}

export function logActivity(action: string, entityType?: string, entityId?: string, detail: Record<string, unknown> = {}) {
export function logActivity(
action: string,
entityType?: string | null,
entityId?: string | null,
detail: Record<string, unknown> = {},
) {
const db = getDb();
const ws = db.select().from(workspace).limit(1).all()[0];
const prevHash = ws?.lastActivityHash ?? "genesis";
Expand Down