neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Slice 12: native symbolication, Proguard, minidumps, project management API and the vgl CLI
5edbf17 · gmorell · 2026-12-02 04:30
Files changed
modified
ROADMAP.md
+2
−1
@@ -494,7 +494,7 @@ This is new: GlitchTip throws `check_in` items away.
| 494 | 494 | - The image build and the workflows haven't been run, since docker isn't available here; the release itself was built and booted. |
| 495 | 495 | - Not done: the optional MCP endpoint and sentry-wizard. The DSN-keys API moved to slice 12. |
| 496 | 496 | |
| 497 | −### 12. Native, mobile and the `vigil` CLI · large | |
| 497 | +### 12. Native, mobile and the `vgl` CLI · large · **done** | |
| 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 | 499 | - **As built (native):** |
| 500 | 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. |
@@ -502,6 +502,7 @@ This is new: GlitchTip throws `check_in` items away.
| 502 | 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 | 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 | 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 | + - Purging a deleted project also deletes its debug files', symcaches' and minidumps' bytes from storage. | |
| 505 | 506 | - 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). |
| 506 | 507 | - **Project management API**, in Sentry's shapes so Terraform-style tools work too: |
| 507 | 508 | - `GET /organizations/{o}/teams/`. |
modified
lib/vigil/retention.ex
+22
−0
@@ -242,6 +242,10 @@ defmodule Vigil.Retention do
| 242 | 242 | def purge_project(project_id) do |
| 243 | 243 | case Repo.get(Project, project_id) do |
| 244 | 244 | %Project{deleted_at: %DateTime{}} = project -> |
| 245 | + # Debug files (and their symcaches) and raw minidumps live in | |
| 246 | + # storage; their rows go with the project, their bytes don't. | |
| 247 | + project_blobs(project.id) |> Enum.each(&Storage.delete/1) | |
| 248 | + | |
| 245 | 249 | Repo.delete!(project, timeout: :infinity) |
| 246 | 250 | # Its bundles lost their link; those shared with another project |
| 247 | 251 | # keep that one and survive. |
@@ -254,6 +258,24 @@ defmodule Vigil.Retention do
| 254 | 258 | end |
| 255 | 259 | end |
| 256 | 260 | |
| 261 | + defp project_blobs(project_id) do | |
| 262 | + debug = | |
| 263 | + Repo.all( | |
| 264 | + from d in Vigil.DebugFiles.DebugFile, | |
| 265 | + where: d.project_id == ^project_id, | |
| 266 | + select: [d.storage_key, d.symcache_key] | |
| 267 | + ) | |
| 268 | + | |
| 269 | + attachments = | |
| 270 | + Repo.all( | |
| 271 | + from a in Vigil.Events.Attachment, | |
| 272 | + where: a.project_id == ^project_id, | |
| 273 | + select: a.storage_key | |
| 274 | + ) | |
| 275 | + | |
| 276 | + (List.flatten(debug) ++ attachments) |> Enum.reject(&is_nil/1) |> Enum.uniq() | |
| 277 | + end | |
| 278 | + | |
| 257 | 279 | @doc "Removes a soft-deleted organization for good, its projects first." |
| 258 | 280 | def purge_organization(org_id) do |
| 259 | 281 | case Repo.get(Organization, org_id) do |
modified
test/vigil/retention_test.exs
+17
−0
@@ -148,6 +148,22 @@ defmodule Vigil.RetentionTest do
| 148 | 148 | test "deleted projects and organizations are purged a day later, files and all", ctx do |
| 149 | 149 | send_error(ctx.target, "KeyError") |
| 150 | 150 | {bundle_id, key} = bundle(ctx.org, ctx.project, nil) |
| 151 | + dif_key = "debug/#{ctx.project.id}/test" | |
| 152 | + :ok = Vigil.Storage.put(dif_key, "elf") | |
| 153 | + | |
| 154 | + Repo.insert!(%Vigil.DebugFiles.DebugFile{ | |
| 155 | + project_id: ctx.project.id, | |
| 156 | + organization_id: ctx.org.id, | |
| 157 | + checksum: String.duplicate("a", 40), | |
| 158 | + debug_id: Ecto.UUID.generate(), | |
| 159 | + object_name: "crash", | |
| 160 | + file_format: "elf", | |
| 161 | + cpu_name: "x86_64", | |
| 162 | + kind: "debug", | |
| 163 | + size: 3, | |
| 164 | + storage_key: dif_key | |
| 165 | + }) | |
| 166 | + | |
| 151 | 167 | {:ok, _} = Vigil.Projects.delete_project(ctx.scope, ctx.project) |
| 152 | 168 | |
| 153 | 169 | assert %{purges_queued: 0} = Retention.sweep() |
@@ -161,6 +177,7 @@ defmodule Vigil.RetentionTest do
| 161 | 177 | refute Repo.get(Project, project_id) |
| 162 | 178 | refute Repo.get(ArtifactBundle, bundle_id) |
| 163 | 179 | assert {:error, :not_found} = Vigil.Storage.get(key) |
| 180 | + assert {:error, :not_found} = Vigil.Storage.get(dif_key) | |
| 164 | 181 | assert Repo.aggregate(Issue, :count) == 0 |
| 165 | 182 | |
| 166 | 183 | other = project_fixture(ctx.scope, %{"name" => "other"}) |
Parents: 71fde20