Commit Graph
21 Commits
Author SHA1 Message Date
thePR0M3TH3ANandClaude Opus 4.8 4e5bfaa6af [playback] harden WebTorrent streaming + add forced-source test deep links
WebTorrent (handleTorrentStream) hardening:
- Resolve only when playback is actually viable (loadeddata/canplay/playing),
  not the instant streamTo() is called. A dead/too-slow swarm is no longer
  reported as success, so the caller's fallback can run.
- Pre-playback torrent errors reject (caller falls back); post-playback errors
  go to an onPlaybackError hook instead of a dead reject().
- Mid-stream stall watchdog surfaces an onStall hook ("waiting for peers").
- Fix a <video> listener leak: stream listeners are tracked and torn down
  before the next stream and on cleanup() (the modal reuses one element).
- Stream the largest decodable file from a multi-file torrent and deselect the
  rest (wider ext set: mp4/m4v/webm/mkv/mov/ogv/ogg) so the swarm isn't spent
  downloading files we never play.
playbackCoordinator wires onStall/onPlaybackError to user-facing status.

Forced-source deep links (test affordance):
- The main app honors ?v=<nevent>&playback=torrent|url (mirrors the embed
  player) to force a playback path; a missing source shows a clear message.
- The video share menu gains "Copy WebTorrent URL" / "Copy CDN URL" items that
  copy the forced-source deep link (disabled with a reason when unavailable).

Tests: webtorrent-handlers (resolve-on-readiness, pre/post-ready errors, stall
fires/clears, largest-file select/deselect, no listener accumulation),
playback-forced-source (param normalization), videoMenuRenderers (copy items +
availability). All mutation-verified.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-18 12:15:27 -04:00
thePR0M3TH3AN a41c78bc0f Merge branch 'unstable' into agents/daily/style-agent-2026-02-26-17149479282532484205 2026-03-02 21:41:14 -05:00
thePR0M3TH3AN 444b39da6c Merge branch 'unstable' into agents/daily/test-audit-agent-nostr-tools-v2-11614128753134538673 2026-02-26 23:31:26 -05:00
google-labs-jules[bot]andPR0M3TH3AN 96f630a738 Fix nostr-tools v2 compatibility and test quality issues
- js/nostr/nip46Client.js: Convert hex keys to Uint8Array before calling nip44.v2 functions. Remove .bind() from getConversationKey getters to fix context issues.
- js/ui/components/RevertModal.js: Remove duplicate imports and variable declarations causing SyntaxErrors.
- tests/compliance/nip04_44_compliance.test.mjs: Update test setup to mock nostr-tools.utils and pass byte keys.
- tests/nostr/dm-direct-message-flow.test.mjs: Update setupDmScenario to pass byte keys to getPublicKey and finalizeEvent.
- tests/nostr/nip46Client.test.js: Update tests to handle byte vs hex keys correctly for nostr-tools v2.
- tests/minimal-webtorrent.test.mjs: Add explicit assertions.
- tests/ui/components/debug_hashtag_strip_helper.test.mjs: Add explicit assertions.
- artifacts/test-audit-report.md: Add audit report.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-27 03:43:14 +00:00
thePR0M3TH3AN 34b0b03ad0 Merge branch 'unstable' into agents/daily/torch-garbage-collection-agent-2026-02-26-15639715828522871125 2026-02-26 21:42:21 -05:00
thePR0M3TH3AN 8d6e32be27 Merge branch 'unstable' into agents/daily/style-agent-1740615175-12694853261144843326 2026-02-26 21:40:23 -05:00
thePR0M3TH3AN 9448624753 Merge branch 'unstable' into agents/daily/todo-triage-agent-13829754158937187173 2026-02-26 21:38:12 -05:00
google-labs-jules[bot]andPR0M3TH3AN 5c2ba17459 chore: garbage collection and maintenance fixes
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-27 02:32:53 +00:00
google-labs-jules[bot]andPR0M3TH3AN 089556acd1 chore(todo-triage): daily scan and minor fixes
- Ran `todo-triage-agent` scan (0 actionable items found).
- Fixed inline style lint error in `tests/ui/components/DeleteModal.test.mjs`.
- Fixed duplicate import syntax error in `js/ui/components/RevertModal.js`.
- Initialized `modalNavScrollHandler` in `VideoModal` constructor to improve test stability.
- Updated scheduler memory.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-27 02:14:06 +00:00
google-labs-jules[bot]andPR0M3TH3AN fb9e6ef769 chore(ai): execute style-agent maintenance and fix lint mock
- Ran `npm run format` (no changes)
- Ran `npx stylelint --fix` (no changes)
- Fixed `lint:inline-styles` failure in `tests/ui/components/DeleteModal.test.mjs` by using `Object.defineProperty` for the `style` mock property instead of direct assignment.
- Verified all lint checks pass.
- Task log: `torch/task-logs/daily/2026-02-27T00-06-51Z__style-agent__completed.md`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-27 00:10:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN 31590ff0d2 chore(test): fix inline-style lint error in DeleteModal test mock
- Replace direct `this.style = {}` assignment with `Object.defineProperty` in `MockElement` class.
- Resolves `npm run lint:inline-styles` failure flagged during daily maintenance.
- No functional changes to test logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 22:09:08 +00:00
google-labs-jules[bot]andPR0M3TH3AN 62865fa9ac chore(ai): apply formatting/lint autofixes and fix inline style violation
- Fixed direct `.style` assignment in `tests/ui/components/DeleteModal.test.mjs` to comply with linting rules.
- Verified linting and formatting across the repository.
- Published daily task log and completion event via TORCH.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 20:06:57 +00:00
thePR0M3TH3AN 475e1f71f1 Merge branch 'unstable' into refactor/delete-modal-dtag-extraction-9801703157260752806 2026-02-26 14:41:48 -05:00
thePR0M3TH3AN de80e58b5d Merge pull request #2725 from PR0M3TH3AN/refactor-delete-modal-dtag-919037621417068012
Refactor DeleteModal to use shared getDTagValueFromTags utility
2026-02-26 13:04:19 -05:00
google-labs-jules[bot]andPR0M3TH3AN 2703382ab4 Refactor RevertModal rendering logic into separate module
Extracted excessive DOM rendering logic from `RevertModal.js` into `revertModalRenderers.js`.
This improves code readability and maintainability by separating the view construction from the modal logic.
Added unit tests for the new renderers using a lightweight DOM mock.
Replaced local d-tag extraction with shared utility `getDTagValueFromTags`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:50:10 +00:00
google-labs-jules[bot]andPR0M3TH3AN 822ba4d478 Refactor DeleteModal to use shared getDTagValueFromTags
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` to reduce code duplication and improve maintainability.

Added `tests/ui/components/DeleteModal.test.mjs` with manual DOM mocks to verify the refactor and ensure no regressions.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:39:38 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4bdcfbdb2e Refactor: Replace duplicated extractDTagValue in DeleteModal
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` (exported via `js/nostr/index.js`).

Added a new unit test `tests/ui/components/DeleteModal.test.mjs` to verify the d-tag extraction logic and ensure the refactor is correct and safe. This test uses `jsdom` to mock the necessary DOM environment.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:39:07 +00:00
google-labs-jules[bot]andPR0M3TH3AN 54be0efcac [decompose] extract helpers from js/ui/components/VideoModal.js
Decomposed js/ui/components/VideoModal.js by extracting "Similar Video" and "Pointer Key" logic into a new helper module js/ui/components/VideoModalSimilarHelpers.js.

- Reduced VideoModal.js line count from 6334 to 6045.
- Added comprehensive unit tests for extracted helpers.
- Updated check-file-size.mjs baseline.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-14 11:46:47 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7dc5342714 fix: Ensure ResizeObserver is undefined in global scope for fallback tests
- The `setup-localstorage.mjs` test helper polyfills `ResizeObserver` on `globalThis`, which prevented `HashtagStripHelper` from falling back to `window.resize` logic during testing.
- Updated `tests/ui/components/hashtagStripHelper.test.mjs` to temporarily unset `globalThis.ResizeObserver` during tests that verify fallback behavior.
- Ensures the component correctly detects the absence of `ResizeObserver` and falls back to `requestAnimationFrame` or `setTimeout` mechanisms.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 02:00:10 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2469828d0f test: Add comprehensive tests for HashtagStripHelper resize logic
- Added `tests/ui/components/hashtagStripHelper.test.mjs` to test `ResizeObserver` integration, fallback mechanisms (RAF/setTimeout), and teardown.
- Implemented robust mocks for `ResizeObserver`, `requestAnimationFrame`, and `setTimeout` within `createDom` helper.
- Verified correct behavior for resize events and cleanup.
- Ensured test data matches `collectVideoTags` expected structure.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:14:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4d93ed25ce 🧪 Add tests for video menu renderers
Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:15:02 +00:00