Skip to content

Sprint 2 batch 1: graceful shutdown + CI/security workflows#121

Merged
keysersoft merged 2 commits into
mainfrom
keysersoft/shutdown-ci
May 3, 2026
Merged

Sprint 2 batch 1: graceful shutdown + CI/security workflows#121
keysersoft merged 2 commits into
mainfrom
keysersoft/shutdown-ci

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Summary

Foundation work from Sprint 2: shutdown hygiene + a working CI gate + security scanning, none of which the codebase had before.

Graceful shutdown

`main.ts` now calls `app.enableShutdownHooks()` and registers SIGTERM/SIGINT handlers so in-flight requests drain and Prisma / Redis disconnect cleanly when the platform restarts the container. `server.keepAliveTimeout` / `headersTimeout` set to the standard "behind a load balancer" values.

CI fixes

The existing workflow had `working-directory: anythingmcp` (residue from when this lived inside a larger monorepo) and only triggered on `workflow_dispatch` — so it had effectively never run on PR. Fixed:

  • triggers on `push` to main and on every PR
  • backend pipeline: lint, `tsc --noEmit`, jest, build (in that order)
  • frontend pipeline: lint, `tsc --noEmit`, build
  • docker build still runs only on `push` to main

ESLint configs

Both `packages/*/package.json` had `eslint` listed but no `eslint.config.mjs`, so `npm run lint` was crashing. Added flat configs:

  • backend: typescript-eslint recommended; `no-explicit-any` and a few empty-type rules disabled while the historic codebase is gradually tightened
  • frontend: `eslint-config-next` 16 flat exports (`core-web-vitals` + `typescript`); two pre-existing rule classes (`set-state-in-effect`, `no-html-link-for-pages`) downgraded to warnings — 7 call sites, dedicated cleanup sprint

Local: backend lint passes (0 errors, 11 warnings), frontend lint passes (0 errors, 23 warnings).

Security scanning

  • `codeql.yml`: `security-and-quality` query suite on push, PR, and weekly cron
  • `trivy.yml`: filesystem scan on PR (vuln + misconfig) + Docker image scan on main; SARIF uploaded to the Security tab

Test plan

  • `tsc --noEmit` clean
  • backend jest: 5 pre-existing failures, no new ones
  • backend + frontend lint pass with no errors
  • CI runs on this PR (this is what proves the fix)

keysersoft added 2 commits May 3, 2026 13:09
main.ts now wires app.enableShutdownHooks plus SIGTERM/SIGINT handlers so
in-flight tool invocations drain and Prisma/Redis disconnect cleanly when
the platform restarts the container. Tweaks keepAlive/headersTimeout to
the standard "behind-an-LB" values.

CI was previously workflow_dispatch-only and pointed at a non-existent
working-directory: anythingmcp (residue from a former monorepo layout).
Fixed: now runs on push and pull_request, drops the bogus working dir,
and adds backend+frontend lint and tsc --noEmit gates.

Both packages had eslint listed but no eslint.config.mjs, so the lint
script was crashing. Added minimal flat configs:
  - backend: typescript-eslint recommended, with the noisier rules off
    while we still have historic any usage to clean up.
  - frontend: eslint-config-next 16 flat exports (core-web-vitals +
    typescript), with set-state-in-effect / no-html-link-for-pages
    downgraded to warnings (7 pre-existing call sites, separate sprint).

Two new workflows: CodeQL on push/PR/weekly, and Trivy with both a
filesystem scan (PR-blocking) and a Docker image scan (main only). Both
upload SARIF to the Security tab.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@keysersoft
keysersoft merged commit c4f238b into main May 3, 2026
7 of 8 checks passed
@keysersoft
keysersoft deleted the keysersoft/shutdown-ci branch May 12, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants