Skip to content

Implement improvements for graceful shutdown, error handling, and session limits#22

Merged
johnwmail merged 8 commits intomainfrom
feature/improvement
Apr 28, 2026
Merged

Implement improvements for graceful shutdown, error handling, and session limits#22
johnwmail merged 8 commits intomainfrom
feature/improvement

Conversation

@johnwmail
Copy link
Copy Markdown
Owner

Description

Related Issue

Fixes # (issue)

Motivation and Context

How Has This Been Tested?

  • Backend tests pass: go test ./...
  • Frontend tests pass: cd frontend && npm test
  • Linting passes: make lint
  • Manual testing completed

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • No hardcoded secrets or credentials in code

sysmgr and others added 8 commits April 17, 2026 04:11
- Add graceful shutdown with signal handling in main.go
- Add structured APIError type in srv/errors.go
- Add database indexes for query performance (migration 004)
- Add CloseDB method to Server for clean shutdown
- Add jsonAPIErr helper for typed error responses
- Add aria-label to password/notes toggle buttons for accessibility
- Add aria-label to OTP display toggle button
- Add srv/errors_test.go for APIError type unit tests
- Update IMPROVEMENT.md progress
- Add login_time and last_activity columns to users table
- Hard limit: 30 min (configurable via SESSION_DURATION_MINUTES)
- Soft limit: 5 min (browser close detection)
- Session limits checked on each authenticated request
- Updated config display to show hard/soft limits
- Add SESSION_SOFTLIMIT_MINUTES env var (default: 5, range: 1-60)
- Rename SESSION_DURATION_MINUTES to SESSION_HARDLIMIT_MINUTES
- Rename internal variable sessionDuration to hardLimit
- Update all documentation to reflect new env var names
Store .gpg-id in users.gpg_id (single source of truth):
- Add gpg_id column to users table via migration 006-users-gpg-id.sql
- Auto-initialize gpg_id to fingerprint on account creation
- Push: write .gpg-id from users.gpg_id (fallback to fingerprint)
- Pull: update users.gpg_id from remote .gpg-id if present
- Backfill existing accounts with fingerprint as default

Also add frontend unit tests:
- crypto.test.ts: 26 tests for PGP key ops, AES-GCM, base64, PAT encrypt
- storage.test.ts: 20 tests for IndexedDB CRUD, AES encrypt/decrypt
- Fix api.test.ts: add explicit vitest imports and document mock

Install fake-indexeddb dev dependency for IndexedDB testing in jsdom.
- Switch vitest environment from jsdom to node to fix openpgp.js
  concatUint8Array error caused by cross-realm Uint8Array in jsdom
- Remove unused jsonAPIErr function to fix golangci-lint unused error
@johnwmail johnwmail merged commit 8c68423 into main Apr 28, 2026
4 checks passed
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.

1 participant