# Development, Verification, and Release Workflows

## Local Development

```powershell
npm install
npm run dev
```

This runs:

- Vite renderer dev server on `http://localhost:3006`
- Electron app pointed at that dev server

The app uses `MemoryRouter`, so browser URL routing behavior does not match a normal web app.

## Build Verification

Renderer build:

```powershell
npm run build
```

Electron main/preload bundle:

```powershell
npm run build:electron
```

Run both for most cross-process changes.

Known existing build warnings:

- A warning around `true || j.close_date` in `src/components/pages/admin/admin.page.jsx`.
- Vite chunk-size warnings for large bundles.

Do not treat those as newly introduced unless your change touches them.

## Packaging Check

Use:

```powershell
npm run pack
```

This runs:

```text
electron-builder --dir --publish never --config electron-builder.pack-check.cjs
```

It is the preferred "does it package?" check because it avoids publishing.

## Publishing

Publishing is configured through electron-builder S3 settings in `package.json`. The updater checks periodically.

Do not run publishing scripts unless explicitly requested:

- `npm run distp`
- Any direct `electron-builder --publish always`

If asked to release:

1. Confirm the version in `package.json`.
2. Run `npm run build`.
3. Run `npm run build:electron`.
4. Run a no-publish package check first.
5. Only then run the requested publish command.

## Auto Updates

Main process:

- Uses `electron-updater`.
- `autoUpdater.autoDownload = true`.
- Checks every 30 minutes after app ready.
- Sends update events/progress to renderer through IPC.
- Renderer `UpdateManagerOrganism` handles UI.

Release notes:

- Stored in `electron/changelog.json`.
- Main process reads `require("./changelog.json")[app.getVersion()]`.
- Store key `showChangeLog` controls initial display.

## Hasura

Hasura config and migrations live under `hasura/`.

Be careful with migrations:

- Current migrations are under `hasura/migrations/default/`.
- `hasura/migrations_backup/` is historical backup material.
- Metadata under `hasura/metadata/` should match Hasura's generated layout.

When changing GraphQL queries, verify the Hasura metadata/schema supports selected fields.

## Sentry Source Maps

Script:

```powershell
npm run sentry:sourcemaps
```

Requires a valid `.sentryclirc`/token and should only be run when intentionally uploading source maps.

## Troubleshooting

Electron backend console DevTools noise:

- `Autofill.enable` and `Autofill.setAddresses` errors are Chromium DevTools protocol noise.
- They can appear when Chrome DevTools or React DevTools are open.

Electron circular dependency warning:

- Do not import `mainWindow` from `main-src.js` in other Electron modules.
- Use `BrowserWindow.fromWebContents(event.sender)` for dialogs.

AntD theme/static feedback warning:

- Use `antdMessage`/`antdNotification` from `src/util/antdFeedback.js`.
- Ensure `AntdFeedbackBridge` is mounted inside AntD `<App>`.

Apollo cache replacement warning:

- Confirm field policies in `GraphQLClient.js`.
- Add/adjust merge policies for newly paginated fields.

Search pagination crash:

- Guard `prev?.search_jobs` and `fetchMoreResult?.search_jobs` before spreading.

Git ignore of generated files:

- `.gitignore` includes `/dist-electron/`.
- If generated files still show in status, they are probably already tracked; remove from index with `git rm --cached -r dist-electron` after confirming the local files can stay.

