Commit 93adf30
Removed dead code and consolidated repeated helpers (#53)
* Removed the orphaned payload and annotations modules
src/lib/payload.ts and src/lib/annotations.ts have had no importer in
src/ since #8 and #41 respectively replaced the flows that used them;
only their own unit tests kept them reachable. Deleted both, along with
the types in lib/types.ts that existed solely to serve them (the
Extracted* union, the annotations document shapes, PayloadMetadata,
OutputKind, ImageFormat and PackagingType). TrimMode stays, being what
lib/ffmpeg.ts and lib/extract.ts read.
Also removed two other exports nothing references at all — format.ts's
blobSize and testInjection.ts's testInjectionOrInert with its INERT
constant — and moved archives.ts's "A video file in the archive" comment
back onto ArchiveVideo, which a reorder had left it detached from.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Bumped the version and noted the cleanup in the changelog
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Removed four more exports nothing in the app calls
All four were reachable only from their own unit tests, which went with
them:
- sanitize.ts's sanitizePath, which was the same algorithm as
bidsPath.ts's behAssetPath, the one the delivery path actually calls
- sanitize.ts's sanitizeFilename, left behind once every filename the
app writes came to be built from BIDS entities instead
- blur.ts's hitRegion, a geometric point-in-circle test the blur tool
does not use — it hit-tests through the focusable rings in the DOM
- the sourceName field on ExtractFrameParams and ExtractOverlayParams,
which main.ts filled in but neither function ever read. Kept on
ExtractClipParams, which reads it for the source's extension.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Folded repeated helpers together across lib/
Five shapes that had been written out more than once, now written once:
- lib/etag.ts drove the same 16MB chunk loop, short-read guard and all,
three times over. All three hashes are now one pass of `eachChunk`,
differing only in which digest the bytes go into.
- The NFKD-then-strip-combining-marks fold opening both
`sanitizeSegment` and `bidsLabel` is now `foldDiacritics`.
- The libx264/faststart argument list is now `X264_MP4_ARGS`, shared by
lib/ffmpeg.ts's own encodes and lib/extract.ts's overlay. `-an` stays
out of it and is added by the paths that have audio to drop: the
overlay's input is a PNG sequence, and the command string is quoted
verbatim as that file's `encoding` in its sidecar.
- Decoding one sample to read its pixel format is now
`decodedPixelFormatAt`, called by lib/videoFormat.ts and by
lib/streaming.ts, which passes the frame its own index already names.
- The dandiset-listing response shape, its title fallback and the
next-page cursor are now declared once in lib/api.ts rather than
copied between lib/dandisets.ts and lib/embargoed.ts.
lib/upload.ts's own next-page handling is left alone deliberately: it
strips the API prefix with `replace` rather than a prefix check, which
differs from `nextPagePath` on a foreign URL that happens to contain the
API base, so sharing the helper there would not be behavior-neutral.
Verified against the full integration suite, including the four
expectedOutput specs that byte-compare every emitted sidecar and
dataset_description.json.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Consolidated the repeated shapes inside main.ts
Nothing moves out of the file and no signature changes; these are its
own repetitions written once:
- browseEmpty is now browseNote with the list cleared first, which is
all it ever was.
- The three status-line setters share applyHintClass, so the classes
showsOutcome reads back cannot drift between them.
- Every JSON a delivery writes — the extract's sidecar, the companions'
and the three dataset_description.json files — goes out through
deliverJson rather than four copies of serialize, hash and hand over.
- pictureTechnicalFields picks BEP047's image or video keys once, for
both the extract and its pose overlay.
- The trim track's ruler and the overview's share appendTick. Their
at-end thresholds differ (0.96 and 0.97) and are preserved exactly,
passed in as RulerStyle.atEnd; whether that difference is deliberate
is asked in #54 rather than settled here.
- The dozen nested Math.max/Math.min clamps now call timeline.ts's own
clamp, which was already there and private.
- Two reads of `?test`'s faked counts, fakedDatasetCount and
fakedListingCount, replace five spellings of the same null check.
- wireSeg reads a button's dataset value once per click instead of
twice.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Tidied the mock-video synthesizers
The three synthesizers in lib/testInjection.ts each set up their own
canvas and each drew their own frame; both are now mockCanvas() and
paintMockFrame(), with the hue step and the caption passed in since
those are the only parts that actually differed.
Also simplified the two nested ternaries deriving mock_video's and
mock_video_long's frame counts — intParam has already dealt with
anything unparseable, so only a deliberate `=0` is left to reject — and
wrote FROM_EMBER_PATH_PREFIX as the literal it always evaluated to
rather than running pad2 over two constants.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Moved the blur tool into ui/blurTool.ts
The rings over the picture, the controls beside them and the bookkeeping
keeping the two in step were 275 lines in the middle of main.ts. They
are now their own module, reached through createBlurTool(els, host).
A pure move: every function keeps its body, its name and its comment,
and the order blurChanged does its work in is preserved exactly, since
the delivery card reads the areas as it re-derives itself.
The areas themselves stay in state.blurRegions rather than moving into
the tool — the player draws them, the delivery card decides on them and
every extraction carries them, so the tool mutates the one array all of
those already see. What it needed from the page around it (whether a
video is loaded, whether a delivery is running, whether the
human-subjects gate offers the tool at all, and what to retire when the
areas change) is the BlurToolHost it is handed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Moved the EMBER browse pane into ui/browsePane.ts
The pane was 499 lines in the middle of main.ts and reached the rest of
the page through four names: browseSay, refreshBrowse, syncBrowseToAuth,
and the browse state itself as a "has this been read yet" check. Those
are now say, refresh, syncToAuth and opened on the object
createBrowsePane returns.
A pure move, function for function — the only body to change is
listOwnedEmbargoed's, which asked the archive for the signed-in username
and cached it in main.ts's own currentUser. That caching stays where the
header avatar and the provenance record can share it, and the pane asks
for the answer through host.username instead.
What it needs from the page around it is the BrowsePaneHost it is
handed: the sign-in state, a config to call the archive under, the
player a picked video opens in, and the stage that answers for a video
asked for anywhere else. browseFailure stays in main.ts beside
stageFailure, since the two are a pair — a refusal is said in whichever
of the two places the video was asked for, and never in both.
main.ts is 3199 lines, down from 3919 before this pass began.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
* Dropped the changelog entry for this pass
Per review. package.json stays at 1.4.2, so the entry under that heading
is the author's to write.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeLYzRaTJ7oFj6fmAYmC8x
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 5143eea commit 93adf30
27 files changed
Lines changed: 1225 additions & 1614 deletions
File tree
- src
- lib
- ui
- tests/unit
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
| |||
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 56 | | |
65 | 57 | | |
66 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 20 | | |
32 | 21 | | |
33 | 22 | | |
| |||
72 | 61 | | |
73 | 62 | | |
74 | 63 | | |
75 | | - | |
| 64 | + | |
76 | 65 | | |
77 | 66 | | |
78 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 14 | | |
27 | 15 | | |
28 | 16 | | |
| |||
48 | 36 | | |
49 | 37 | | |
50 | 38 | | |
51 | | - | |
| 39 | + | |
52 | 40 | | |
53 | 41 | | |
54 | 42 | | |
| |||
90 | 78 | | |
91 | 79 | | |
92 | 80 | | |
93 | | - | |
| 81 | + | |
94 | 82 | | |
95 | 83 | | |
96 | 84 | | |
| |||
146 | 134 | | |
147 | 135 | | |
148 | 136 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 137 | + | |
152 | 138 | | |
153 | 139 | | |
154 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | | - | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
67 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
| |||
103 | 117 | | |
104 | 118 | | |
105 | 119 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 120 | + | |
113 | 121 | | |
114 | | - | |
115 | 122 | | |
116 | | - | |
| 123 | + | |
117 | 124 | | |
118 | 125 | | |
119 | 126 | | |
| |||
126 | 133 | | |
127 | 134 | | |
128 | 135 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 136 | + | |
136 | 137 | | |
137 | | - | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
0 commit comments