neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
Log in to mark this repository.
Merge branch 'worktree-agent-a2e045d79740ba237'
71fde20 · gmorell · 2026-12-02 04:28
Files changed
modified
Dockerfile
+9
−6
| 17 | 17 | FROM ${BUILDER_IMAGE} AS builder |
| 18 | 18 | |
| 19 | 19 | # Build tools only: |
| 20 | −# * build-essential — bcrypt's C NIF, and the linker for the Rust NIFs | |
| 20 | +# * build-essential — bcrypt's C NIF, the linker for the Rust NIFs, and | |
| 21 | +# the C compiler zstd-sys builds zstd's vendored sources with (statically, | |
| 22 | +# for vigil_symbolic) | |
| 21 | 23 | # * git — the heroicons and daisyui dependencies are git checkouts, and |
| 22 | 24 | # neiam_auth comes from the forge over HTTPS |
| 23 | 25 | # * curl, ca-certificates — to bootstrap rustup |
| 28 | 30 | && apt-get clean && rm -rf /var/lib/apt/lists/* |
| 29 | 31 | |
| 30 | 32 | # Rust via rustup, pinned, for the NIF crates in native/ (vigil_codec, |
| 31 | −# vigil_ua, vigil_sourcemap), which Rustler builds from source during | |
| 32 | −# `mix compile`: nothing precompiled is downloaded. The crates' MSRV is | |
| 33 | −# 1.91; this is the toolchain gitgud builds with, and the one CI runs | |
| 34 | −# clippy and rustfmt with (.forgejo/workflows/checks.yml). The crates are | |
| 35 | −# pure Rust, so neither image needs a system library for them. | |
| 33 | +# vigil_ua, vigil_sourcemap, vigil_symbolic), which Rustler builds from | |
| 34 | +# source during `mix compile`: nothing precompiled is downloaded. The | |
| 35 | +# crates' MSRV is 1.91; this is the toolchain gitgud builds with, and the | |
| 36 | +# one CI runs clippy and rustfmt with (.forgejo/workflows/checks.yml). The | |
| 37 | +# crates link nothing from the system (vigil_symbolic's zstd is compiled in | |
| 38 | +# statically), so neither image needs a system library for them. | |
| 36 | 39 | ENV RUSTUP_HOME=/usr/local/rustup \ |
| 37 | 40 | CARGO_HOME=/usr/local/cargo \ |
| 38 | 41 | PATH=/usr/local/cargo/bin:${PATH} \ |
modified
NOTICE.md
+8
−0
| 50 | 50 | `utils/strings.py`, via GlitchTip's vendored copy), and the grouping |
| 51 | 51 | fixtures in `test/fixtures/grouping/` (`tests/sentry/grouping/`). |
| 52 | 52 | |
| 53 | +Native (slice 12): how a minidump becomes an event in `Vigil.Minidumps` | |
| 54 | +(crash reason, "Fatal Error"/"Assertion Error" values, the synthetic | |
| 55 | +`minidump` mechanism and its "Invalid Minidump" placeholder, the crashed | |
| 56 | +thread's stack trace on the exception, OS and device contexts; from | |
| 57 | +`lang/native/processing.py` and `lang/native/minidump.py`), and the | |
| 58 | +minidump fixture `test/support/fixtures/native/linux.dmp` | |
| 59 | +(`tests/fixtures/native/linux.dmp`). | |
| 60 | + | |
| 53 | 61 | > Copyright (c) 2019 Sentry (https://sentry.io) and individual contributors. |
| 54 | 62 | > All rights reserved. |
| 55 | 63 | > |
modified
ROADMAP.md
+8
−1
| 187 | 187 | | `vigil_codec` | Brotli decode with an output cap, on the `brotli` crate. ex_brotli (MIT) was considered, but its `decompress/1` reads to the end with no limit (a decompression bomb at the ingest edge) and fetches precompiled binaries by default, so the crate lives here | 1 | |
| 188 | 188 | | `vigil_ua` | User-Agent to browser, OS and device contexts, on the `uaparser` crate with the uap-core regexes compiled in | 2 | |
| 189 | 189 | | `vigil_sourcemap` | JS symbolication on the `sourcemap` crate (debug ids, index maps, `sourcesContent` context lines), plus zip and manifest reading for artifact bundles | 5 | |
| 190 | −| `vigil_symbolic` | Native, Proguard and minidump symbolication on `symbolic` and `minidump`. Optional; last | 12 | | |
| 190 | +| `vigil_symbolic` | Debug files, SymCaches and native symbolication on symbolic 12, Proguard deobfuscation on `proguard`, and minidump unwinding on rust-minidump | 12 | | |
| 191 | 191 | |
| 192 | 192 | --- |
| 193 | 193 |
| 496 | 496 | |
| 497 | 497 | ### 12. Native, mobile and the `vigil` CLI · large |
| 498 | 498 | - Debug information file assemble (`/projects/{o}/{p}/files/difs/assemble/`), Proguard mappings, minidump processing, and native and JVM symbolication through `vigil_symbolic`. |
| 499 | + - **As built (native):** | |
| 500 | + - `vigil_symbolic` NIF on getsentry's symbolic 12 (debuginfo, symcache, demangle without Swift), proguard 5 and rust-minidump 0.26; dirty schedulers, capped inputs and outputs. zstd (ELF's compressed debug sections) is compiled in statically; nothing links a system library. | |
| 501 | + - Chunk upload now also offers `debug_files`, `pdbs`, `portablepdbs` and `proguard` (source bundles, BCSymbolMaps and il2cpp are not offered). `difs/assemble/` answers per checksum (`not_found` with missing chunks, `created`, `assembling`, `ok` with Sentry's `DebugInfoFile`, `error` told once), assembled by an Oban job into `debug_files` (one row per object: debug id, code id, arch, kind, format, features). The legacy `files/dsyms/` zip upload (what `upload-proguard` sends by default), its list, `unknown/?checksums=` and `DELETE ?id=` work too. | |
| 502 | + - SymCaches are built at the first lookup and kept in storage. Native frames resolve against `debug_meta.images` by address or `addr_mode: rel:N`, return addresses adjusted with symbolic's heuristics, inlined frames expanded, `raw_stacktrace` kept, `in_app` false for system libraries; a missing file is one `native_missing_dsym` per image. Proguard frames and exception types are deobfuscated by the event's `proguard` images (inlined frames expanded). | |
| 503 | + - Minidumps (multipart `upload_file_minidump`, or an envelope `event.minidump` attachment folded with its event at the edge) are unwound without symbols (stack scanning and frame pointers) into threads, a synthetic crash exception, images and OS/device contexts as 2019 Sentry did, then symbolicated like any native event. The raw dump is kept in `event_attachments` (50 MiB cap, swept with the event retention). | |
| 504 | + - Tested with the real sentry-cli 2.58.2: `debug-files upload --wait` of a gcc-built ELF (committed with its source) to a symbolicated crash, and `upload-proguard` both ways. | |
| 505 | + - Not done: CFI from uploaded files for minidump unwinding (so scanned stacks can carry spurious frames), Swift demangling, source bundles and source context, a UI for debug files, Proguard caches (each event parses the mapping). | |
| 499 | 506 | - **Project management API**, in Sentry's shapes so Terraform-style tools work too: |
| 500 | 507 | - `GET /organizations/{o}/teams/`. |
| 501 | 508 | - `POST /teams/{o}/{team}/projects/`. |
modified
lib/vigil/artifacts.ex
+28
−8
| 57 | 57 | # sentry-cli only chunks source maps at all when release_files is |
| 58 | 58 | # offered; with projects named it then sends artifact bundles, and |
| 59 | 59 | # without, the release-bound assemble (`assemble_for_release/3`). |
| 60 | − accept: ["release_files", "artifact_bundles", "artifact_bundles_v2"] | |
| 60 | + # debug_files: `debug-files upload` through `difs/assemble/` | |
| 61 | + # (Vigil.DebugFiles); pdbs and portablepdbs let it send PE/PDB and | |
| 62 | + # Portable PDB files and their debug ids; proguard: `upload-proguard` | |
| 63 | + # with SENTRY_EXPERIMENTAL_PROGUARD_CHUNK_UPLOAD=1. Not offered: | |
| 64 | + # sources (source bundles), bcsymbolmaps, il2cpp, dartsymbolmap. | |
| 65 | + accept: [ | |
| 66 | + "release_files", | |
| 67 | + "artifact_bundles", | |
| 68 | + "artifact_bundles_v2", | |
| 69 | + "debug_files", | |
| 70 | + "pdbs", | |
| 71 | + "portablepdbs", | |
| 72 | + "proguard" | |
| 73 | + ] | |
| 61 | 74 | } |
| 62 | 75 | end |
| 63 | 76 |
| 209 | 222 | defp assemble_projects(_scope, _), |
| 210 | 223 | do: {:error, 400, "projects: at least one project is required"} |
| 211 | 224 | |
| 212 | − defp start_assemble(org, checksum, chunks, projects, params) do | |
| 213 | − held = | |
| 214 | − Repo.all(from b in blob_query(org.id, chunks), select: b.checksum) |> MapSet.new() | |
| 225 | + @doc "Which of `chunks` (SHA-1s) the organization holds no blob for." | |
| 226 | + def missing_chunks(org_id, chunks) do | |
| 227 | + held = Repo.all(from b in blob_query(org_id, chunks), select: b.checksum) |> MapSet.new() | |
| 228 | + Enum.reject(Enum.uniq(chunks), &MapSet.member?(held, &1)) | |
| 229 | + end | |
| 215 | 230 | |
| 216 | − case Enum.reject(Enum.uniq(chunks), &MapSet.member?(held, &1)) do | |
| 231 | + defp start_assemble(org, checksum, chunks, projects, params) do | |
| 232 | + case missing_chunks(org.id, chunks) do | |
| 217 | 233 | [] when chunks != [] -> |
| 218 | 234 | now = DateTime.utc_now(:second) |
| 219 | 235 |
| 294 | 310 | end |
| 295 | 311 | end |
| 296 | 312 | |
| 297 | − defp join_chunks(org_id, chunks) do | |
| 313 | + @doc """ | |
| 314 | + An uploaded file's bytes: the organization's blobs for `chunks`, in | |
| 315 | + order, at most `max` bytes in all; or `{:error, detail}`. | |
| 316 | + """ | |
| 317 | + def join_chunks(org_id, chunks, max \\ @max_file_size) do | |
| 298 | 318 | blobs = Repo.all(blob_query(org_id, chunks)) |> Map.new(&{&1.checksum, &1}) |
| 299 | 319 | |
| 300 | 320 | Enum.reduce_while(chunks, {:ok, [], 0}, fn checksum, {:ok, acc, size} -> |
| 301 | 321 | with %FileBlob{} = blob <- Map.get(blobs, checksum), |
| 302 | − true <- size + blob.size <= @max_file_size || :too_large, | |
| 322 | + true <- size + blob.size <= max || :too_large, | |
| 303 | 323 | {:ok, data} <- Storage.get(blob.storage_key) do |
| 304 | 324 | {:cont, {:ok, [acc, data], size + blob.size}} |
| 305 | 325 | else |
| 306 | − :too_large -> {:halt, {:error, "Bundle is larger than #{@max_file_size} bytes"}} | |
| 326 | + :too_large -> {:halt, {:error, "File is larger than #{max} bytes"}} | |
| 307 | 327 | _ -> {:halt, {:error, "Chunk #{checksum} is missing"}} |
| 308 | 328 | end |
| 309 | 329 | end) |
modified
lib/vigil/artifacts/cleanup_worker.ex
+9
−2
| 1 | 1 | defmodule Vigil.Artifacts.CleanupWorker do |
| 2 | − @moduledoc "Daily: drops chunk blobs and assemble statuses over a day old (`Vigil.Artifacts.cleanup/1`)." | |
| 2 | + @moduledoc """ | |
| 3 | + Daily: drops chunk blobs and assemble statuses over a day old | |
| 4 | + (`Vigil.Artifacts.cleanup/1`), and debug-file assemble states and old | |
| 5 | + event attachments (`Vigil.DebugFiles.cleanup/1`). | |
| 6 | + """ | |
| 3 | 7 | use Oban.Worker, queue: :maintenance, max_attempts: 3 |
| 4 | 8 | |
| 5 | 9 | @impl Oban.Worker |
| 6 | − def perform(_job), do: Vigil.Artifacts.cleanup() | |
| 10 | + def perform(_job) do | |
| 11 | + Vigil.Artifacts.cleanup() | |
| 12 | + Vigil.DebugFiles.cleanup() | |
| 13 | + end | |
| 7 | 14 | end |
added
lib/vigil/debug_files.ex
+521
−0
Click to load diff…
added
lib/vigil/debug_files/assemble_worker.ex
+20
−0
Click to load diff…
added
lib/vigil/debug_files/assembly.ex
+17
−0
Click to load diff…
added
lib/vigil/debug_files/debug_file.ex
+29
−0
Click to load diff…
added
lib/vigil/events/attachment.ex
+20
−0
Click to load diff…
modified
lib/vigil/events/normalize.ex
+6
−1
Click to load diff…
modified
lib/vigil/events/processor.ex
+12
−7
Click to load diff…
modified
lib/vigil/ingest.ex
+6
−1
Click to load diff…
modified
lib/vigil/ingest/processor.ex
+2
−1
Click to load diff…
added
lib/vigil/minidumps.ex
+248
−0
Click to load diff…
added
lib/vigil/minidumps/processor.ex
+44
−0
Click to load diff…
added
lib/vigil/symbolic.ex
+123
−0
Click to load diff…
added
lib/vigil/symbolic/native.ex
+49
−0
Click to load diff…
added
lib/vigil/symbolication/jvm.ex
+276
−0
Click to load diff…
added
lib/vigil/symbolication/native.ex
+442
−0
Click to load diff…
added
lib/vigil_web/api/v0/debug_file_controller.ex
+92
−0
Click to load diff…
modified
lib/vigil_web/chunk_multipart.ex
+27
−4
Click to load diff…
modified
lib/vigil_web/ingest_plug.ex
+13
−5
Click to load diff…
modified
lib/vigil_web/router.ex
+10
−0
Click to load diff…
added
native/vigil_symbolic/Cargo.lock
+1686
−0
Click to load diff…
added
native/vigil_symbolic/Cargo.toml
+62
−0
Click to load diff…
added
native/vigil_symbolic/src/lib.rs
+549
−0
Click to load diff…
added
priv/repo/migrations/20261202041259_create_debug_files.exs
+86
−0
Click to load diff…
modified
?
+0
−0
Click to load diff…
added
test/support/fixtures/native/crash.c
+33
−0
Click to load diff…
modified
?
+0
−0
Click to load diff…
added
test/support/fixtures/native_fixtures.ex
+62
−0
Click to load diff…
added
test/support/fixtures/proguard/mapping.txt
+16
−0
Click to load diff…
added
test/vigil/minidumps_test.exs
+181
−0
Click to load diff…
added
test/vigil/symbolication/jvm_test.exs
+100
−0
Click to load diff…
added
test/vigil/symbolication/native_test.exs
+166
−0
Click to load diff…
added
test/vigil_web/api/debug_file_api_test.exs
+223
−0
Click to load diff…
added
test/vigil_web/sentry_cli_debug_files_test.exs
+173
−0
Click to load diff…