lumitrace 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/spec.md +79 -1
- data/docs/tutorial.ja.md +4 -0
- data/docs/tutorial.md +4 -0
- data/lib/lumitrace/generate_resulted_html.rb +323 -391
- data/lib/lumitrace/generate_resulted_html_renderer.js +774 -0
- data/lib/lumitrace/record_instrument.rb +79 -22
- data/lib/lumitrace/version.rb +1 -1
- data/lib/lumitrace.rb +31 -4
- data/runv/index.html +1182 -420
- data/runv/sync_inline.rb +13 -1
- data/test/test_lumitrace.rb +137 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb5fe18ff96f6cea6cac519424f9d7a3ead8e4ce4f9be3ad2db7ddde2804302e
|
|
4
|
+
data.tar.gz: 17c83251a9b042481e297422f2ddcad5f923a890f52202331e3fc85e28a9e888
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb65e28bfad568fb9aaff142a4ee0150e49b8f37cf8ffb99508c706691a710310119b23826942668874a60a6189a91732367389581bd056a9cdc09592a286d0a
|
|
7
|
+
data.tar.gz: dbbbfb431b4a957f186a93a849949fac88b54ed8408b9d761550c0eeb76055195f589e4ca9dfdd23152854ed156be6d13172337a555441bf0960d05825ef7332
|
data/docs/spec.md
CHANGED
|
@@ -267,12 +267,21 @@ lumitrace [options] exec CMD [args...]
|
|
|
267
267
|
## HTML Rendering
|
|
268
268
|
|
|
269
269
|
- `GenerateResultedHtml.render_all` renders all files in one page.
|
|
270
|
+
- Generated HTML is a single self-contained file (no external fetch): it embeds source/trace data as JSON and renders DOM with JavaScript.
|
|
271
|
+
- JavaScript is required to render the code/trace view (a `<noscript>` message is shown otherwise).
|
|
270
272
|
- The page header shows the active collect mode:
|
|
271
273
|
- `Mode: last (last value)`
|
|
272
274
|
- `Mode: types (type counts)`
|
|
273
275
|
- `Mode: history (last N sample[s])`
|
|
274
276
|
- In `history`, `N` uses configured `max_samples` when available; otherwise it is inferred from the loaded events.
|
|
275
277
|
- Each file is shown in its own section.
|
|
278
|
+
- When multiple files are present, the HTML UI shows a left file tree and a single-file viewer on the right.
|
|
279
|
+
- Selecting a file in the tree switches the visible file without reloading the page.
|
|
280
|
+
- The selected file is reflected in the URL hash as `#file=...` (using the rendered file path label) so links can open a specific file view.
|
|
281
|
+
- Clicking a line number updates the URL hash to include the selected line (for example `#file=lib/foo.rb&line=42`).
|
|
282
|
+
- When the HTML is opened with a file+line hash, the renderer selects that file and scrolls to the target line.
|
|
283
|
+
- File tree items show line coverage as `(executed_lines / lines_with_expressions)` for a quick per-file overview.
|
|
284
|
+
- Files with no instrumentable expressions do not show a coverage count.
|
|
276
285
|
- Expressions are marked with an inline icon (`🔎` for executed, `∅` for not hit).
|
|
277
286
|
- Hovering the icon shows recorded values.
|
|
278
287
|
- Only the last 3 values are shown in the tooltip as `value (Type)`; additional values are summarized as `... (+N more)`.
|
|
@@ -280,10 +289,79 @@ lumitrace [options] exec CMD [args...]
|
|
|
280
289
|
- When ranges are used, skipped sections are shown as `...` in the line-number column.
|
|
281
290
|
- Lines where all instrumentable expressions are unexecuted are highlighted in a light red. If a line mixes executed and unexecuted expressions, only the unexecuted expressions are highlighted.
|
|
282
291
|
|
|
292
|
+
### HTML Payload Schema (`v1`)
|
|
293
|
+
|
|
294
|
+
- The generated HTML embeds a JSON payload in:
|
|
295
|
+
- `<script id="lumitrace-payload" type="application/json">...</script>`
|
|
296
|
+
- Payload top-level shape:
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"version": 1,
|
|
301
|
+
"meta": {
|
|
302
|
+
"mode": "last|types|history",
|
|
303
|
+
"mode_text": "Mode: ...",
|
|
304
|
+
"max_samples": 3
|
|
305
|
+
},
|
|
306
|
+
"files": [
|
|
307
|
+
{
|
|
308
|
+
"path": "/abs/path/to/file.rb",
|
|
309
|
+
"display_path": "path/to/file.rb",
|
|
310
|
+
"source": "file contents...",
|
|
311
|
+
"ranges": [[1, 10], [20, 30]],
|
|
312
|
+
"trace": [
|
|
313
|
+
{
|
|
314
|
+
"location": [1, 0, 1, 5],
|
|
315
|
+
"kind": "expr|arg",
|
|
316
|
+
"name": "x",
|
|
317
|
+
"sampled_values": [{"type": "Integer", "preview": "1"}],
|
|
318
|
+
"types": {"Integer": 3},
|
|
319
|
+
"total": 3
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
- `version`:
|
|
328
|
+
- Payload schema version for the embedded HTML renderer. Current version is `1`.
|
|
329
|
+
- `meta.mode`:
|
|
330
|
+
- Effective collect mode used for display (`last`, `types`, `history`).
|
|
331
|
+
- `meta.mode_text`:
|
|
332
|
+
- Human-readable label shown in the HTML header.
|
|
333
|
+
- `meta.max_samples`:
|
|
334
|
+
- Effective/inferred max samples for `history`; may be `null`.
|
|
335
|
+
- `files[]`:
|
|
336
|
+
- One entry per rendered source file.
|
|
337
|
+
- `files[].path`:
|
|
338
|
+
- Absolute path used internally to associate trace events with source.
|
|
339
|
+
- `files[].display_path`:
|
|
340
|
+
- Path label shown in the HTML report (typically root-relative).
|
|
341
|
+
- Multi-file HTML navigation and URL hash (`#file=...`, `#file=...&line=...`) use this value as the file key.
|
|
342
|
+
- `files[].source`:
|
|
343
|
+
- Full Ruby source text for that file.
|
|
344
|
+
- `files[].ranges`:
|
|
345
|
+
- Normalized line ranges as inclusive `[start_line, end_line]` pairs, or `null` when unrestricted.
|
|
346
|
+
- `files[].trace[]`:
|
|
347
|
+
- Trace events for that file only (`file` is intentionally omitted from each event).
|
|
348
|
+
- `files[].trace[].location`:
|
|
349
|
+
- Location tuple `[start_line, start_col, end_line, end_col]`.
|
|
350
|
+
- `files[].trace[].kind`:
|
|
351
|
+
- Event kind (`expr` or `arg`).
|
|
352
|
+
- `files[].trace[].name`:
|
|
353
|
+
- Argument name when `kind=arg`; otherwise `null`.
|
|
354
|
+
- `files[].trace[].sampled_values`:
|
|
355
|
+
- Normalized sampled values (or synthesized `last_value` entry when collect mode is `last`).
|
|
356
|
+
- `files[].trace[].types`:
|
|
357
|
+
- Type counts map, normalized as `{ "TypeName": count }`.
|
|
358
|
+
- `files[].trace[].total`:
|
|
359
|
+
- Total execution count for the location.
|
|
360
|
+
|
|
283
361
|
### Copy/Paste Behavior
|
|
284
362
|
|
|
285
363
|
- Inline icon uses a separate marker span to reduce copy/paste artifacts.
|
|
286
|
-
- Lines are rendered as
|
|
364
|
+
- Lines are rendered as per-line block spans to keep copy/paste artifacts small while preserving line alignment.
|
|
287
365
|
|
|
288
366
|
## Known Limitations
|
|
289
367
|
|
data/docs/tutorial.ja.md
CHANGED
|
@@ -130,6 +130,10 @@ HTML について:
|
|
|
130
130
|
- 引数の値は HTML では `🧷` で表示されます。
|
|
131
131
|
- 記録対象の式がすべて未実行の行は薄い赤で表示され、混在行では未実行の式のみ薄赤になります。
|
|
132
132
|
- 範囲指定時の省略は行番号欄に `...` が入ります。
|
|
133
|
+
- 複数ファイルが含まれる場合は、左側のファイルツリーで表示ファイルを切り替えられます。
|
|
134
|
+
- ファイルツリーには、ファイルごとの行カバレッジが `(実行行数/式のある行数)` で表示されます。
|
|
135
|
+
- 選択中ファイルは URL ハッシュ(`#file=...`)に反映されるため、URL を共有するとそのファイル表示を開けます。
|
|
136
|
+
- 行番号をクリックすると、その行を含む URL ハッシュ(`#file=...&line=...`)に更新され、同じファイル・行を開けます。
|
|
133
137
|
|
|
134
138
|
### 範囲指定の例
|
|
135
139
|
|
data/docs/tutorial.md
CHANGED
|
@@ -130,6 +130,10 @@ HTML notes:
|
|
|
130
130
|
- Argument values show `🧷` in HTML.
|
|
131
131
|
- Lines where all instrumentable expressions are unexecuted are shaded light red; mixed lines only shade the unexecuted expressions.
|
|
132
132
|
- When ranges are used, skipped sections are shown as `...` in the line-number column.
|
|
133
|
+
- When multiple files are included, use the left file tree to switch files.
|
|
134
|
+
- The file tree shows per-file line coverage as `(executed/expression-lines)`.
|
|
135
|
+
- The selected file is stored in the URL hash (`#file=...`), so copying the URL shares a direct link to that file view.
|
|
136
|
+
- Click a line number to update the URL with that line (`#file=...&line=...`) and open the same file+line later.
|
|
133
137
|
|
|
134
138
|
### Range example
|
|
135
139
|
|