Merge pull request #2702 from PR0M3TH3AN/agents/daily/audit-agent-2026-02-24-4519642292142447047

Daily Agent: Audit Agent
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-24 15:12:50 -05:00
commit 26e3d6032a
13 files changed
+561 -160

No files matched your search

+3
View File
@@ -13,3 +13,6 @@ ai/reports/
coverage/
dist/
TEST_LOG.mdtest_logs/nip-hits.txt
!artifacts/audit/
!artifacts/audit/*.md
!artifacts/audit/*.json
@@ -0,0 +1,224 @@
{
"grandfathered_files": 43,
"grandfathered_excess_lines": 45288,
"new_oversized_files": 0,
"new_excess_lines": 0,
"grandfathered_list": [
{
"path": "js/adminListStore.js",
"lines": 1078,
"excess": 78
},
{
"path": "js/app/authSessionCoordinator.js",
"lines": 1770,
"excess": 770
},
{
"path": "js/app/feedCoordinator.js",
"lines": 1767,
"excess": 767
},
{
"path": "js/app/playbackCoordinator.js",
"lines": 1217,
"excess": 217
},
{
"path": "js/app.js",
"lines": 5077,
"excess": 4077
},
{
"path": "js/channelProfile.js",
"lines": 5579,
"excess": 4579
},
{
"path": "js/feedEngine/stages.js",
"lines": 1388,
"excess": 388
},
{
"path": "js/historyView.js",
"lines": 2613,
"excess": 1613
},
{
"path": "js/index.js",
"lines": 1409,
"excess": 409
},
{
"path": "js/nostr/client.js",
"lines": 4004,
"excess": 3004
},
{
"path": "js/nostr/managers/SignerManager.js",
"lines": 1135,
"excess": 135
},
{
"path": "js/nostr/nip46Client.js",
"lines": 2104,
"excess": 1104
},
{
"path": "js/nostr/nip46Connector.js",
"lines": 1094,
"excess": 94
},
{
"path": "js/nostr/nip71.js",
"lines": 1600,
"excess": 600
},
{
"path": "js/nostr/publishHelpers.js",
"lines": 1415,
"excess": 415
},
{
"path": "js/nostr/watchHistory.js",
"lines": 2335,
"excess": 1335
},
{
"path": "js/nostrEventSchemas.js",
"lines": 3192,
"excess": 2192
},
{
"path": "js/payments/nwcClient.js",
"lines": 1642,
"excess": 642
},
{
"path": "js/services/authService.js",
"lines": 1343,
"excess": 343
},
{
"path": "js/services/commentThreadService.js",
"lines": 1122,
"excess": 122
},
{
"path": "js/services/hashtagPreferencesService.js",
"lines": 1451,
"excess": 451
},
{
"path": "js/services/moderationService.js",
"lines": 2140,
"excess": 1140
},
{
"path": "js/services/nostrService.js",
"lines": 2227,
"excess": 1227
},
{
"path": "js/services/playbackService.js",
"lines": 1316,
"excess": 316
},
{
"path": "js/services/r2Service.js",
"lines": 1194,
"excess": 194
},
{
"path": "js/state/cache.js",
"lines": 1829,
"excess": 829
},
{
"path": "js/subscriptions.js",
"lines": 2437,
"excess": 1437
},
{
"path": "js/ui/applicationBootstrap.js",
"lines": 1169,
"excess": 169
},
{
"path": "js/ui/components/EditModal.js",
"lines": 1130,
"excess": 130
},
{
"path": "js/ui/components/RevertModal.js",
"lines": 1509,
"excess": 509
},
{
"path": "js/ui/components/SimilarContentCard.js",
"lines": 1303,
"excess": 303
},
{
"path": "js/ui/components/UploadModal.js",
"lines": 1326,
"excess": 326
},
{
"path": "js/ui/components/VideoCard.js",
"lines": 3141,
"excess": 2141
},
{
"path": "js/ui/components/VideoModal.js",
"lines": 4976,
"excess": 3976
},
{
"path": "js/ui/loginModalController.js",
"lines": 2574,
"excess": 1574
},
{
"path": "js/ui/moreMenuController.js",
"lines": 1601,
"excess": 601
},
{
"path": "js/ui/overlay/popoverEngine.js",
"lines": 1070,
"excess": 70
},
{
"path": "js/ui/profileModalController.js",
"lines": 5572,
"excess": 4572
},
{
"path": "js/ui/views/VideoListView.js",
"lines": 1392,
"excess": 392
},
{
"path": "js/ui/zapController.js",
"lines": 1206,
"excess": 206
},
{
"path": "js/userBlocks.js",
"lines": 2403,
"excess": 1403
},
{
"path": "js/watchHistoryService.js",
"lines": 1400,
"excess": 400
},
{
"path": "js/webtorrent.js",
"lines": 1038,
"excess": 38
}
],
"new_list": []
}
@@ -0,0 +1,147 @@
{
"total_assignments": 37,
"files_count": 28,
"top_offenders": [
{
"path": "js/ui/dm/DMSettingsModalController.js",
"count": 3,
"is_new": false
},
{
"path": "js/ui/loginModalController.js",
"count": 3,
"is_new": false
},
{
"path": "js/ui/views/VideoListView.js",
"count": 3,
"is_new": false
},
{
"path": "js/viewManager.js",
"count": 3,
"is_new": false
},
{
"path": "js/utils/qrcode.js",
"count": 2,
"is_new": false
},
{
"path": "js/app/feedCoordinator.js",
"count": 1,
"is_new": false
},
{
"path": "js/app.js",
"count": 1,
"is_new": false
},
{
"path": "js/docsView.js",
"count": 1,
"is_new": false
},
{
"path": "js/exploreView.js",
"count": 1,
"is_new": false
},
{
"path": "js/forYouView.js",
"count": 1,
"is_new": false
},
{
"path": "js/index.js",
"count": 1,
"is_new": false
},
{
"path": "js/kidsView.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/EditModal.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/EmbedVideoModal.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/EventDetailsModal.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/UploadModal.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/VideoModal.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/components/nip71FormManager.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/AppShell.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/Composer.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/ConversationList.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/DMRelaySettings.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/MessageThread.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/dm/NotificationCenter.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/moreMenuController.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/profileModalController.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/subscriptionHistoryController.js",
"count": 1,
"is_new": false
},
{
"path": "js/ui/videoListViewController.js",
"count": 1,
"is_new": false
}
],
"violations": []
}
@@ -0,0 +1,11 @@
{
"total_failures": 0,
"files_with_errors": [],
"skipped_checks": [
{
"check": "lint:assets",
"reason": "Missing dist/asset-manifest.json.",
"details": "asset reference check (build required)."
}
]
}
@@ -0,0 +1,47 @@
43 grandfathered oversized file(s):
⚠ grandfathered: js/adminListStore.js (1078 lines)
⚠ grandfathered: js/app/authSessionCoordinator.js (1770 lines)
⚠ grandfathered: js/app/feedCoordinator.js (1767 lines)
⚠ grandfathered: js/app/playbackCoordinator.js (1217 lines)
⚠ grandfathered: js/app.js (5077 lines)
⚠ grandfathered: js/channelProfile.js (5579 lines)
⚠ grandfathered: js/feedEngine/stages.js (1388 lines)
⚠ grandfathered: js/historyView.js (2613 lines)
⚠ grandfathered: js/index.js (1409 lines)
⚠ grandfathered: js/nostr/client.js (4004 lines)
⚠ grandfathered: js/nostr/managers/SignerManager.js (1135 lines)
⚠ grandfathered: js/nostr/nip46Client.js (2104 lines)
⚠ grandfathered: js/nostr/nip46Connector.js (1094 lines)
⚠ grandfathered: js/nostr/nip71.js (1600 lines)
⚠ grandfathered: js/nostr/publishHelpers.js (1415 lines)
⚠ grandfathered: js/nostr/watchHistory.js (2335 lines)
⚠ grandfathered: js/nostrEventSchemas.js (3192 lines)
⚠ grandfathered: js/payments/nwcClient.js (1642 lines)
⚠ grandfathered: js/services/authService.js (1343 lines)
⚠ grandfathered: js/services/commentThreadService.js (1122 lines)
⚠ grandfathered: js/services/hashtagPreferencesService.js (1451 lines)
⚠ grandfathered: js/services/moderationService.js (2140 lines)
⚠ grandfathered: js/services/nostrService.js (2227 lines)
⚠ grandfathered: js/services/playbackService.js (1316 lines)
⚠ grandfathered: js/services/r2Service.js (1194 lines)
⚠ grandfathered: js/state/cache.js (1829 lines)
⚠ grandfathered: js/subscriptions.js (2437 lines)
⚠ grandfathered: js/ui/applicationBootstrap.js (1169 lines)
⚠ grandfathered: js/ui/components/EditModal.js (1130 lines)
⚠ grandfathered: js/ui/components/RevertModal.js (1509 lines)
⚠ grandfathered: js/ui/components/SimilarContentCard.js (1303 lines)
⚠ grandfathered: js/ui/components/UploadModal.js (1326 lines)
⚠ grandfathered: js/ui/components/VideoCard.js (3141 lines)
⚠ grandfathered: js/ui/components/VideoModal.js (4976 lines)
⚠ grandfathered: js/ui/loginModalController.js (2574 lines)
⚠ grandfathered: js/ui/moreMenuController.js (1601 lines)
⚠ grandfathered: js/ui/overlay/popoverEngine.js (1070 lines)
⚠ grandfathered: js/ui/profileModalController.js (5572 lines)
⚠ grandfathered: js/ui/views/VideoListView.js (1392 lines)
⚠ grandfathered: js/ui/zapController.js (1206 lines)
⚠ grandfathered: js/userBlocks.js (2403 lines)
⚠ grandfathered: js/watchHistoryService.js (1400 lines)
⚠ grandfathered: js/webtorrent.js (1038 lines)
No violations. 43 grandfathered file(s) remain as decomposition targets.
@@ -0,0 +1,30 @@
innerHTML usage: 37 assignments across 28 files
js/ui/dm/DMSettingsModalController.js: 3
js/ui/loginModalController.js: 3
js/ui/views/VideoListView.js: 3
js/viewManager.js: 3
js/utils/qrcode.js: 2
js/app/feedCoordinator.js: 1
js/app.js: 1
js/docsView.js: 1
js/exploreView.js: 1
js/forYouView.js: 1
js/index.js: 1
js/kidsView.js: 1
js/ui/components/EditModal.js: 1
js/ui/components/EmbedVideoModal.js: 1
js/ui/components/EventDetailsModal.js: 1
js/ui/components/UploadModal.js: 1
js/ui/components/VideoModal.js: 1
js/ui/components/nip71FormManager.js: 1
js/ui/dm/AppShell.js: 1
js/ui/dm/Composer.js: 1
js/ui/dm/ConversationList.js: 1
js/ui/dm/DMRelaySettings.js: 1
js/ui/dm/MessageThread.js: 1
js/ui/dm/NotificationCenter.js: 1
js/ui/moreMenuController.js: 1
js/ui/profileModalController.js: 1
js/ui/subscriptionHistoryController.js: 1
js/ui/videoListViewController.js: 1
+48
View File
@@ -0,0 +1,48 @@
> [email protected] lint
> npm run lint:css && npm run lint:hex && npm run lint:inline-styles && npm run lint:tokens && npm run lint:tailwind-brackets && npm run lint:tailwind-colors && npm run lint:file-size && npm run lint:innerhtml && npm run lint:assets && npm run lint:sw-compat
> [email protected] lint:css
> stylelint css/tailwind.source.css css/tokens.css css/docs.css
> [email protected] lint:hex
> node scripts/check-hex.js
> [email protected] lint:inline-styles
> node scripts/check-inline-styles.mjs
No inline style usage found.
> [email protected] lint:tokens
> node scripts/check-design-tokens.mjs --check=tokens
> [email protected] lint:tailwind-brackets
> node scripts/check-design-tokens.mjs --check=brackets
> [email protected] lint:tailwind-colors
> node scripts/check-tailwind-colors.mjs
> [email protected] lint:file-size
> node scripts/check-file-size.mjs
> [email protected] lint:innerhtml
> node scripts/check-innerhtml.mjs
> [email protected] lint:assets
> node scripts/check-asset-references.mjs
[lint:assets] Missing dist/asset-manifest.json. Skipping asset reference check (build required).
> [email protected] lint:sw-compat
> node scripts/check-sw-compat.mjs
[sw-compat] Skipping check: unable to determine HEAD^ or git history unavailable.
[sw-compat] No commit delta found; skipping compatibility check.
+29
View File
@@ -0,0 +1,29 @@
Title: `Audit Report — 2026-02-24 (unstable)`
**Summary**
* Date: 2026-02-24
**Metrics**
* Grandfathered oversized files: 43 files (total excess lines: 45288)
* New oversized files: 0 files (total excess lines: 0)
* Total innerHTML assignments: 37 (across 28 files)
* Top offenders:
1. js/ui/dm/DMSettingsModalController.js — 3
1. js/ui/loginModalController.js — 3
1. js/ui/views/VideoListView.js — 3
1. js/viewManager.js — 3
1. js/utils/qrcode.js — 2
* Lint failures: 0
**Delta vs previous (2026-02-21)**
* Grandfathered: +0 files, +72 excess lines
* innerHTML: +0 total assignments
* lint: +0 failures
**High-priority items**
**Artifacts**
* file-size-report.json
* innerhtml-report.json
* lint-report.json
* raw logs
View File
Whitespace-only changes.
View File
Whitespace-only changes.
@@ -0,0 +1,22 @@
# Audit Agent: Completed
**Date:** 2026-02-24
**Agent:** audit-agent
## Summary
The audit agent successfully executed the daily audit workflow.
### Artifacts Generated
- `artifacts/audit/2026-02-24/summary.md`: Markdown summary of the audit.
- `artifacts/audit/2026-02-24/file-size-report.json`
- `artifacts/audit/2026-02-24/innerhtml-report.json`
- `artifacts/audit/2026-02-24/lint-report.json`
### Key Findings
- **Grandfathered oversized files:** 43 files (45288 excess lines).
- **New oversized files:** 0.
- **InnerHTML assignments:** 37 (28 files).
- **Lint failures:** 0.
### Next Steps
- Review `artifacts/audit/2026-02-24/summary.md` for detailed metrics.
-160
View File
@@ -1,160 +0,0 @@
# Test Log 2026-02-24
Command: npm run test:unit
Full log saved to: test-audit/unit-test-run.log (gitignored)
## Last 100 lines of output:
# Subtest: VideoSettingsMenuController - closeMenu closes popover
ok 2 - VideoSettingsMenuController - closeMenu closes popover
---
duration_ms: 0.422664
type: 'test'
...
# Subtest: VideoSettingsMenuController - requestMenu toggles if open
ok 3 - VideoSettingsMenuController - requestMenu toggles if open
---
duration_ms: 0.282361
type: 'test'
...
# Subtest: VideoSettingsMenuController - closeAll closes all popovers
ok 4 - VideoSettingsMenuController - closeAll closes all popovers
---
duration_ms: 0.473886
type: 'test'
...
1..4
# tests 4
# suites 0
# pass 4
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 15.318827
→ Running tests/webtorrent-handlers.test.mjs
TAP version 13
# Subtest: TorrentClient Handlers
# Subtest: handleTorrentStream (chrome) should set up video correctly
ok 1 - handleTorrentStream (chrome) should set up video correctly
---
duration_ms: 21.117274
type: 'test'
...
[bitvid] CORS warning detected. Attempting to remove the failing webseed/tracker.
[bitvid] Cleaned up webseeds => [ 'http://good.com/video.mp4' ]
[bitvid] Cleaned up trackers => [ 'ws://good.com' ]
# Subtest: handleTorrentStream (firefox) should set up video correctly with highWaterMark
ok 2 - handleTorrentStream (firefox) should set up video correctly with highWaterMark
---
duration_ms: 20.907886
type: 'test'
...
# Subtest: handleTorrentStream (chrome) should handle CORS warning logic
ok 3 - handleTorrentStream (chrome) should handle CORS warning logic
---
duration_ms: 1.320234
type: 'test'
...
1..3
ok 1 - TorrentClient Handlers
---
duration_ms: 45.425269
type: 'suite'
...
1..1
# tests 3
# suites 1
# pass 3
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 59.663698
→ Running tests/webtorrent-regression.test.mjs
TAP version 13
# Subtest: WebTorrent Regression Tests
# Subtest: probePeers should report healthy if webseed is present even with 0 peers
ok 1 - probePeers should report healthy if webseed is present even with 0 peers
---
duration_ms: 7.965928
type: 'test'
...
# Subtest: probePeers should report unhealthy if no webseed and 0 peers
ok 2 - probePeers should report unhealthy if no webseed and 0 peers
---
duration_ms: 51.301294
type: 'test'
...
1..2
ok 1 - WebTorrent Regression Tests
---
duration_ms: 61.785594
type: 'suite'
...
1..1
# tests 2
# suites 1
# pass 2
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 69.636843
✔ All unit tests passed
# Test Audit Report: 2026-02-24
## Summary
- **Date:** 2026-02-24
- **Agent:** test-audit-agent
- **Command:** `npm run test:unit`
- **Result:** PASSED (Initial Run)
- **Flakiness:** DETECTED (Failure in subsequent run)
## Test Execution
The unit test suite was executed using the native Node.js test runner (`scripts/run-unit-tests.mjs`).
- **Initial Run:** Passed (Duration: ~70s)
- **Log:** `test_logs/TEST_LOG_2026-02-24.md`
## Flakiness Detection
The suite was re-run to detect flakiness.
- **Iterations Planned:** 3
- **Iterations Completed:** 1 (Timed out after 340s)
- **Result:** FAILED
- **Details:** The first iteration of the flakiness check failed and took significantly longer (340s) than the initial run (70s), indicating severe resource contention or non-deterministic behavior that causes hangs/timeouts.
## Static Analysis & Suspicious Tests
### Zero Assertions
The following test files contain `describe`/`test` blocks but no standard assertion keywords (`expect`, `assert`, etc.). These may be "execution only" tests or use custom assertions not detected by the heuristic.
- `tests/e2e/cache-upgrade-smoke.spec.ts`
- `tests/embed_playback_check.spec.mjs`
- `tests/minimal-webtorrent.test.mjs`
- `tests/ui/components/debug_hashtag_strip_helper.test.mjs`
- `tests/visual/reduced-motion.spec.ts`
### Skipped Tests
- `tests/nostr/sessionActor.test.mjs`: Line 20 - `t.skip("WebCrypto not available in this environment")`
### Anti-Patterns
- **Timing Dependence:** 100+ occurrences of `setTimeout`, `sleep`, or `delay` found. This suggests tests are relying on real time, which contributes to the observed slowness and flakiness.
- **Console Usage:** 100+ occurrences of `console.log/warn/error` in source and tests.
## Coverage
Code coverage metrics are currently unavailable because the project uses `vitest` in devDependencies but the custom `scripts/run-unit-tests.mjs` runner (using `node:test`) does not invoke it or pass `--experimental-test-coverage`.
## Remediation Plan
1. **Investigate Flakiness:** The discrepancy between the initial pass (70s) and the subsequent fail/timeout (340s) is critical. Investigate `tests/minimal-webtorrent.test.mjs` and other tests relying on network/timers.
2. **Fix Zero Assertions:** Review the 5 files listed above. Add explicit assertions.
3. **Reduce Console Noise:** Clean up `console.log` calls in tests to reduce I/O overhead.
4. **Enable Coverage:** Update `scripts/run-unit-tests.mjs` to support coverage collection.
View File
Whitespace-only changes.