Renames the unused catch error variable `e` to `_` in `test/playwright/dashboard.spec.js` to satisfy the ESLint `no-unused-vars` rule. This fixes the CI failure.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added `@playwright/test` and `c8` dependencies.
- Configured Playwright in `playwright.config.js` to run the dashboard server.
- Added `test/playwright/dashboard.spec.js` to verify dashboard functionality (loading, auth, config) and capture console logs.
- Modified `src/dashboard.mjs` to support graceful shutdown via `/shutdown` endpoint (guarded by `NODE_V8_COVERAGE`) for coverage collection.
- Updated `package.json` with `test:playwright` and `test:playwright:coverage` scripts.
- Updated `.gitignore` to exclude coverage and test artifacts.
- Fixed `host` default value in `src/cli-parser.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced synchronous `execSync` with asynchronous `exec` (promisified) in `test/ops.test.mjs` to allow the parent process's mock WebSocket server to handle connections from the child process.
Added `NOSTR_LOCK_RELAY_FALLBACKS: ''` to the child process environment to prevent `nostr-tools` from attempting to connect to default public relays, which caused hangs in restricted CI environments.
Updated `test/ops.test.mjs` to mock a relay response (EOSE) for robust integration testing without external network dependencies.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Mitigate command injection in `src/services/governance/index.js` by using explicit array arguments with `execFileSync` and adding a security comment.
- Add regression test `test/governance-security.test.mjs` verifying the fix against simulated exploit attempts.
- Fix CI build failures by resolving circular dependencies and duplicate declarations in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs`.
- Resolve linting errors in tests and implementation files.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Mitigate command injection in `src/services/governance/index.js` by using explicit array arguments with `execFileSync` and adding a security comment.
- Add regression test `test/governance-security.test.mjs` verifying the fix against simulated exploit attempts.
- Fix CI build failures by resolving circular dependencies and duplicate declarations in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs`.
- Resolve linting errors in tests and implementation files.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Rewrote `src/lock-publisher.mjs` to ensure clean imports and no duplicate declarations of `withTimeout`.
- This addresses the lint error `Identifier 'withTimeout' has already been declared` seen in CI.
- Verified lint passes locally.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix `SyntaxError: The requested module './lock-utils.mjs' does not provide an export named 'withTimeout'` by refactoring exports in `src/lock-utils.mjs`.
- Explicitly import `relayListLabel` and `mergeRelayList` from `src/utils.mjs` before exporting them to avoid ambiguous export behavior in some environments.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Mitigate command injection in `src/services/governance/index.js` by using explicit array arguments with `execFileSync` and adding a security comment.
- Add regression test `test/governance-security.test.mjs` verifying the fix against simulated exploit attempts.
- Fix CI build failures by resolving circular dependencies and duplicate declarations in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs`.
- Resolve linting errors in tests and implementation files.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Mitigate command injection in `src/services/governance/index.js` by using explicit array arguments with `execFileSync` and adding a security comment.
- Add regression test `test/governance-security.test.mjs` verifying the fix against simulated exploit attempts.
- Fix CI build failures by resolving circular dependencies and duplicate declarations in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs`.
- Resolve linting errors in tests and implementation files.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Imported `randomInt` from `node:crypto` in `src/lock-publisher.mjs` to fix CI failure.
- Centralized `withTimeout` and `mergeRelayList` in `src/utils.mjs`.
- Updated `src/lock-utils.mjs` to re-export them.
- Removed local redefinitions in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fixed `test/utils.test.mjs` imports.
- Verified all tests pass.
This resolves the N/A documentation task by ensuring the codebase is in a valid state.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Moved `withTimeout` implementation to `src/lock-utils.mjs` and exported it correctly.
- Removed duplicate local definitions of `withTimeout`, `mergeRelayList`, and `secureRandom` in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fixed imports in `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs` to use `src/lock-utils.mjs` consistently.
- Updated `test/utils.test.mjs` and `test/utils-async.test.mjs` to fix broken imports and test definitions.
- Verified `npm run lock:complete` and `npm run scheduler:daily` execute correctly.
- Updated `src/todo/TODO_2026-02-20T03-00-00Z.md` to mark verification task as completed.
- Verified `src/relay-health.mjs` does not use `MINUTE_MS` locally, despite mysterious CI error. Confirmed imports are correct.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Remove unused `manifest` variable from destructuring in `test/cmd-backup.test.mjs` to resolve ESLint error.
- Verified fix with `npm run lint`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fixes CI failure in `test/install_dir_validation.test.mjs` where `assert.notMatch` was undefined.
- `assert.doesNotMatch` is the standard Node.js assertion method for negative regex matching.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactor `src/cmd-proposal.mjs` to use dependency injection for testability.
Add `test/cmd-proposal.test.mjs` to verify all subcommands (`create`, `list`, `apply`, `reject`, `show`) and error handling.
Fix indentation in `src/cmd-proposal.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaces aggressive `cache.clear()` with per-agent invalidation in `src/services/memory/index.js` to improve performance.
- Adds `prune(predicate)` to `createMemoryCache`.
- Updates `ingestEvents`, `runPruneCycle`, `pinMemory`, `unpinMemory`, and `markMemoryMerged` to invalidate only the affected agent's cache entries.
- Adds unit test for `prune` in `test/memory-cache.test.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Refactor `cmdBackup` and `listBackups` in `src/cmd-backup.mjs` to accept `cwd` parameter for dependency injection.
- Add `test/cmd-backup.test.mjs` to test backup creation, missing files handling, output override, and listing functionality.
- Ensure tests run in isolated temporary directories using `fs.mkdtemp`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted `LockPublisher` and `publishLock` to `src/lock-publisher.mjs` (already existed, but cleaned up).
- Refactored `src/lock-publisher.mjs` to import error constants and classification logic from `src/lock-error-classifier.mjs` instead of duplicating them.
- Refactored `src/lock-publisher.mjs` and `src/lock-utils.mjs` to use `mergeRelayList` from `src/utils.mjs`.
- Consolidated and moved publisher tests from `test/lock-ops.test.mjs` and `test/lock-ops-publish-retry.test.mjs` to `test/lock-publisher.test.mjs`.
- Cleaned up `src/lock-utils.mjs` to remove duplicate `mergeRelayList`.
- Verified changes with tests.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactor cmdRollback to support dependency injection and add comprehensive unit tests covering validation, version listing, and rollback operations.
- Refactor `src/cmd-rollback.mjs` to accept `deps` argument.
- Create `test/cmd-rollback.test.mjs` with test cases for happy paths and error conditions.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Implemented `verifyPassword` helper in `src/dashboard.mjs` to support hashed passwords.
- Added support for `scrypt:<salt>:<hash>` format for storing credentials.
- Maintained backward compatibility for plaintext passwords using `timingSafeCompare`.
- Updated `cmdDashboard` to use the new verification logic.
- Added comprehensive tests in `test/dashboard-auth.test.mjs` for hashed credential validation.
This change eliminates the need to store plaintext passwords in `torch-config.json` or environment variables, addressing a security vulnerability.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactor test/install_dir_validation.test.mjs to use unique temporary directories for each subtest, eliminating shared state and race conditions that caused flakiness.
Update KNOWN_ISSUES.md to mark the issue as resolved.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extracted `RelayHealthManager` to `src/relay-health-manager.mjs`.
- Extracted `LockPublisher` to `src/lock-publisher.mjs`.
- Consolidated `withTimeout`, `mergeRelayList`, `relayListLabel` into `src/lock-utils.mjs`.
- Refactored `src/lock-ops.mjs` to import from these new modules, acting as a facade.
- Updated `src/relay-health.mjs` to import `withTimeout` from `src/lock-utils.mjs`.
- Updated tests to import from correct locations.
- Removed duplicate implementations and significantly reduced `src/lock-ops.mjs` size.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix lint error in `test/verify-example-config-security.test.mjs` (unused var).
- Fix duplicate definitions of `mergeRelayList` and `relayListLabel` in `src/lock-ops.mjs` and `src/lock-publisher.mjs`.
- Fix missing export of `withTimeout` in `src/lock-utils.mjs`.
- Fix broken imports in `test/utils.test.mjs` and `test/utils-async.test.mjs`.
- Centralize `secureRandom` in `src/lock-utils.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Add regression test `test/governance-security.test.mjs` to verify `applyProposal` is secure against command injection.
- Fix broken imports and duplicates in `src/lock-utils.mjs`, `src/lock-ops.mjs`, `src/lock-publisher.mjs`, and `src/relay-health.mjs` to resolve test failures.
- Verify all tests pass.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Moved `withTimeout` and `mergeRelayList` to `src/lock-utils.mjs` as the single source of truth.
- Updated `src/lock-ops.mjs` and `src/lock-publisher.mjs` to import from `src/lock-utils.mjs`.
- Fixed lint errors for duplicate declarations.
- Updated tests (`test/utils.test.mjs`, `test/utils-async.test.mjs`) to import from correct modules.
- Added `randomInt` import in `src/lock-publisher.mjs` to fix `no-undef`.
Co-authored-by: PR0M3TH3AN <[email protected]>