Merge pull request #301 from PR0M3TH3AN/chore/clean-repo-standard-12872616590007917715

chore: Enforce Clean Repo Standard and organize artifacts
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-18 14:28:33 -05:00
commit 62731f77fd
27 files changed
+49 -3

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
{
"date": "2026-02-15",
"intervals": "34",
"promises": "20",
"workers": "6",
"torrent": "27",
"relays": "27",
"visibility": "4"
}
-32
View File
@@ -1,32 +0,0 @@
[
{
"file": "dashboard/index.html",
"line": 816,
"pattern": "setInterval",
"snippet": " refreshIntervalId = setInterval(() => {",
"risk": "Unbounded background DOM updates",
"trigger": "Page load",
"impact": "CPU usage when tab is hidden",
"priority": "P1"
},
{
"file": "dashboard/index.html",
"line": 799,
"pattern": "setTimeout",
"snippet": " setTimeout(() => {",
"risk": "Delayed retry",
"trigger": "WebSocket close",
"impact": "Low",
"priority": "P3"
},
{
"file": "src/services/memory/scheduler.js",
"line": 33,
"pattern": "setInterval",
"snippet": " const handle = setInterval(() => {",
"risk": "Background job loop",
"trigger": "Server start",
"impact": "Necessary backend process",
"priority": "P3"
}
]
-3
View File
@@ -1,3 +0,0 @@
{
"raw_output": "src/relay-health.mjs: timeoutId = setTimeout(() => reject(new Error(message)), timeoutMs);\nsrc/test_logs/TEST_LOG_2026-02-17T00-00-00Z.md:- Command: grep -rE \"setInterval|setTimeout\" src/\nsrc/lib.mjs: await new Promise((resolve) => setTimeout(resolve, raceCheckDelayMs));\nsrc/prompts/daily/const-refactor-agent.md: - Timeout: look for `setTimeout`, `fetch(..., { timeout: ...})`, `pool.list` timeouts, `BACKGROUND_RELAY_TIMEOUT_MS`.\nsrc/prompts/daily/perf-agent.md:- `setInterval|setTimeout|requestAnimationFrame|requestIdleCallback`\nsrc/prompts/daily/test-audit-agent.md: - Long sleeps: `setTimeout(`, `sleep(`, `await delay(`.\nsrc/prompts/daily/test-audit-agent.md: - `rg \"setTimeout\\\\(|sleep\\\\(|await delay\\\\(|new Promise\\\\(r => setTimeout\" -n`\nsrc/prompts/daily/test-audit-agent.md: 1. **Test-fix PR** — add missing assertions, replace `setTimeout` sleeps with `waitFor`, or mock timers. Include `src/context/CONTEXT_<timestamp>.md`, `src/todo/TODO_<timestamp>.md`, `src/test_logs/TEST_LOG_<timestamp>.md`.\nsrc/prompts/daily/test-audit-agent.md:- Replace `await new Promise(r => setTimeout(r, 1000))` with a deterministic `await waitFor(() => condition)` or mock timers.\nsrc/cmd-lock.mjs: await new Promise((resolve) => setTimeout(resolve, RACE_CHECK_DELAY_MS));\nsrc/lock-ops.mjs: timeoutHandle = setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs);\nsrc/lock-ops.mjs: sleepFn = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),\nsrc/services/memory/scheduler.js: const handle = setInterval(() => {\nsrc/services/memory/scheduler.js: setTimeout(resolve, options.retryDelayMs);\nsrc/services/memory/scheduler.js: const intervalHandle = setInterval(run, definition.intervalMs);\nsrc/services/memory/scheduler.js: const timeout = setTimeout(async () => {"
}
-34
View File
@@ -1,34 +0,0 @@
./DIAGNOSIS.md:13: setTimeout(() => reject(new Error('Relay query timed out')), queryTimeoutMs),
./DIAGNOSIS.md:18:When `pool.querySync` completes successfully (e.g., in 600ms), the `Promise.race` resolves immediately. However, the `setTimeout` created in the second promise remains active in the Node.js event loop. Node.js processes do not exit as long as there are active handles (like timers). Thus, the process waits for the remaining ~14.4s until the timer fires (and the callback is executed, though ignored) before exiting.
./DIAGNOSIS.md:21:A reproduction script confirmed that `Promise.race` with an uncleared `setTimeout` prevents process exit until the timeout fires.
./DIAGNOSIS.md:24:Capture the `timeoutHandle` from `setTimeout` and explicitly clear it using `clearTimeout(timeoutHandle)` in the `finally` block of the `queryLocks` function.
./test/memory-cache.test.mjs:30: await new Promise((resolve) => setTimeout(resolve, 10));
./test/lock-acquisition-resilience.integration.test.mjs:44: mock.timers.enable({ apis: ['Date', 'setTimeout'] });
./test/lock-ops-publish-retry.test.mjs:64: mock.timers.enable({ apis: ['Date', 'setTimeout'] });
./test/lock-ops-publish-retry.test.mjs:105: mock.timers.enable({ apis: ['Date', 'setTimeout'] });
./test/memory-scheduler.test.mjs:9:const wait = (ms = 0) => new Promise((resolve) => setTimeout(resolve, ms));
./test/relay-fanout-quorum.integration.test.mjs:60: setTimeout(() => {
./scripts/agent/run-scheduler-cycle.mjs:508: return new Promise((resolve) => setTimeout(resolve, ms));
./scripts/agent/load-test.mjs:19:const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
./scripts/benchmark-dashboard.mjs:10: return new Promise(resolve => setTimeout(resolve, ms));
./dashboard/index.html:681: setTimeout(() => {
./dashboard/index.html:698: refreshIntervalId = setInterval(() => {
./src/services/memory/scheduler.js:33: const handle = setInterval(() => {
./src/services/memory/scheduler.js:167: setTimeout(resolve, options.retryDelayMs);
./src/services/memory/scheduler.js:252: const intervalHandle = setInterval(run, definition.intervalMs);
./src/services/memory/scheduler.js:260: const timeout = setTimeout(async () => {
./tests/memory.test.js:18:const wait = (ms = 0) => new Promise((resolve) => setTimeout(resolve, ms));
./src/relay-health.mjs:12: timeoutId = setTimeout(() => reject(new Error(message)), timeoutMs);
./run-perf-agent.sh:57:rg -n --hidden --glob '!node_modules/' --glob '!dist/' --glob '!.git/' "setInterval|setTimeout|requestAnimationFrame|requestIdleCallback" . > perf/hits-intervals.txt || true
./landing/index.html:795: setTimeout(() => {
./src/lock-ops.mjs:59: timeoutHandle = setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs);
./src/lock-ops.mjs:407: sleepFn = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
./src/cmd-lock.mjs:91: await new Promise((resolve) => setTimeout(resolve, RACE_CHECK_DELAY_MS));
./src/lib.mjs:290: await new Promise((resolve) => setTimeout(resolve, raceCheckDelayMs));
./src/prompts/daily/test-audit-agent.md:88: - Long sleeps: `setTimeout(`, `sleep(`, `await delay(`.
./src/prompts/daily/test-audit-agent.md:156: - `rg "setTimeout\\(|sleep\\(|await delay\\(|new Promise\\(r => setTimeout" -n`
./src/prompts/daily/test-audit-agent.md:171: 1. **Test-fix PR** — add missing assertions, replace `setTimeout` sleeps with `waitFor`, or mock timers. Include `src/context/CONTEXT_<timestamp>.md`, `src/todo/TODO_<timestamp>.md`, `src/test_logs/TEST_LOG_<timestamp>.md`.
./src/prompts/daily/test-audit-agent.md:222:- Replace `await new Promise(r => setTimeout(r, 1000))` with a deterministic `await waitFor(() => condition)` or mock timers.
./src/prompts/daily/const-refactor-agent.md:84: - Timeout: look for `setTimeout`, `fetch(..., { timeout: ...})`, `pool.list` timeouts, `BACKGROUND_RELAY_TIMEOUT_MS`.
./src/prompts/daily/perf-agent.md:100:- `setInterval|setTimeout|requestAnimationFrame|requestIdleCallback`
./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
-20
View File
@@ -1,20 +0,0 @@
./DIAGNOSIS.md:7:The `queryLocks` function in `src/lock-ops.mjs` uses `Promise.race` to enforce a timeout (default 15s) on relay queries.
./DIAGNOSIS.md:10: const events = await Promise.race([
./DIAGNOSIS.md:18:When `pool.querySync` completes successfully (e.g., in 600ms), the `Promise.race` resolves immediately. However, the `setTimeout` created in the second promise remains active in the Node.js event loop. Node.js processes do not exit as long as there are active handles (like timers). Thus, the process waits for the remaining ~14.4s until the timer fires (and the callback is executed, though ignored) before exiting.
./DIAGNOSIS.md:21:A reproduction script confirmed that `Promise.race` with an uncleared `setTimeout` prevents process exit until the timeout fires.
./test/relay-fanout-quorum.integration.test.mjs:76: await Promise.all(servers.map((server) => new Promise((resolve, reject) => {
./task-logs/weekly/2026-02-14T14-30-00Z__perf-optimization-agent__completed.md:8:Identified a 15-second execution floor in `torch-lock` operations caused by a `Promise.race` timeout that was not cleared upon successful completion. This kept the Node.js event loop active until the 15s timer fired.
./src/services/memory/formatter.js:181: await Promise.all((memories ?? []).map((memory) => memoryService.updateMemoryUsage(memory.id, now)));
./src/services/memory/retriever.js:178: await Promise.all(ids.map((id) => repository.updateMemoryUsage(id, lastSeen)));
./src/cmd-list.mjs:17: const results = await Promise.all(
./src/lock-ops.mjs:61: return Promise.race([promise, timeoutPromise]).finally(() => {
./src/lock-ops.mjs:368: const settled = await Promise.allSettled(
./perf/hits-intervals.txt:2:./DIAGNOSIS.md:18:When `pool.querySync` completes successfully (e.g., in 600ms), the `Promise.race` resolves immediately. However, the `setTimeout` created in the second promise remains active in the Node.js event loop. Node.js processes do not exit as long as there are active handles (like timers). Thus, the process waits for the remaining ~14.4s until the timer fires (and the callback is executed, though ignored) before exiting.
./perf/hits-intervals.txt:3:./DIAGNOSIS.md:21:A reproduction script confirmed that `Promise.race` with an uncleared `setTimeout` prevents process exit until the timeout fires.
./scripts/validate-scheduler-flow-parity.mjs:155:const [meta, flow, scheduler] = await Promise.all([
./scripts/agent/load-test.mjs:126: await Promise.all(promises);
./src/prompts/weekly/race-condition-agent.md:117: - Promise.all/race with insufficient error isolation
./scripts/benchmark-dashboard.mjs:73: await Promise.all(workers);
./weekly-perf-report-2026-02-14.md:17:Modified `src/lib.mjs` to execute relay queries in parallel using `Promise.all`.
./src/lib.mjs:348: const results = await Promise.all(
./src/relay-health.mjs:14: return Promise.race([promise, timeoutPromise]).finally(() => clearTimeout(timeoutId));
-27
View File
@@ -1,27 +0,0 @@
./run-perf-agent.sh:61:rg -n --hidden --glob '!node_modules/' --glob '!dist/' --glob '!.git/' "integrationClient\.pool|publishEventToRelays|pool\.list|queueSignEvent|relayManager|authService|hydrateFromStorage" . > perf/hits-relays.txt || true
./perf/hits-torrent.txt:14:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-torrent.txt:22:./perf/hits-workers.txt:1:./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-torrent.txt:23:./perf/hits-workers.txt:4:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-torrent.txt:24:./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-workers.txt:1:./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-workers.txt:4:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-intervals.txt:32:./src/prompts/daily/const-refactor-agent.md:84: - Timeout: look for `setTimeout`, `fetch(..., { timeout: ...})`, `pool.list` timeouts, `BACKGROUND_RELAY_TIMEOUT_MS`.
./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./src/prompts/daily/test-audit-agent.md:22: 3. Maps tests to critical production files (login/auth, relayManager, decryption, watch-history, moderation, playback) and reports coverage gaps.
./src/prompts/daily/test-audit-agent.md:99: - `js/services/authService.js` — login/hydration/lockdown flows.
./src/prompts/daily/test-audit-agent.md:100: - `src/relayManager.js` — load/publish relay list, fast vs background logic.
./src/prompts/daily/test-audit-agent.md:123: - If available and lightweight: run Stryker on one critical module (e.g., `authService`, `relayManager`) to detect weak tests.
./src/prompts/daily/test-audit-agent.md:187:- **Auth & login flows**: `js/services/authService.js`
./src/prompts/daily/test-audit-agent.md:189:- **Relay manager & publishing**: `src/relayManager.js`
./src/prompts/daily/test-audit-agent.md:190: - Tests: `loadRelayList`, `publishRelayList`, fast/background fetch timeouts, `integrationClient.pool` handling.
./src/prompts/daily/const-refactor-agent.md:84: - Timeout: look for `setTimeout`, `fetch(..., { timeout: ...})`, `pool.list` timeouts, `BACKGROUND_RELAY_TIMEOUT_MS`.
./src/prompts/daily/const-refactor-agent.md:94: {"file": "src/relayManager.js", "line": 24, "context":"FAST_RELAY_TIMEOUT_MS"},
./src/prompts/daily/const-refactor-agent.md:108: - Example: if `FAST_RELAY_TIMEOUT_MS` exists in `src/relayManager.js` or `relayConstants.js`, import it.
./src/prompts/daily/const-refactor-agent.md:154: - Reason: relayManager & integration-related code; existing relay constants live here.
./src/prompts/daily/const-refactor-agent.md:224:- Discover `5000` appears in `src/relayManager.js`, `js/integration/watchHistory.js`, `js/integration/relayClient.js`.
./src/prompts/daily/perf-agent.md:104:- `integrationClient\.pool|publishEventToRelays|pool\.list|queueSignEvent|relayManager|authService|hydrateFromStorage`
./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./src/prompts/daily/perf-agent.md:111:- Open suspicious files for review: `sed -n '1,240p' src/relayManager.js`
./src/prompts/daily/docs-code-investigator.md:135:- Use examples that match the code style (e.g., use `await integrationClient.pool.list(...)` if code uses that).
./src/prompts/daily/docs-code-investigator.md:205:// 1) initClient() sets up integrationClient.pool
./src/prompts/daily/docs-code-investigator.md:210:- `docs/relayManager-overview.md` with step-sequence, API table, and "When to change" notes.
-27
View File
@@ -1,27 +0,0 @@
./src/prompts/daily/test-audit-agent.md:105: - `js/webtorrent*` / `torrent/app.js` — lazy initialization.
./src/prompts/daily/test-audit-agent.md:197:- **Playback & WebTorrent**: `js/webtorrent*`, `torrent/app.js`, `js/ui/ambientBackground.js`
./src/prompts/daily/test-audit-agent.md:198: - Tests: lazy webtorrent init, visibility gating, ensure heavy loops paused when hidden.
./src/prompts/daily/deps-security-agent.md:48:Also read `AGENTS.md` and `KNOWN_ISSUES.md` for project-specific caveats (e.g., the repo uses `integration-tools`, `webtorrent`, `Playwright`, `Tailwind`). Tag these libraries for special handling.
./src/prompts/daily/content-audit-agent.md:82:- Storage/processing: check any `torrent/`, `storage/`, or `cloud` integration code.
./src/prompts/weekly/race-condition-agent.md:43: - playback fallback races (URL-first vs magnet negotiation, WebTorrent
./src/prompts/weekly/race-condition-agent.md:111: - WebTorrent clients or torrents accessed after destroy
./src/prompts/weekly/race-condition-agent.md:139: - Playback orchestration (`js/services/playbackService.js`, WebTorrent)
./src/prompts/daily/perf-agent.md:22: - **P2**: User-initiated heavy features (WebTorrent playback) — lazy-init/deprioritize until P0/P1 resolved.
./src/prompts/daily/perf-agent.md:28: 1. Finds expensive background patterns (main-thread loops, unbounded concurrency, eager socket/torrent creation).
./src/prompts/daily/perf-agent.md:53:- `INITIAL_BASELINE.md` — baseline metrics (login time, decrypt queue size, relay latencies, webtorrent count).
./src/prompts/daily/perf-agent.md:93:- **Lazy init**: WebTorrent and socket-heavy clients created only on explicit user action.
./src/prompts/daily/perf-agent.md:103:- `new WebTorrent|WebTorrent|torrent|magnet|torrentHash|magnetValidators`
./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./src/prompts/daily/perf-agent.md:150:- Active WebTorrent client count at page load.
./src/prompts/daily/known-issues-agent.md:48: magnets/webtorrent safety, logging/PII policy) without explicit human review.
./src/prompts/daily/known-issues-agent.md:71: (e.g., shared signing/publishing, key handling, moderation, magnets/torrents,
./src/prompts/daily/known-issues-agent.md:95: - magnets/webtorrent behavior
./src/prompts/weekly/fuzz-agent.md:13:Mission: improve **input robustness** by fuzzing high-risk parsers/decoders (shared event schemas, DM unwrapping/decrypt paths, magnet normalization), capturing crashes/exceptions with minimized reproducers, and landing **small, safe** guard/validation fixes when appropriate. Every change must be traceable, reviewable, and compliant with repo security policy.
./src/prompts/weekly/fuzz-agent.md:34: - magnet normalization utilities
./src/prompts/weekly/fuzz-agent.md:105: - `magnet-utils`
./perf/hits-workers.txt:1:./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-workers.txt:4:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./run-perf-agent.sh:60:rg -n --hidden --glob '!node_modules/' --glob '!dist/' --glob '!.git/' "new WebTorrent|WebTorrent|torrent|magnet|torrentHash|magnetValidators" . > perf/hits-torrent.txt || true
./run-perf-agent.sh:68:TORRENT=$(wc -l < perf/hits-torrent.txt)
./run-perf-agent.sh:78: "torrent": "$TORRENT",
-4
View File
@@ -1,4 +0,0 @@
./run-perf-agent.sh:62:rg -n --hidden --glob '!node_modules/' --glob '!dist/' --glob '!.git/' "document.hidden|visibilitychange" . > perf/hits-visibility.txt || true
./src/prompts/daily/perf-agent.md:91:- **Visibility gating**: RAF/polling/animation loops must check `document.hidden` and pause when not visible.
./src/prompts/daily/perf-agent.md:105:- `document.hidden|visibilitychange`
./src/prompts/daily/perf-agent.md:121: - Ensure RAF loops check `document.hidden` and avoid multiple attachments.
-6
View File
@@ -1,6 +0,0 @@
./perf/hits-intervals.txt:34:./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./run-perf-agent.sh:59:rg -n --hidden --glob '!node_modules/' --glob '!dist/' --glob '!.git/' "new Worker|Worker\(|postMessage\(|getDmDecryptWorkerQueueSize|decryptDmInWorker" . > perf/hits-workers.txt || true
./src/prompts/daily/perf-agent.md:102:- `new Worker|Worker\(|postMessage\(|getDmDecryptWorkerQueueSize|decryptDmInWorker`
./src/prompts/daily/perf-agent.md:110:- Ripgrep: `rg -n --hidden --ignore-file .gitignore "requestAnimationFrame|new Worker|new WebTorrent|integrationClient.pool" js`
./src/prompts/daily/perf-agent.md:119: - Add `MAX_DM_WORKER_PENDING` to `dmDecryptWorkerClient.js`. Throttle/reject when exceeded; log `getDmDecryptWorkerQueueSize()`.
./src/prompts/daily/perf-agent.md:147:- Log `getDmDecryptWorkerQueueSize()` and warn > 20.