Commit Graph
528 Commits
Author SHA1 Message Date
thePR0M3TH3AN 4a59ccd501 Merge branch 'main' into test/ingest-events-coverage-4058176338689655233 2026-02-17 14:25:04 -05:00
thePR0M3TH3AN 26c878bdd9 Merge pull request #245 from PR0M3TH3AN/test-memory-ingest-events-14179486498291680650
Add unit tests for memory ingestEvents
2026-02-17 14:24:33 -05:00
thePR0M3TH3AN f79eae6ae9 Merge pull request #248 from PR0M3TH3AN/test/memory-stats-coverage-2370317382454489346
test: Add comprehensive tests for memoryStats function
2026-02-17 14:24:08 -05:00
thePR0M3TH3AN e9dcfb8c01 Merge pull request #251 from PR0M3TH3AN/test/cmd-check-improvements-4816638132352517865
🧪 Add tests for cmdCheck
2026-02-17 14:23:46 -05:00
thePR0M3TH3AN 4159ce1ad5 Merge pull request #257 from PR0M3TH3AN/jules-memory-prune-tests-5206348108909836817
Add tests for memory pruning cycle
2026-02-17 14:23:00 -05:00
thePR0M3TH3AN 670fdc2b22 Merge pull request #249 from PR0M3TH3AN/test-lock-utils-error-handling-1774013981640093185
🧪 Add missing error handling test for lock-utils
2026-02-17 14:22:30 -05:00
thePR0M3TH3AN 092169b0b9 Merge branch 'main' into test-lock-utils-error-handling-1774013981640093185 2026-02-17 14:22:09 -05:00
thePR0M3TH3AN 7128e6944b Merge pull request #244 from PR0M3TH3AN/test/lock-utils-coverage-13528701171132659276
Add unit tests for getCompletedAgents in src/lock-utils.mjs
2026-02-17 14:21:40 -05:00
google-labs-jules[bot]andPR0M3TH3AN a940172998 feat(test): add tests for runPruneCycle
- Added `test/memory-run-prune-cycle.test.mjs` to test `runPruneCycle` logic.
- Covered active pruning, dry-run, off mode, telemetry/metrics, and scheduling.
- Utilized environment isolation (temp dir) to prevent side effects on `.scheduler-memory/memory-store.json`.
- Addressed testing gap for `runPruneCycle` in `src/services/memory/index.js`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:55:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 99bd4ba2a3 test: add unit tests for cmdCheck
Refactor `cmdCheck` in `src/cmd-check.mjs` to support dependency injection for better testability.
Add `test/cmd-check.test.mjs` with comprehensive unit tests for `cmdCheck`, covering happy paths and edge cases.
Verify tests pass with `node --test test/cmd-check.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:55 +00:00
google-labs-jules[bot]andPR0M3TH3AN 1926426b11 test: add missing error handling test for lock-utils
Add a unit test for `getCompletedAgents` in `src/lock-utils.mjs` to verify that:
1. It correctly identifies completed agents.
2. It handles `ENOENT` gracefully (silent).
3. It logs an error for non-`ENOENT` errors (e.g. permission denied).

The `getCompletedAgents` function already supported dependency injection via a `deps` object, which is utilized in this test to mock `fs.readdir` and other dependencies.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:34 +00:00
google-labs-jules[bot]andPR0M3TH3AN fde5dbc67d test: Add comprehensive tests for memoryStats function
Adds `test/memory-stats.test.mjs` to validats `memoryStats` behavior including:
- Empty and populated repository states
- Ingest throughput calculation with mocked time
- Deleted rate metrics
- Window parameter handling

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:07 +00:00
google-labs-jules[bot]andPR0M3TH3AN e8cad0b42d feat(test): add unit tests for ingestEvents in memory service
Added `test/memory-ingest.test.mjs` to cover `ingestEvents` functionality.
Tests cover:
- Happy path ingestion with mocked repository and telemetry.
- Feature flag handling (skipping ingestion when disabled).
- Cache invalidation after ingestion.
- Deduplication logic.
- Error propagation from repository.

This improves test coverage for the memory service and ensures reliability of the ingestion process.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:53:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN 33bde42591 feat(test): add unit tests for memory ingestEvents
Added comprehensive unit tests for `ingestEvents` in `src/services/memory/index.js`.
Tests cover:
- Happy path ingestion with mocked repository and telemetry.
- Feature flag skipping behavior.
- Cache clearing side effects.
- Deduplication logic.
- Error handling.

This improves test coverage and reliability for the memory service.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:52:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 526b6a34c7 test: add unit tests for getCompletedAgents in src/lock-utils.mjs
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:50:12 +00:00
thePR0M3TH3AN b3f4a5c9cd Merge pull request #242 from PR0M3TH3AN/scheduler-cycle-optimization-6566135138689301144
⚡ Optimize scheduler cycle log reading performance
2026-02-17 13:38:36 -05:00
thePR0M3TH3AN 39b7783899 Merge pull request #241 from PR0M3TH3AN/refactor-usage-text-5134896285807665530
🧹 Refactor usage text to constants
2026-02-17 13:38:21 -05:00
thePR0M3TH3AN 8701ea6eb2 Merge pull request #240 from PR0M3TH3AN/test-circular-agent-context-2548280250167598137
test: add coverage for circular agentContext in memory formatter
2026-02-17 13:38:08 -05:00
thePR0M3TH3AN 651e5e659f Merge branch 'main' into test-circular-agent-context-2548280250167598137 2026-02-17 13:38:01 -05:00
thePR0M3TH3AN f0437a9647 Merge pull request #231 from PR0M3TH3AN/code-health/relay-health-comment-8690906014173608719
Sweep: Add comment to swallowed error in relay-health.mjs
2026-02-17 13:37:43 -05:00
google-labs-jules[bot]andPR0M3TH3AN 32ba0d2621 perf(scheduler): parallelize log file reading in getLatestFile
Optimizes the `getLatestFile` function in `scripts/agent/run-scheduler-cycle.mjs` by parallelizing the reading and parsing of log files using `Promise.all`. This replaces the sequential `for...of` loop which caused I/O bottlenecks when processing large numbers of log files.

Measured improvement: ~56% faster (530ms -> 207ms) for 1000 log files.

Also removed a tracked `test_output.log` file that shouldn't be in the repository.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:37:39 +00:00
thePR0M3TH3AN d3926f8a36 Merge pull request #234 from PR0M3TH3AN/test-memory-formatter-circular-context-16916269218151396900
🧪 Add test for circular agentContext in renderPromptWithMemoryContext
2026-02-17 13:37:29 -05:00
thePR0M3TH3AN ef3e20b1aa Merge pull request #232 from PR0M3TH3AN/test/unpin-memory-coverage-10292270866664076558
🧪 Test unpinMemory function
2026-02-17 13:37:15 -05:00
thePR0M3TH3AN 88bb2e8fff Merge branch 'main' into test/unpin-memory-coverage-10292270866664076558 2026-02-17 13:37:09 -05:00
thePR0M3TH3AN 3f93916372 Merge pull request #239 from PR0M3TH3AN/test-unpinMemory-improvement-14234727575040674588
🧪 Add unit tests for unpinMemory
2026-02-17 13:36:49 -05:00
thePR0M3TH3AN 2de7bdd5ce Merge pull request #237 from PR0M3TH3AN/perf/optimize-reliability-summary-12744973006292843555
⚡ Optimize lock reliability summary with Promise.all
2026-02-17 13:36:35 -05:00
thePR0M3TH3AN f815ab3f59 Merge pull request #238 from PR0M3TH3AN/test-improvement-relay-health-11069753813571179653
test(relay-health): add unit tests for summarizeHistory
2026-02-17 13:36:22 -05:00
thePR0M3TH3AN ce5ff389b9 Merge pull request #235 from PR0M3TH3AN/perf/scheduler-verify-memory-step-parallel-9310367124613202891
⚡ Parallelize artifact checks in scheduler verification
2026-02-17 13:36:07 -05:00
google-labs-jules[bot]andPR0M3TH3AN 24f1853efc refactor(cli): move usage text to constants
Moved the large usage help text from `src/lib.mjs` to `src/constants.mjs` to improve readability and maintainability of the library file.

- Added `USAGE_TEXT` to `src/constants.mjs`.
- Updated `src/lib.mjs` to import and use `USAGE_TEXT`.
- Removed unused `DEFAULT_DASHBOARD_PORT` import from `src/lib.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:35:55 +00:00
thePR0M3TH3AN ac80e8306f Merge pull request #233 from PR0M3TH3AN/refactor/torch-config-string-parsing-8819796160542468517
Refactor: Unify string list parsing in torch-config
2026-02-17 13:35:55 -05:00
thePR0M3TH3AN f118d10d0c Merge pull request #236 from PR0M3TH3AN/refactor/torch-config-helper-11721225630532365910
Refactor repetitive config retrieval in torch-config.mjs
2026-02-17 13:35:41 -05:00
google-labs-jules[bot]andPR0M3TH3AN e5b2394284 test: add coverage for circular agentContext in memory formatter
Add a test case to `test/memory-formatter.test.mjs` to ensure that `renderPromptWithMemoryContext` handles circular references in `agentContext` by falling back to `String(agentContext)` instead of throwing a `JSON.stringify` error.

This addresses a missing edge case in JSON serialization testing.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:33:44 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0851d875a4 test(memory): add unit tests for unpinMemory
Adds focused unit tests for `unpinMemory` in `test/memory-pinning.test.mjs` to ensure it correctly updates the repository and clears the cache. Covers both happy path and non-existent ID scenarios.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:33:44 +00:00
google-labs-jules[bot]andPR0M3TH3AN 58660f9390 test(relay-health): add unit tests for summarizeHistory
Added comprehensive unit tests for `summarizeHistory` in `src/relay-health.mjs`.
- Covers success rate calculation, window filtering, and all-down duration logic.
- Includes edge cases for empty history and malformed entries.
- Improves test coverage for relay health monitoring logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:33:39 +00:00
google-labs-jules[bot]andPR0M3TH3AN 18eedc7810 perf: parallelize log processing in summarize-lock-reliability.mjs
Replaces sequential file processing loop with Promise.all to improve performance.
Benchmark showed ~2.5x speedup (1638ms -> 658ms) on 2000 files.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:33:10 +00:00
google-labs-jules[bot]andPR0M3TH3AN 34cfc95b2d Refactor repetitive config retrieval in torch-config.mjs
Introduced a `resolveIntegerConfig` helper function to handle environment variable checking, parsing, validation, and configuration fallback for integer settings. Updated `getQueryTimeoutMs`, `getPublishTimeoutMs`, `getMinSuccessfulRelayPublishes`, and `getMinActiveRelayPool` to use this helper. This improves code maintainability and consistency.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN 73c5f22932 test(memory): add test for circular agentContext in renderPromptWithMemoryContext
Adds a test case to `test/memory-formatter.test.mjs` to verify that `renderPromptWithMemoryContext` gracefully handles circular references in `agentContext` by falling back to string representation instead of throwing a JSON serialization error. This ensures the edge case at `src/services/memory/formatter.js:125` is covered.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN 3d459ef905 perf(scheduler): parallelize artifact checks in verifyMemoryStep
Optimize the `verifyMemoryStep` function in `scripts/agent/run-scheduler-cycle.mjs` to check for artifact existence in parallel using `Promise.all` instead of a sequential loop.

Benchmarks indicate a ~10x performance improvement (from ~500ms to ~50ms) when checking for 10 artifacts where none or the last one exists, with no regression in the best-case scenario.

Verified with `test/run-scheduler-cycle-memory-policy.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:46 +00:00
google-labs-jules[bot]andPR0M3TH3AN 67a6b91d92 Refactor: Unify string list parsing in torch-config
- Introduced `parseStringList` helper to handle parsing of string arrays from config.
- Replaced `parseRelayList` and `parseRoster` with `parseStringList`.
- Replaced inline parsing of `relays` and `dashboard.relays` with `parseStringList`.
- Unified behavior: empty lists in config now consistently return `null` instead of `[]`.
- Added unit test verifying consistent `null` return for empty lists.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:40 +00:00
google-labs-jules[bot]andPR0M3TH3AN 969a7d41e7 test(memory): add unit tests for unpinMemory
Added unit tests to `test/memory-pinning.test.mjs` to cover the `unpinMemory` function.
Tests verify:
- Successful unpinning and cache clearing.
- Handling of non-existent IDs (returns null) and cache clearing.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:35 +00:00
google-labs-jules[bot]andPR0M3TH3AN ec769d39cb docs: explain swallowed JSON parse error in relay-health.mjs
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:32:22 +00:00
thePR0M3TH3AN 264e2b5f61 Merge pull request #230 from PR0M3TH3AN/agents/daily/audit-agent-15878739526953996560
Daily Audit Agent Run (2026-02-17)
2026-02-17 13:18:21 -05:00
google-labs-jules[bot]andPR0M3TH3AN 2f72ac4b42 feat(audit): daily audit run for 2026-02-17
- Executed audit-agent tasks manually.
- Ran file size check, innerHTML check, and lint.
- Generated artifacts in artifacts/audit/2026-02-17/.
- Updated memory store.
- Verified artifacts.
- Completed lock.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 18:14:18 +00:00
thePR0M3TH3AN c549c0e8b0 Merge pull request #227 from PR0M3TH3AN/test-mark-memory-merged-6408631238217390232
test(memory): add tests for markMemoryMerged
2026-02-17 13:10:10 -05:00
thePR0M3TH3AN e61b4e3d4a Merge pull request #226 from PR0M3TH3AN/memory-telemetry-fix-8633028829140804238
🧹 Use util.debuglog for memory telemetry
2026-02-17 13:09:23 -05:00
thePR0M3TH3AN 8f51d74955 Merge pull request #229 from PR0M3TH3AN/fix/dashboard-config-security-7655777063695938949
🔒 Fix security vulnerability: Sanitize torch-config.json exposure
2026-02-17 13:09:02 -05:00
thePR0M3TH3AN 127ec4102e Merge pull request #228 from PR0M3TH3AN/fix-dashboard-file-access-vulnerability-3711172732020694981
🔒 Fix unrestricted file access in dashboard
2026-02-17 13:07:04 -05:00
thePR0M3TH3AN b240132f4a Merge pull request #225 from PR0M3TH3AN/test/pin-memory-coverage-16037314347180208505
test: add unit tests for pinMemory and fix dependency injection in getRelevantMemories
2026-02-17 13:06:38 -05:00
google-labs-jules[bot]andPR0M3TH3AN 88506ad6e4 fix(security): sanitize torch-config.json response in dashboard
The dashboard previously served the raw `torch-config.json` file, potentially exposing sensitive information like authentication credentials.
This commit modifies the `/torch-config.json` endpoint to:
1. Parse the configuration file.
2. Sanitize the output by removing the `dashboard.auth` field and any unknown fields (using `parseTorchConfig`).
3. Support `TORCH_CONFIG_PATH` environment variable for configuration file location, improving testability and consistency with other components.

Verified with new test `test/dashboard-config-security.test.mjs` and existing auth tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 17:36:56 +00:00
google-labs-jules[bot]andPR0M3TH3AN 171836d2ac fix: restrict dashboard file access to allowed directories
This patch addresses a security vulnerability where the dashboard server could serve any file from the package root.

Changes:
- Implemented an allowlist in `src/dashboard.mjs` to restrict file access to:
  - `dashboard/`
  - `assets/`
  - `src/docs/`
  - `torch-config.json`
- Added `test/dashboard-security.test.mjs` to verify the fix and prevent regressions.

The fix ensures that sensitive files like `package.json` or source code cannot be accessed via the dashboard server.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-17 17:35:32 +00:00