Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(hog): upload dSYM bundles and ELF and Mach-O debug files (#124575)

Rafael Audibertc28b76d69ad9
diff --git a/.gitattributes b/.gitattributes
index 60398f845fff..385b4dd1a00a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -45,3 +45,4 @@ common/hogql_parser/HogQLParserBaseVisitor.cpp linguist-generated
common/hogql_parser/HogQLParserBaseVisitor.h linguist-generated
hog/test/parity/bundles/** linguist-generated -text
hog/test/parity/golden/** linguist-generated
+hog/test/parity/native/bin/** binary linguist-generated
diff --git a/.oxfmtrc.json b/.oxfmtrc.json
index c04848aeef9a..05d1623b0505 100644
--- a/.oxfmtrc.json
+++ b/.oxfmtrc.json
@@ -164,6 +164,7 @@
"**/chart/*/templates/**",
"products/metrics/agent/tests/**/golden/**",
"hog/test/parity/bundles/**",
+ "hog/test/parity/native/bin/**",
"hog/test/parity/golden/**",
"frontend/dist/",
"frontend/**/*LogicType.ts",
diff --git a/hog/README.md b/hog/README.md
index 32a667beb108..c37d37283bbd 100644
--- a/hog/README.md
+++ b/hog/README.md
@@ -20,7 +20,7 @@ The commands `posthog-cli` keeps under `exp` (`query`, `endpoints`, `logs`, `tas
| `hog query check <query>` | Checks a query without running it. Exits with code 1 when the query has errors. |
| `hog error-tracking inject [paths...]` | Adds chunk IDs to JavaScript bundles and their sourcemaps. `hog et` is an alias for `hog error-tracking`. |
| `hog error-tracking clone <from> <to>` | Copies the chunk ID from Metro's map to the map Hermes composed, for React Native. |
-| `hog error-tracking upload [paths...]` | Uploads symbols for readable stack traces: JavaScript sourcemaps, Hermes maps, and ProGuard and R8 mappings. |
+| `hog error-tracking upload [paths...]` | Uploads symbols for readable stack traces: JavaScript sourcemaps, Hermes maps, ProGuard mappings, dSYMs and ELF files. |
| `hog error-tracking process [paths...]` | Runs `inject`, then `upload`. Use it in CI after the build. |
| `hog config check`, `hog config schema` | Check `posthog.json` against its schema, or print the schema. |
| `hog commands` | Lists every command, its arguments, options and scopes. |
@@ -66,6 +66,8 @@ Point `$schema` at the published schema to get validation in your editor:
- a `.bundle` or `.jsbundle` file is a React Native bundle when its sourcemap exists
- a `.map` file is a Hermes map when it has `x_hermes_function_offsets`, which only the Hermes compiler writes
- a `.txt` file is a ProGuard or R8 mapping when its content parses as one
+- a `.dSYM` folder is an Apple debug symbol bundle, and hog uploads each architecture in it separately
+- any other file is an ELF or Mach-O binary when its first bytes say so. hog uploads it when it has debug info and a build ID or UUID, and lists why it skipped the others
Without paths, the commands read `errorTracking.sources` from `posthog.json`, where `ignore` globs skip files.
`--kind` skips detection.
@@ -85,7 +87,9 @@ hog error-tracking upload android/app/build/generated/sourcemaps # the compo
hog uploads the same bytes and content hashes as posthog-cli, so either CLI can re-upload what the other uploaded. A few things differ on purpose:
-- `posthog-cli sourcemap`, `hermes` and `proguard` are `hog error-tracking`, with paths as arguments instead of `--directory` and `--path`
+- `posthog-cli sourcemap`, `hermes`, `proguard`, `dsym` and `symbol-sets upload` are `hog error-tracking`, with paths as arguments instead of `--directory` and `--path`
+- hog reads dSYM bundles itself, so it needs neither Xcode's `dwarfdump` nor `lipo`, and uploads dSYMs from Linux too
+- native releases come from the flags, `posthog.json` or git, as in `posthog-cli symbol-sets upload`. hog doesn't read the release from the dSYM's `Info.plist`, as `posthog-cli dsym upload` does
- `upload` sends only Hermes maps it detects. posthog-cli treats every JSON file in the folder as a map, and fails when it finds Metro's map there
- hog walks folders in sorted order and skips `node_modules`, `.git` and symlinks, so two machines visit the same files in the same order
- `--dry-run` shows the plan and the content hashes without writing files or contacting PostHog. posthog-cli's `--dry-run` skips the whole command.
diff --git a/hog/package.json b/hog/package.json
index 682c470e70f4..f3102dff950a 100644
--- a/hog/package.json
+++ b/hog/package.json
@@ -18,10 +18,12 @@
"@clack/prompts": "1.8.1",
"cli-table3": "0.6.5",
"commander": "15.0.0",
+ "pako": "2.1.0",
"zod": "^4.3.6"
},
"devDependencies": {
"@types/bun": "1.3.14",
+ "@types/pako": "2.0.4",
"typescript": "catalog:"
},
"engines": {
diff --git a/hog/src/cli.test.ts b/hog/src/cli.test.ts
index 23d267d91b6d..2fa2c07a0fa6 100644
--- a/hog/src/cli.test.ts
+++ b/hog/src/cli.test.ts
@@ -37,12 +37,12 @@ describe('hog', () => {
)
test.each([
- ['help for an unported command', ['help', 'dsym', 'upload'], 'posthog-cli dsym upload --help'],
+ ['help for an unported command', ['help', 'logs', 'import'], 'posthog-cli exp logs import --help'],
['an unported subcommand of a ported group', ['query', 'editor'], 'posthog-cli exp query editor'],
[
'hog globals that posthog-cli takes before the subcommand',
- ['-o', 'json', '--host', 'https://eu.example.com', 'dsym', 'upload', '--dotenv-file=p.env', '--dir', 'x'],
- 'posthog-cli --host https://eu.example.com --dotenv-file p.env dsym upload --dir x',
+ ['-o', 'json', '--host', 'https://eu.example.com', 'logs', 'import', '--dotenv-file=p.env', '--dir', 'x'],
+ 'posthog-cli --host https://eu.example.com --dotenv-file p.env exp logs import --dir x',
],
[
'an --output that the legacy command owns',
diff --git a/hog/src/cli.ts b/hog/src/cli.ts
index 6d9bace5f50d..6ebf1881a56b 100644
--- a/hog/src/cli.ts
+++ b/hog/src/cli.ts
@@ -273,6 +273,10 @@ const RENAMED: Record<string, { to: string; hint: string }> = {
to: 'error-tracking inject|clone|upload',
hint: 'Pass paths as arguments instead of --directory, and the two maps to `hog error-tracking clone` instead of -m and -c.',
},
+ dsym: {
+ to: 'error-tracking upload',
+ hint: 'Pass the folder as an argument instead of --directory, as in `hog error-tracking upload build/Release-iphoneos`.',
+ },
proguard: {
to: 'error-tracking upload',
hint: 'Pass the mapping as an argument instead of --path, as in `hog error-tracking upload mapping.txt --map-id <id>`.',
diff --git a/hog/src/commands/error-tracking/error-tracking.test.ts b/hog/src/commands/error-tracking/error-tracking.test.ts
index 0b3866bd2e1b..6998b938c433 100644
--- a/hog/src/commands/error-tracking/error-tracking.test.ts
+++ b/hog/src/commands/error-tracking/error-tracking.test.ts
@@ -1,5 +1,15 @@
import { describe, expect, test } from 'bun:test'
-import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, symlinkSync, writeFileSync } from 'node:fs'
+import {
+ chmodSync,
+ cpSync,
+ existsSync,
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ symlinkSync,
+ writeFileSync,
+} from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
@@ -190,6 +200,82 @@ describe('hog error-tracking upload', () => {
expect(result.error()).toMatchObject({ code: 'no_hermes_maps' })
})
+ const NATIVE = join(import.meta.dir, '../../../test/parity/native/bin')
+ // A 64-bit Mach-O whose LC_UUID command claims a size of 0, which never advances to the next one.
+ const header = Buffer.alloc(32)
+ header.writeUInt32LE(0xfeedfacf, 0)
+ header.writeUInt32LE(0x0100000c, 4)
+ header.writeUInt32LE(0x6, 12)
+ header.writeUInt32LE(2, 16)
+ header.writeUInt32LE(48, 20)
+ const uuidCommand = Buffer.alloc(24, 0xab)
+ uuidCommand.writeUInt32LE(0x1b, 0)
+ uuidCommand.writeUInt32LE(0, 4)
+ const ZERO_CMDSIZE = Buffer.concat([header, uuidCommand, Buffer.alloc(24)])
+
+ test.each([
+ [
+ 'other uploads go ahead when no native file is usable',
+ readFileSync(join(NATIVE, 'linux/checkout-no-debug')),
+ ['mapping.txt', '--map-id', 'map-1'],
+ 0,
+ 'map-1',
+ ],
+ [
+ 'the failure names every skipped native file',
+ readFileSync(join(NATIVE, 'linux/checkout-no-debug')),
+ [],
+ 1,
+ 'bin/native: ',
+ ],
+ ['a Mach-O load command smaller than its header is skipped', ZERO_CMDSIZE, [], 1, 'smaller than its header'],
+ ])('upload: %s', async (_name, binary, paths, exitCode, expected) => {
+ const folder = project({ 'mapping.txt': SMALL_MAPPING })
+ mkdirSync(join(folder, 'bin'))
+ writeFileSync(join(folder, 'bin/native'), binary)
+ const result = await runHog(['et', 'upload', '--dry-run', 'bin', ...paths], {
+ env: { CLAUDECODE: '1' },
+ cwd: folder,
+ useDisk: true,
+ })
+ expect(result.exitCode).toBe(exitCode)
+ expect(exitCode === 0 ? JSON.stringify(result.json().symbolSets) : result.error().message).toContain(expected)
+ })
+
+ test.each([
+ ['skips a dSYM member that matches an ignore glob', ['Shop.app.dSYM/Contents/Resources/DWARF/**'], false],
+ ['follows a dSYM member that is a symlink, as posthog-cli does', [], true],
+ ])('upload %s', async (_name, ignore, linkOutside) => {
+ const folder = project({
+ 'posthog.json': JSON.stringify({ errorTracking: { sources: [{ path: 'apple', ignore }] } }),
+ })
+ cpSync(join(NATIVE, 'apple/Shop.app.dSYM'), join(folder, 'apple/Shop.app.dSYM'), { recursive: true })
+ if (linkOutside) {
+ const member = join(folder, 'apple/Shop.app.dSYM/Contents/Resources/DWARF/Shop')
+ cpSync(member, join(folder, 'outside/Shop'))
+ rmSync(member)
+ symlinkSync(join(folder, 'outside/Shop'), member)
+ }
+ const result = await runHog(['et', 'upload', '--dry-run'], {
+ env: { CLAUDECODE: '1' },
+ cwd: folder,
+ useDisk: true,
+ })
+
+ if (linkOutside) {
+ expect(result.exitCode).toBe(0)
+ expect(result.json().symbolSets).toEqual([
+ expect.objectContaining({ path: 'apple/Shop.app.dSYM', status: 'planned' }),
+ ])
+ } else {
+ expect(result.exitCode).toBe(1)
+ expect(result.error()).toMatchObject({
+ code: 'no_debug_symbols',
+ message: expect.stringContaining('apple/Shop.app.dSYM: '),
+ })
+ }
+ })
+
test('--dry-run reads the release from the repository a symlinked mapping points into', async () => {
const repository = project({ ...GIT_REPO, 'app/mapping.txt': SMALL_MAPPING })
const outside = project({})
diff --git a/hog/src/commands/error-tracking/shared.ts b/hog/src/commands/error-tracking/shared.ts
index 4a9398bd7fb7..dc3ae7f5d39a 100644
--- a/hog/src/commands/error-tracking/shared.ts
+++ b/hog/src/commands/error-tracking/shared.ts
@@ -64,7 +64,11 @@ export const UPLOAD_OPTIONS = {
type: 'boolean',
description: 'JavaScript and CSS: remove sourcemap references and delete the maps after a successful upload',
},
- batchSize: { type: 'string', placeholder: 'count', description: 'Symbol sets per upload request (default 50)' },
+ batchSize: {
+ type: 'string',
+ placeholder: 'count',
+ description: 'Symbol sets per upload request (default 50, 10 for native symbols)',
+ },
concurrency: { type: 'string', placeholder: 'count', description: 'Parallel file uploads (default 10)' },
} as const satisfies Record<string, OptionSpec>
@@ -134,7 +138,7 @@ export function readOptions(options: RawOptions, env: Env): ErrorTrackingOptions
publicPathPrefix: options.publicPathPrefix,
force: options.force === true,
skipOnConflict: options.skipOnConflict === true,
- batchSize: count('--batch-size', options.batchSize, 50),
+ batchSize: options.batchSize === undefined ? undefined : count('--batch-size', options.batchSize, 50),
concurrency: count('--concurrency', options.concurrency ?? env.POSTHOG_CLI_SOURCEMAP_UPLOAD_CONCURRENCY, 10),
deleteAfter: options.deleteAfter === true,
dryRun: options.dryRun === true,
diff --git a/hog/src/commands/error-tracking/upload.ts b/hog/src/commands/error-tracking/upload.ts
index 5eac07f7b06a..633712b035ed 100644
--- a/hog/src/commands/error-tracking/upload.ts
+++ b/hog/src/commands/error-tracking/upload.ts
@@ -20,12 +20,13 @@ export default defineCommand({
scopes: ['error_tracking:write'],
notes: [
"hog finds the artifacts in each path and detects their type from the files. A file it can't place, or one that two types could claim, is an error that names --kind.",
- 'Supported: JavaScript bundles with sourcemaps, maps the Hermes compiler composed, and ProGuard or R8 mappings (mapping.txt).',
+ 'Supported: JavaScript bundles with sourcemaps, maps the Hermes compiler composed, ProGuard or R8 mappings (mapping.txt), dSYM bundles, and ELF or Mach-O files with debug info.',
'JavaScript bundles need a chunk ID first: run `hog error-tracking inject`, or use `hog error-tracking process` to do both.',
].join('\n'),
examples: [
'hog error-tracking upload dist',
'hog error-tracking upload app/build/outputs/mapping/release --map-id "$MAP_ID"',
+ 'hog et upload build/Build/Products/Release-iphoneos',
'hog et upload --dry-run',
],
diff --git a/hog/src/commands/legacy.ts b/hog/src/commands/legacy.ts
index 5b8382fbf70a..e713bb5a8a40 100644
--- a/hog/src/commands/legacy.ts
+++ b/hog/src/commands/legacy.ts
@@ -12,7 +12,6 @@ export const LEGACY_COMMANDS: CommandTree = {
description: 'Download event definitions and generate a typed SDK',
use: 'posthog-cli exp schema',
}),
- dsym: defineLegacy({ description: 'Upload Apple dSYM debug symbol files to PostHog', use: 'posthog-cli dsym' }),
'symbol-sets': defineLegacy({
description: 'Upload, download, and manage symbol sets',
use: 'posthog-cli symbol-sets',
diff --git a/hog/src/error-tracking/discover.ts b/hog/src/error-tracking/discover.ts
index 962aff3ddd0e..67bc86666325 100644
--- a/hog/src/error-tracking/discover.ts
+++ b/hog/src/error-tracking/discover.ts
@@ -7,6 +7,7 @@ import { HogError } from '@/core/errors'
import { HERMES_BUNDLE_EXTENSIONS, isComposedMap } from './kinds/hermes'
import { isJsBundle, JS_EXTENSIONS } from './kinds/js'
import { isValidProguardMapping } from './kinds/proguard'
+import { nativeFormat } from './native/package'
export interface Root {
path: string
@@ -33,8 +34,8 @@ export interface Artifact {
// files always give the same result, and a file only two types could claim is an error.
interface Detector {
kind: ArtifactKind
- // While scanning a folder, only files with these extensions are opened.
- extensions: readonly string[]
+ // While scanning a folder, only files with these extensions are opened. Null opens every file.
+ extensions: readonly string[] | null
matches(path: string, options: DiscoverOptions): boolean
}
@@ -61,8 +62,22 @@ const DETECTORS: readonly Detector[] = [
extensions: ['.map'],
matches: isComposedMap,
},
+ {
+ // Native binaries have any name, so their first 4 bytes decide. Upload reports the ones it
+ // can't send, such as files without debug info, as posthog-cli does.
+ kind: 'elf',
+ extensions: null,
+ matches: (path) => nativeFormat(path) === 'elf',
+ },
+ {
+ kind: 'dsym',
+ extensions: null,
+ matches: (path) => nativeFormat(path) === 'macho',
+ },
]
+export const isDsymBundle = (path: string): boolean => path.endsWith('.dSYM')
+
function detect(
path: string,
fromFolder: boolean,
@@ -72,7 +87,9 @@ function detect(
const candidates = DETECTORS.filter(
(detector) =>
(kind === undefined || detector.kind === kind) &&
- (!fromFolder || detector.extensions.some((extension) => path.endsWith(extension)))
+ (!fromFolder ||
+ detector.extensions === null ||
+ detector.extensions.some((extension) => path.endsWith(extension)))
)
const matched = [
...new Set(candidates.filter((detector) => detector.matches(path, options)).map((detector) => detector.kind)),
@@ -87,34 +104,43 @@ function detect(
return matched[0]
}
-function walk(folder: string, out: string[]): void {
- // Sorted, so runs on different machines visit files in the same order. Symlinks are skipped, as
- // in posthog-cli, so a link can't make hog rewrite files outside the folder.
+// Sorted, so runs on different machines visit files in the same order. Symlinks are skipped, as
+// in posthog-cli, so a link can't make hog rewrite files outside the folder. A dSYM bundle is one
+// artifact, so the walk doesn't look inside it.
+function walk(folder: string, out: { files: string[]; bundles: string[] }): void {
for (const entry of readdirSync(folder, { withFileTypes: true }).sort((a, b) => (a.name < b.name ? -1 : 1))) {
if (entry.name === 'node_modules' || entry.name === '.git') {
continue
}
const path = join(folder, entry.name)
if (entry.isDirectory()) {
- walk(path, out)
+ if (isDsymBundle(entry.name)) {
+ out.bundles.push(path)
+ } else {
+ walk(path, out)
+ }
} else if (entry.isFile()) {
- out.push(path)
+ out.files.push(path)
}
}
}
-function rootFiles(root: Root, cwd: string): { path: string; isFile: boolean; files: string[] } {
+function rootFiles(root: Root, cwd: string): { path: string; isFile: boolean; files: string[]; bundles: string[] } {
const path = resolve(cwd, root.path)
const stat = statSync(path, { throwIfNoEntry: false })
if (!stat) {
throw new HogError('path_not_found', `${root.path} doesn't exist.`)
}
if (stat.isFile()) {
- return { path, isFile: true, files: [path] }
+ return { path, isFile: true, files: [path], bundles: [] }
+ }
+ if (isDsymBundle(path)) {
+ return { path, isFile: false, files: [], bundles: [path] }
}
- const files: string[] = []
- walk(path, files)
- return { path, isFile: false, files: files.filter((file) => !isIgnored(root, path, file)) }
+ const found = { files: [] as string[], bundles: [] as string[] }
+ walk(path, found)
+ const kept = (file: string): boolean => !isIgnored(root, path, file)
+ return { path, isFile: false, files: found.files.filter(kept), bundles: found.bundles.filter(kept) }
}
const compiledGlobs = new WeakMap<Root, Bun.Glob[]>()
@@ -148,7 +174,7 @@ export function discover(roots: readonly Root[], cwd: string, options: DiscoverO
}
}
for (const root of roots) {
- const { path, isFile, files } = rootFiles(root, cwd)
+ const { path, isFile, files, bundles } = rootFiles(root, cwd)
if (isFile) {
const kind = detect(path, false, root.kind, options)
if (!kind) {
@@ -163,6 +189,11 @@ export function discover(roots: readonly Root[], cwd: string, options: DiscoverO
add({ kind, path, display: relative(cwd, path) || path, root })
continue
}
+ if (root.kind === undefined || root.kind === 'dsym') {
+ for (const bundle of bundles) {
+ add({ kind: 'dsym', path: bundle, display: relative(cwd, bundle) || bundle, root })
+ }
+ }
for (const file of files) {
const kind = detect(file, true, root.kind, options)
if (kind) {
diff --git a/hog/src/error-tracking/native/bytes.ts b/hog/src/error-tracking/native/bytes.ts
new file mode 100644
index 000000000000..4f9d90b5c578
--- /dev/null
+++ b/hog/src/error-tracking/native/bytes.ts
@@ -0,0 +1,195 @@
+// A bounds-checked cursor over bytes. A read past the end throws DwarfEof, like gimli's
+// `Error::UnexpectedEof`, so object and DWARF parsing fail where the Rust crates fail.
+
+export class DwarfError extends Error {}
+export class DwarfEof extends DwarfError {
+ constructor() {
+ super('unexpected end of input')
+ }
+}
+
+export const textLossy = new TextDecoder('utf-8', { fatal: false, ignoreBOM: true })
+const textStrict = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true })
+
+/** Rust `String::from_utf8_lossy`: WHATWG decoding uses the same maximal-subpart replacement. */
+export function utf8Lossy(b: Uint8Array): string {
+ return textLossy.decode(b)
+}
+
+/** Rust `str::from_utf8(..).ok()`. */
+export function utf8Strict(b: Uint8Array): string | null {
+ try {
+ return textStrict.decode(b)
+ } catch {
+ return null
+ }
+}
+
+export class Cursor {
+ pos: number
+ readonly end: number
+ private readonly dv: DataView
+
+ constructor(
+ readonly buf: Uint8Array,
+ readonly le: boolean,
+ start = 0,
+ end = buf.length
+ ) {
+ this.pos = start
+ this.end = end
+ this.dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)
+ }
+
+ get remaining(): number {
+ return this.end - this.pos
+ }
+
+ isEmpty(): boolean {
+ return this.pos >= this.end
+ }
+
+ private need(n: number): number {
+ if (n < 0 || this.pos + n > this.end) {
+ throw new DwarfEof()
+ }
+ const p = this.pos
+ this.pos += n
+ return p
+ }
+
+ skip(n: number): void {
+ this.need(n)
+ }
+
+ split(n: number): Cursor {
+ const p = this.need(n)
+ return new Cursor(this.buf, this.le, p, p + n)
+ }
+
+ u8(): number {
+ return this.buf[this.need(1)]!
+ }
+ i8(): number {
+ return this.dv.getInt8(this.need(1))
+ }
+ u16(): number {
+ return this.dv.getUint16(this.need(2), this.le)
+ }
+ u32(): number {
+ return this.dv.getUint32(this.need(4), this.le)
+ }
+ /** u64 as a JS number. Offsets above 2^53 cannot occur in files we can read. */
+ u64(): number {
+ const p = this.need(8)
+ const lo = this.dv.getUint32(this.le ? p : p + 4, this.le)
+ const hi = this.dv.getUint32(this.le ? p + 4 : p, this.le)
+ return hi * 0x1_0000_0000 + lo
+ }
+ uint(n: number): number {
+ if (n === 1) {
+ return this.u8()
+ }
+ if (n === 2) {
+ return this.u16()
+ }
+ if (n === 4) {
+ return this.u32()
+ }
+ if (n === 8) {
+ return this.u64()
+ }
+ const p = this.need(n)
+ let v = 0
+ for (let i = 0; i < n; i++) {
+ const b = this.buf[this.le ? p + n - 1 - i : p + i]!
+ v = v * 256 + b
+ }
+ return v
+ }
+
+ uleb(): number {
+ let result = 0
+ let mul = 1
+ for (;;) {
+ const b = this.u8()
+ result += (b & 0x7f) * mul
+ mul *= 128
+ if ((b & 0x80) === 0) {
+ return result
+ }
+ if (mul > 2 ** 70) {
+ throw new DwarfError('bad unsigned LEB128')
+ }
+ }
+ }
+
+ /** gimli `read_uleb128_u16`: errors when the value does not fit in 16 bits. */
+ uleb16(): number {
+ const v = this.uleb()
+ if (v > 0xffff) {
+ throw new DwarfError('bad unsigned LEB128 (u16)')
+ }
+ return v
+ }
+
+ sleb(): number {
+ let result = 0
+ let mul = 1
+ let b: number
+ do {
+ b = this.u8()
+ result += (b & 0x7f) * mul
+ mul *= 128
+ if (mul > 2 ** 70) {
+ throw new DwarfError('bad signed LEB128')
+ }
+ } while (b & 0x80)
+ if (b & 0x40) {
+ result -= mul
+ }
+ return result
+ }
+
+ initialLength(): [number, boolean] {
+ const v = this.u32()
+ if (v < 0xfffffff0) {
+ return [v, false]
+ }
+ if (v === 0xffffffff) {
+ return [this.u64(), true]
+ }
+ throw new DwarfError('unknown reserved length')
+ }
+
+ offset(is64: boolean): number {
+ return is64 ? this.u64() : this.u32()
+ }
+
+ addressSize(): number {
+ const s = this.u8()
+ if (s !== 1 && s !== 2 && s !== 4 && s !== 8) {
+ throw new DwarfError('unsupported address size')
+ }
+ return s
+ }
+
+ cstr(): Uint8Array {
+ const start = this.pos
+ const nul = this.buf.indexOf(0, start)
+ if (nul < 0 || nul >= this.end) {
+ throw new DwarfEof()
+ }
+ this.pos = nul + 1
+ return this.buf.subarray(start, nul)
+ }
+}
+
+/** Null-terminated string at `offset` in a string section, or null (gimli `get_str(..).ok()`). */
+export function strAt(section: Uint8Array, offset: number): Uint8Array | null {
+ if (offset < 0 || offset >= section.length) {
+ return null
+ }
+ const nul = section.indexOf(0, offset)
+ return nul < 0 ? null : section.subarray(offset, nul)
+}
diff --git a/hog/src/error-tracking/native/object.ts b/hog/src/error-tracking/native/object.ts
new file mode 100644
index 000000000000..b53888c04afe
--- /dev/null
+++ b/hog/src/error-tracking/native/object.ts
@@ -0,0 +1,812 @@
+import { kMaxLength } from 'node:buffer'
+import { closeSync, fstatSync, openSync, readSync } from 'node:fs'
+import { constants as zc, inflateRawSync, zstdDecompressSync } from 'node:zlib'
+
+import { Cursor, DwarfError, utf8Strict } from './bytes'
+
+// ELF and Mach-O objects as symbolic-debuginfo 12.17.2 and goblin 0.8.2 read them: the archive
+// rules, the object kind, the debug-info check, the identity, and section lookup. Only headers
+// and the sections that are asked for are read.
+
+export interface Source {
+ readonly size: number
+ read(offset: number, length: number): Uint8Array
+}
+
+export class BufferSource implements Source {
+ readonly size: number
+
+ constructor(private readonly bytes: Uint8Array) {
+ this.size = bytes.length
+ }
+
+ read(offset: number, length: number): Uint8Array {
+ const start = Math.max(0, Math.min(offset, this.size))
+ return this.bytes.subarray(start, Math.max(start, Math.min(start + length, this.size)))
+ }
+}
+
+export class FileSource implements Source {
+ private readonly fd: number
+ readonly size: number
+
+ constructor(path: string) {
+ this.fd = openSync(path, 'r')
+ this.size = fstatSync(this.fd).size
+ }
+
+ read(offset: number, length: number): Uint8Array {
+ const start = Math.max(0, Math.min(offset, this.size))
+ const total = Math.max(0, Math.min(length, this.size - start))
+ const buffer = new Uint8Array(total)
+ let done = 0
+ while (done < total) {
+ const count = readSync(this.fd, buffer, done, total - done, start + done)
+ if (count <= 0) {
+ break
+ }
+ done += count
+ }
+ return buffer
+ }
+
+ close(): void {
+ closeSync(this.fd)
+ }
+}
+
+class SubSource implements Source {
+ constructor(
+ private readonly inner: Source,
+ private readonly base: number,
+ readonly size: number
+ ) {}
+
+ read(offset: number, length: number): Uint8Array {
+ const start = Math.min(offset, this.size)
+ return this.inner.read(this.base + start, Math.min(length, this.size - start))
+ }
+}
+
+export interface SectionReader {
+ readonly size: number
+ read(offset: number, length: number): Uint8Array
+}
+
+export function bufferReader(bytes: Uint8Array): SectionReader {
+ return {
+ size: bytes.length,
+ read: (offset, length) => bytes.subarray(offset, Math.min(bytes.length, offset + length)),
+ }
+}
+
+function fileReader(source: Source, base: number, size: number): SectionReader {
+ return {
+ size,
+ read: (offset, length) => source.read(base + offset, Math.max(0, Math.min(length, size - offset))),
+ }
+}
+
+export type ObjectKind = 'none' | 'relocatable' | 'executable' | 'library' | 'dump' | 'debug' | 'other'
+
+export interface NativeObject {
+ readonly format: 'macho' | 'elf'
+ readonly kind: ObjectKind
+ readonly littleEndian: boolean
+ readonly relocatable: boolean
+ readonly source: Source
+ hasDebugInfo(): boolean
+ hasCodeId(): boolean
+ debugId(): string | null
+ section(name: string): Uint8Array | null
+ // Looks a section up without reading it, to raise the errors symbolic's eager load raises.
+ probe(name: string): void
+ window(name: string): SectionReader | null
+}
+
+const MH_MAGIC = 0xfeedface
+const MH_CIGAM = 0xcefaedfe
+const MH_MAGIC_64 = 0xfeedfacf
+const MH_CIGAM_64 = 0xcffaedfe
+const FAT_MAGIC = 0xcafebabe
+const FAT_MAGIC_64 = 0xcafebabf
+
+export interface FatArch {
+ cputype: number
+ cpusubtype: number
+ offset: number
+ size: number
+}
+
+export function fatArches(source: Source, options: { fat64?: boolean } = {}): FatArch[] | null {
+ const head = source.read(0, 8)
+ if (head.length < 8) {
+ return null
+ }
+ const view = new DataView(head.buffer, head.byteOffset, head.length)
+ const magic = view.getUint32(0, false)
+ const is64 = magic === FAT_MAGIC_64 && options.fat64 === true
+ if (magic !== FAT_MAGIC && !is64) {
+ return null
+ }
+ const count = view.getUint32(4, false)
+ // Java class files share CAFEBABE. symbolic treats 45 or more "arches" as not Mach-O.
+ if (count >= 45) {
+ return null
+ }
+ const entry = is64 ? 32 : 20
+ const table = new Cursor(source.read(8, count * entry), false)
+ const arches: FatArch[] = []
+ for (let index = 0; index < count; index++) {
+ const cputype = table.u32()
+ const cpusubtype = table.u32()
+ const offset = is64 ? table.u64() : table.u32()
+ const size = is64 ? table.u64() : table.u32()
+ table.u32()
+ if (is64) {
+ table.u32()
+ }
+ arches.push({ cputype, cpusubtype, offset, size })
+ }
+ return arches
+}
+
+// symbolic `Archive::parse(..).objects()`: throws where symbolic returns an error, and returns
+// one object per fat slice.
+export function openArchive(source: Source, options: { fat64?: boolean } = {}): NativeObject[] {
+ const head = source.read(0, 8)
+ if (head.length >= 4 && head[0] === 0x7f && head[1] === 0x45 && head[2] === 0x4c && head[3] === 0x46) {
+ return [new ElfObject(source)]
+ }
+ if (head.length < 4) {
+ throw new DwarfError('unsupported object file format')
+ }
+ const magic = new DataView(head.buffer, head.byteOffset, head.length).getUint32(0, false)
+ if (magic === MH_MAGIC || magic === MH_CIGAM || magic === MH_MAGIC_64 || magic === MH_CIGAM_64) {
+ return [new MachObject(source)]
+ }
+ const arches = fatArches(source, options)
+ if (arches) {
+ return arches.map((arch) => {
+ if (arch.offset + arch.size > source.size) {
+ throw new DwarfError('fat arch out of bounds')
+ }
+ return new MachObject(new SubSource(source, arch.offset, arch.size))
+ })
+ }
+ throw new DwarfError('unsupported object file format')
+}
+
+function formatUuid(bytes: Uint8Array): string | null {
+ if (bytes.every((byte) => byte === 0)) {
+ return null
+ }
+ const hex = Buffer.from(bytes).toString('hex')
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`
+}
+
+interface MachSection {
+ poison?: boolean
+ name: string
+ offset: number
+ size: number
+ zerofill: boolean
+}
+
+const MACH_KINDS: Record<number, ObjectKind> = {
+ 0x1: 'relocatable',
+ 0x2: 'executable',
+ 0x3: 'library',
+ 0x4: 'dump',
+ 0x5: 'executable',
+ 0x6: 'library',
+ 0x7: 'executable',
+ 0x8: 'library',
+ 0xa: 'debug',
+ 0xb: 'library',
+}
+
+class MachObject implements NativeObject {
+ readonly format = 'macho' as const
+ readonly kind: ObjectKind
+ readonly littleEndian: boolean
+ readonly relocatable: boolean
+ readonly cputype: number
+ readonly cpusubtype: number
+ private readonly sections: MachSection[] = []
+ private readonly cache = new Map<string, Uint8Array | null>()
+ private uuid: string | null = null
+
+ constructor(readonly source: Source) {
+ const header = source.read(0, 32)
+ if (header.length < 28) {
+ throw new DwarfError('truncated Mach-O header')
+ }
+ const magic = new DataView(header.buffer, header.byteOffset, header.length).getUint32(0, false)
+ this.littleEndian = magic === MH_CIGAM || magic === MH_CIGAM_64
+ const is64 = magic === MH_MAGIC_64 || magic === MH_CIGAM_64
+ const cursor = new Cursor(header, this.littleEndian, 4)
+ this.cputype = cursor.u32()
+ this.cpusubtype = cursor.u32()
+ const filetype = cursor.u32()
+ const ncmds = cursor.u32()
+ const sizeofcmds = cursor.u32()
+ this.kind = MACH_KINDS[filetype] ?? 'other'
+ this.relocatable = filetype === 1
+ // goblin's non-lossy `MachO::parse` rejects these, and symbolic reports an invalid file.
+ const bad = (why: string): never => {
+ throw new DwarfError(`invalid MachO file (${why})`)
+ }
+ if (ncmds > Math.floor(sizeofcmds / 8) || sizeofcmds > source.size) {
+ bad('load command count')
+ }
+ let hasText = false
+ let hasMain = false
+ // goblin reads each command at the running offset, not bounded by sizeofcmds, and
+ // advances by cmdsize whatever its value. A cmdsize below the 8-byte header is the one
+ // difference: dyld rejects it, and here it would re-read one command for every ncmds.
+ let position = is64 ? 32 : 28
+ for (let index = 0; index < ncmds; index++) {
+ if (position + 8 > source.size) {
+ bad('load command out of bounds')
+ }
+ const command = new Cursor(source.read(position, 8), this.littleEndian)
+ const cmd = command.u32()
+ const cmdsize = command.u32()
+ if (cmdsize > source.size - position) {
+ bad('load command larger than the file')
+ }
+ if (cmdsize < 8) {
+ bad('load command smaller than its header')
+ }
+ if (cmd === 0x19 || cmd === 0x1) {
+ const segment64 = cmd === 0x19
+ const segmentSize = segment64 ? 72 : 56
+ if (position + segmentSize > source.size) {
+ bad('segment command out of bounds')
+ }
+ const segment = new Cursor(source.read(position, segmentSize), this.littleEndian, 8)
+ const segname = segment.split(16).buf.subarray(segment.pos - 16, segment.pos)
+ if (String.fromCharCode(...segname.subarray(0, 7)) === '__TEXT\0') {
+ hasText = true
+ }
+ segment.skip(segment64 ? 8 : 4)
+ segment.skip(segment64 ? 8 : 4)
+ const fileoff = segment64 ? segment.u64() : segment.u32()
+ const filesize = segment64 ? segment.u64() : segment.u32()
+ if (filesize !== 0 && fileoff + filesize > source.size) {
+ bad('segment data out of bounds')
+ }
+ segment.skip(8)
+ const nsects = segment.u32()
+ // A section header past the end of the file fails every later section lookup.
+ const sectionSize = segment64 ? 80 : 68
+ const tableAt = position + segmentSize
+ const fit = Math.max(0, Math.min(nsects, Math.floor((source.size - tableAt) / sectionSize)))
+ const table = new Cursor(source.read(tableAt, fit * sectionSize), this.littleEndian)
+ for (let section = 0; section < fit; section++) {
+ const sectname = table.buf.subarray(table.pos, table.pos + 16)
+ table.skip(32)
+ table.skip(segment64 ? 8 : 4)
+ const size = segment64 ? table.u64() : table.u32()
+ const offset = table.u32()
+ table.skip(12)
+ const flags = table.u32()
+ table.skip(segment64 ? 12 : 8)
+ const nul = sectname.indexOf(0)
+ const type = flags & 0xff
+ this.sections.push({
+ name: utf8Strict(nul < 0 ? sectname : sectname.subarray(0, nul)) ?? '',
+ offset,
+ size,
+ zerofill: type === 0x1 || type === 0xc || type === 0x12,
+ })
+ }
+ if (fit < nsects) {
+ this.sections.push({ name: '', offset: 0, size: 0, zerofill: false, poison: true })
+ }
+ } else if (cmd === 0x2) {
+ if (position + 24 > source.size) {
+ bad('symtab command out of bounds')
+ }
+ const symtab = new Cursor(source.read(position + 8, 16), this.littleEndian)
+ const symoff = symtab.u32()
+ symtab.u32()
+ const stroff = symtab.u32()
+ if (stroff < symoff || symoff >= source.size) {
+ bad('symbol table offset')
+ }
+ } else if (cmd === 0x1b && this.uuid === null && cmdsize >= 24) {
+ this.uuid = formatUuid(source.read(position + 8, 16))
+ } else if (cmd === 0x80000028) {
+ hasMain = true
+ }
+ position += cmdsize
+ }
+ if (hasMain && !hasText) {
+ bad('LC_MAIN without __TEXT')
+ }
+ }
+
+ hasDebugInfo(): boolean {
+ return this.find('debug_info') !== null
+ }
+
+ hasCodeId(): boolean {
+ return true
+ }
+
+ debugId(): string | null {
+ return this.uuid
+ }
+
+ section(name: string): Uint8Array | null {
+ if (!this.cache.has(name)) {
+ const reader = this.window(name)
+ this.cache.set(name, reader ? reader.read(0, reader.size) : null)
+ }
+ return this.cache.get(name)!
+ }
+
+ probe(): void {}
+
+ window(name: string): SectionReader | null {
+ const section = this.find(name)
+ if (section === null) {
+ return null
+ }
+ if (section.zerofill || section.offset > this.source.size || section.offset + section.size > this.source.size) {
+ return bufferReader(new Uint8Array(0))
+ }
+ return fileReader(this.source, section.offset, section.size)
+ }
+
+ private find(name: string): MachSection | null {
+ for (const section of this.sections) {
+ if (section.poison) {
+ return null
+ }
+ if (!section.name.startsWith('__')) {
+ continue
+ }
+ // Mach-O section names hold at most 16 bytes: `__debug_str_offs`.
+ const short = section.name.slice(2)
+ if ((short === 'debug_str_offs' ? 'debug_str_offsets' : short) !== name) {
+ continue
+ }
+ // dsymutil can keep a header but drop its data. symbolic treats that as missing.
+ return section.offset === 0 ? null : section
+ }
+ return null
+ }
+}
+
+// goblin `Strtab::parse`: every NUL-separated string must be valid UTF-8, else the table is empty.
+function parseStrtab(bytes: Uint8Array): { start: number; bytes: Uint8Array }[] {
+ const out: { start: number; bytes: Uint8Array }[] = []
+ let index = 0
+ while (index < bytes.length) {
+ let end = bytes.indexOf(0, index)
+ if (end < 0) {
+ end = bytes.length
+ }
+ const text = bytes.subarray(index, end)
+ if (utf8Strict(text) === null) {
+ return []
+ }
+ out.push({ start: index, bytes: text })
+ index = end + 1
+ }
+ return out
+}
+
+interface ElfSection {
+ nameOffset: number
+ type: number
+ flags: number
+ offset: number
+ size: number
+ align: number
+}
+
+interface ProgramHeader {
+ type: number
+ offset: number
+ filesz: number
+ align: number
+}
+
+const ELF_KINDS: Record<number, ObjectKind> = {
+ 0: 'none',
+ 1: 'relocatable',
+ 2: 'executable',
+ 3: 'library',
+ 4: 'dump',
+ 0xfe10: 'executable',
+ 0xfe18: 'library',
+}
+
+const PT_INTERP = 3
+const PT_NOTE = 4
+const PT_SCE_DYNLIBDATA = 0x61000000
+const SHT_NOTE = 7
+const SHT_NOBITS = 8
+const NT_GNU_BUILD_ID = 3
+
+class ElfObject implements NativeObject {
+ readonly format = 'elf' as const
+ readonly kind: ObjectKind
+ readonly littleEndian: boolean
+ readonly relocatable: boolean
+ private readonly is64: boolean
+ private readonly sections: ElfSection[] = []
+ private readonly programs: ProgramHeader[] = []
+ private shstrtab: { start: number; bytes: Uint8Array }[] = []
+ private readonly cache = new Map<string, Uint8Array | null>()
+ private buildId: Uint8Array | null | undefined
+
+ constructor(readonly source: Source) {
+ const header = source.read(0, 64)
+ const invalid = (): never => {
+ throw new DwarfError('ELF header unreadable')
+ }
+ if (header.length < 52 || (header[4] !== 1 && header[4] !== 2) || (header[5] !== 1 && header[5] !== 2)) {
+ invalid()
+ }
+ this.is64 = header[4] === 2
+ if (this.is64 && header.length < 64) {
+ invalid()
+ }
+ this.littleEndian = header[5] === 1
+ const cursor = new Cursor(header, this.littleEndian, 16)
+ const etype = cursor.u16()
+ this.relocatable = etype === 1
+ cursor.u16()
+ cursor.u32()
+ cursor.skip(this.is64 ? 8 : 4)
+ const phoff = this.is64 ? cursor.u64() : cursor.u32()
+ const shoff = this.is64 ? cursor.u64() : cursor.u32()
+ cursor.u32()
+ cursor.u16()
+ // goblin sizes entries from the ELF class, not from e_phentsize and e_shentsize.
+ cursor.u16()
+ const phnum = cursor.u16()
+ cursor.u16()
+ let shnum = cursor.u16()
+ const shstrndx = cursor.u16()
+
+ const programSize = this.is64 ? 56 : 32
+ if (phnum > Math.floor(source.size / programSize) || (phnum > 0 && phoff + phnum * programSize > source.size)) {
+ throw new DwarfError('unable to parse program headers')
+ }
+ const programTable = source.read(phoff, phnum * programSize)
+ for (let index = 0; index < phnum; index++) {
+ this.programs.push(this.readPhdr(programTable.subarray(index * programSize, (index + 1) * programSize)))
+ }
+ const entrySize = this.is64 ? 64 : 40
+ if (shoff !== 0) {
+ if (shoff + entrySize > source.size) {
+ throw new DwarfError('unable to parse section headers')
+ }
+ const first = this.readShdr(source.read(shoff, entrySize))
+ // With more than 0xff00 sections, the real count lives in the null header's sh_size.
+ if (shnum === 0) {
+ shnum = first.size
+ }
+ if (shnum > Math.floor(source.size / entrySize) || shoff + shnum * entrySize > source.size) {
+ throw new DwarfError('unable to parse section headers')
+ }
+ const table = source.read(shoff, shnum * entrySize)
+ for (let index = 0; index < shnum; index++) {
+ this.sections.push(this.readShdr(table.subarray(index * entrySize, (index + 1) * entrySize)))
+ }
+ }
+ // A bad name table only leaves the object without section names (`return_partial_on_err!`).
+ // SHN_XINDEX is not followed.
+ const names = this.sections[shstrndx]
+ if (names && !(names.type !== SHT_NOBITS && names.size !== 0 && names.offset + names.size > source.size)) {
+ this.shstrtab = parseStrtab(source.read(names.offset, names.size))
+ }
+ this.kind = this.classify(etype)
+ }
+
+ private classify(etype: number): ObjectKind {
+ const kind = ELF_KINDS[etype] ?? 'other'
+ // objcopy --only-keep-debug keeps ET_EXEC but drops the interpreter, and keeps ET_DYN
+ // but drops `.text`.
+ if (kind === 'executable' && this.interpreter() === null) {
+ return 'debug'
+ }
+ if (kind === 'library' && this.find('text') === null) {
+ return 'debug'
+ }
+ return kind
+ }
+
+ // goblin keeps the last PT_INTERP with data, as a string without its terminator.
+ private interpreter(): string | null {
+ let found: string | null = null
+ for (const program of this.programs) {
+ if (program.type === PT_INTERP && program.filesz !== 0) {
+ const end = program.offset + program.filesz - 1
+ found =
+ end <= this.source.size ? utf8Strict(this.source.read(program.offset, program.filesz - 1)) : null
+ }
+ }
+ return found
+ }
+
+ private readPhdr(bytes: Uint8Array): ProgramHeader {
+ const cursor = new Cursor(bytes, this.littleEndian)
+ const type = cursor.u32()
+ if (this.is64) {
+ cursor.u32()
+ const offset = cursor.u64()
+ cursor.u64()
+ cursor.u64()
+ const filesz = cursor.u64()
+ cursor.u64()
+ return { type, offset, filesz, align: cursor.u64() }
+ }
+ const offset = cursor.u32()
+ cursor.u32()
+ cursor.u32()
+ const filesz = cursor.u32()
+ cursor.u32()
+ cursor.u32()
+ return { type, offset, filesz, align: cursor.u32() }
+ }
+
+ private readShdr(bytes: Uint8Array): ElfSection {
+ const cursor = new Cursor(bytes, this.littleEndian)
+ const nameOffset = cursor.u32()
+ const type = cursor.u32()
+ const flags = this.is64 ? cursor.u64() : cursor.u32()
+ cursor.skip(this.is64 ? 8 : 4)
+ const offset = this.is64 ? cursor.u64() : cursor.u32()
+ const size = this.is64 ? cursor.u64() : cursor.u32()
+ cursor.u32()
+ cursor.u32()
+ const align = this.is64 ? cursor.u64() : cursor.u32()
+ return { nameOffset, type, flags, offset, size, align }
+ }
+
+ // goblin `Strtab::get_at`: an exact string start, or a suffix that starts on a char boundary.
+ private nameAt(offset: number): string | null {
+ const table = this.shstrtab
+ let low = 0
+ let high = table.length
+ while (low < high) {
+ const middle = (low + high) >> 1
+ if (table[middle]!.start <= offset) {
+ low = middle + 1
+ } else {
+ high = middle
+ }
+ }
+ if (low === 0) {
+ return null
+ }
+ const { start, bytes } = table[low - 1]!
+ const relative = offset - start
+ if (relative > bytes.length || (relative < bytes.length && (bytes[relative]! & 0xc0) === 0x80)) {
+ return null
+ }
+ return utf8Strict(bytes.subarray(relative))
+ }
+
+ // goblin's note iterators: PT_NOTE program headers first, then `.note.gnu.build-id`
+ // sections, then a 20-byte PT_SCE_DYNLIBDATA. The first error ends a list.
+ private findBuildId(): Uint8Array | null {
+ if (this.buildId !== undefined) {
+ return this.buildId
+ }
+ const fromNotes = (regions: { offset: number; size: number; align: number }[]): Uint8Array | null => {
+ for (const region of regions) {
+ let offset = region.offset
+ const end = region.offset + region.size
+ while (offset < end) {
+ const note = this.readNote(offset, region.align)
+ if (note === null) {
+ return null
+ }
+ if (note.type === NT_GNU_BUILD_ID) {
+ return note.desc
+ }
+ offset = note.next
+ }
+ }
+ return null
+ }
+ let found = fromNotes(
+ this.programs
+ .filter((program) => program.type === PT_NOTE)
+ .map((program) => ({ offset: program.offset, size: program.filesz, align: program.align }))
+ )
+ found ??= fromNotes(
+ this.sections
+ .filter(
+ (section) => section.type === SHT_NOTE && this.nameAt(section.nameOffset) === '.note.gnu.build-id'
+ )
+ .map((section) => ({ offset: section.offset, size: section.size, align: section.align }))
+ )
+ if (found === null) {
+ for (const program of this.programs) {
+ if (program.type === PT_SCE_DYNLIBDATA && program.filesz >= 20) {
+ found = program.offset + 20 <= this.source.size ? this.source.read(program.offset, 20) : null
+ break
+ }
+ }
+ }
+ this.buildId = found
+ return found
+ }
+
+ private readNote(offset: number, align: number): { type: number; desc: Uint8Array; next: number } | null {
+ const alignment = align < 4 ? 4 : align
+ if (alignment !== 4 && alignment !== 8) {
+ return null
+ }
+ const pad = (value: number): number =>
+ value % alignment === 0 ? value : value + alignment - (value % alignment)
+ if (offset + 12 > this.source.size) {
+ return null
+ }
+ const header = new Cursor(this.source.read(offset, 12), this.littleEndian)
+ const namesz = header.u32()
+ const descsz = header.u32()
+ const type = header.u32()
+ let position = offset + 12
+ const nameLength = Math.max(0, namesz - 1)
+ if (position + nameLength > this.source.size || utf8Strict(this.source.read(position, nameLength)) === null) {
+ return null
+ }
+ position = pad(position - offset + nameLength + (namesz > 0 ? 1 : 0)) + offset
+ if (position + descsz > this.source.size) {
+ return null
+ }
+ const desc = this.source.read(position, descsz)
+ return { type, desc, next: pad(position - offset + descsz) + offset }
+ }
+
+ hasDebugInfo(): boolean {
+ return this.find('debug_info') !== null
+ }
+
+ hasCodeId(): boolean {
+ const id = this.findBuildId()
+ return id !== null && id.length > 0
+ }
+
+ // symbolic `compute_debug_id`: the first 16 bytes of the build id, zero-padded, with the
+ // first three UUID fields byte-swapped for little-endian files.
+ debugId(): string | null {
+ const id = this.findBuildId()
+ if (id === null) {
+ return null
+ }
+ const data = new Uint8Array(16)
+ data.set(id.subarray(0, 16))
+ if (this.littleEndian) {
+ data.subarray(0, 4).reverse()
+ data.subarray(4, 6).reverse()
+ data.subarray(6, 8).reverse()
+ }
+ return formatUuid(data)
+ }
+
+ section(name: string): Uint8Array | null {
+ if (!this.cache.has(name)) {
+ this.cache.set(name, this.load(name))
+ }
+ return this.cache.get(name)!
+ }
+
+ probe(name: string): void {
+ this.find(name)
+ }
+
+ window(name: string): SectionReader | null {
+ const hit = this.find(name)
+ if (!hit) {
+ return null
+ }
+ if (hit.compressed) {
+ const data = this.section(name)
+ return data ? bufferReader(data) : null
+ }
+ return fileReader(this.source, hit.section.offset, hit.section.size)
+ }
+
+ private load(name: string): Uint8Array | null {
+ const hit = this.find(name)
+ if (!hit) {
+ return null
+ }
+ const data = this.source.read(hit.section.offset, hit.section.size)
+ return hit.compressed ? this.decompress(data) : data
+ }
+
+ private find(name: string): { section: ElfSection; compressed: boolean } | null {
+ for (const section of this.sections) {
+ if (section.type === SHT_NOBITS) {
+ continue
+ }
+ const full = this.nameAt(section.nameOffset)
+ if (full === null || section.offset === 0 || full === '') {
+ continue
+ }
+ // `.zdebug_*` is the GNU format from before SHF_COMPRESSED. Otherwise symbolic drops
+ // the first character, whatever it is.
+ const compressed = full.startsWith('.z') || (section.flags & 0x800) !== 0
+ const short = full.startsWith('.z') ? full.slice(2) : full.slice(1)
+ if (short !== name) {
+ continue
+ }
+ // symbolic slices without a bounds check here, so posthog-cli panics.
+ if (section.offset + section.size > this.source.size) {
+ throw new DwarfError('panic: section out of bounds')
+ }
+ return { section, compressed }
+ }
+ return null
+ }
+
+ // symbolic `ElfObject::decompress_section`. Any failure means the section is missing.
+ private decompress(data: Uint8Array): Uint8Array | null {
+ let zstd: boolean
+ let size: number
+ let payload: Uint8Array
+ if (data.length >= 4 && data[0] === 0x5a && data[1] === 0x4c && data[2] === 0x49 && data[3] === 0x42) {
+ if (data.length < 12) {
+ return null
+ }
+ zstd = false
+ size = new Cursor(data, false, 4).u64()
+ payload = data.subarray(12)
+ } else {
+ try {
+ const cursor = new Cursor(data, this.littleEndian)
+ const type = cursor.u32()
+ if (this.is64) {
+ cursor.u32()
+ }
+ size = this.is64 ? cursor.u64() : cursor.u32()
+ if (type !== 1 && type !== 2) {
+ return null
+ }
+ zstd = type === 2
+ } catch {
+ return null
+ }
+ payload = data.subarray(this.is64 ? 24 : 12)
+ }
+ // Inflating stops at the declared size, so a small crafted section can't fill memory. A
+ // stream longer than that is refused, where symbolic keeps the first `size` bytes.
+ const maxOutputLength = Math.min(Math.max(size, 1), kMaxLength)
+ try {
+ if (zstd) {
+ return new Uint8Array(zstdDecompressSync(payload, { maxOutputLength }))
+ }
+ // flate2's `decompress_vec` never reads the adler32 trailer, so validate the zlib
+ // header and inflate the raw deflate stream.
+ if (payload.length < 2) {
+ return null
+ }
+ const cmf = payload[0]!
+ const flg = payload[1]!
+ if ((cmf & 0x0f) !== 8 || cmf >> 4 > 7 || (cmf * 256 + flg) % 31 !== 0 || flg & 0x20) {
+ return null
+ }
+ return new Uint8Array(
+ inflateRawSync(payload.subarray(2), { finishFlush: zc.Z_SYNC_FLUSH, maxOutputLength })
+ )
+ } catch {
+ return null
+ }
+ }
+}
+
+export function isMachObject(object: NativeObject): object is NativeObject & { cputype: number; cpusubtype: number } {
+ return object.format === 'macho'
+}
diff --git a/hog/src/error-tracking/native/package.ts b/hog/src/error-tracking/native/package.ts
new file mode 100644
index 000000000000..d560cdb2a984
--- /dev/null
+++ b/hog/src/error-tracking/native/package.ts
@@ -0,0 +1,172 @@
+import { closeSync, openSync, readdirSync, readFileSync, readSync, statSync } from 'node:fs'
+import { join } from 'node:path'
+
+import { SymbolDataType, writeSymbolData } from '../container'
+import { MAX_FILE_SIZE, type SymbolSetUpload } from '../upload'
+import { BufferSource, fatArches, openArchive, type NativeObject } from './object'
+import { ZipWriter } from './zip'
+
+export type NativeProblem = 'no_debug_info' | 'no_build_id' | 'missing_uuid' | 'compressed_dwarf'
+
+export interface NativeFile {
+ path: string
+ debugId: string
+ format: 'elf' | 'macho'
+ data: Uint8Array
+}
+
+export type NativeCandidate = { file: NativeFile } | { path: string; problem: NativeProblem }
+
+const ELF_MAGIC = '7f454c46'
+const MACHO_MAGICS = ['cffaedfe', 'cefaedfe', 'cafebabe']
+
+// Thin little-endian Mach-O, 32-bit fat, and ELF. Big-endian Mach-O and 64-bit fat files are
+// not native files to posthog-cli.
+export function nativeFormat(path: string): 'elf' | 'macho' | null {
+ let descriptor: number
+ try {
+ descriptor = openSync(path, 'r')
+ } catch {
+ return null
+ }
+ try {
+ const magic = Buffer.alloc(4)
+ if (readSync(descriptor, magic, 0, 4, 0) !== 4) {
+ return null
+ }
+ const hex = magic.toString('hex')
+ return hex === ELF_MAGIC ? 'elf' : MACHO_MAGICS.includes(hex) ? 'macho' : null
+ } finally {
+ closeSync(descriptor)
+ }
+}
+
+const isLoadable = (object: NativeObject): boolean =>
+ object.kind === 'executable' || object.kind === 'library' || object.kind === 'debug'
+
+// symbolic's view of one file: a fat Mach-O gives one candidate per slice. Relocatable objects
+// and other kinds give none. Throws when symbolic can't parse the file.
+export function nativeCandidates(path: string): NativeCandidate[] {
+ const bytes = readFileSync(path)
+ const candidates: NativeCandidate[] = []
+ for (const object of openArchive(new BufferSource(bytes))) {
+ if (!isLoadable(object)) {
+ continue
+ }
+ const data = object.source.read(0, object.source.size)
+ if (!object.hasDebugInfo()) {
+ const compressed = object.format === 'macho' && Buffer.from(data).includes('__zdebug_')
+ candidates.push({ path, problem: compressed ? 'compressed_dwarf' : 'no_debug_info' })
+ continue
+ }
+ const debugId = object.debugId()
+ if (!object.hasCodeId() || debugId === null) {
+ candidates.push({ path, problem: object.format === 'macho' ? 'missing_uuid' : 'no_build_id' })
+ continue
+ }
+ // Chunk ids are case-sensitive: ELF ids are lowercase and Mach-O ids uppercase, as the SDKs
+ // report them.
+ candidates.push({
+ file: {
+ path,
+ format: object.format,
+ data,
+ debugId: object.format === 'macho' ? debugId.toUpperCase() : debugId,
+ },
+ })
+ }
+ return candidates
+}
+
+export function nativeUpload(file: NativeFile, sources?: (zip: ZipWriter) => void): SymbolSetUpload {
+ const zip = new ZipWriter()
+ zip.add('dwarf', file.data)
+ sources?.(zip)
+ const type = file.format === 'macho' ? SymbolDataType.AppleDsym : SymbolDataType.ElfDebugInfo
+ return { chunkId: file.debugId, releaseId: null, data: writeSymbolData(type, zip.finish()) }
+}
+
+export interface DsymSlice {
+ uuid: string
+ path: string
+ data: Uint8Array
+}
+
+// What `dwarfdump --uuid` and `lipo -thin` give posthog-cli: every slice of every binary in the
+// bundle, with its uppercase UUID and its own bytes. A thin binary is its whole file.
+// Symlinks inside the bundle are followed, as those tools follow them. `include` applies the
+// source's ignore globs to members.
+export function dsymSlices(bundle: string, include: (path: string) => boolean = () => true): DsymSlice[] {
+ if (!statSync(bundle).isDirectory()) {
+ throw new Error(`${bundle} is not a directory`)
+ }
+ const folder = join(bundle, 'Contents', 'Resources', 'DWARF')
+ const slices: DsymSlice[] = []
+ for (const name of readdirSync(folder).sort()) {
+ const path = join(folder, name)
+ if (!statSync(path).isFile() || !include(path)) {
+ continue
+ }
+ const bytes = readFileSync(path)
+ const source = new BufferSource(bytes)
+ const arches = fatArches(source, { fat64: true })
+ const parts = arches ? arches.map((arch) => bytes.subarray(arch.offset, arch.offset + arch.size)) : [bytes]
+ for (const part of parts) {
+ const [object] = openArchive(new BufferSource(part))
+ const uuid = object?.debugId()
+ if (object?.format === 'macho' && uuid) {
+ slices.push({ uuid: uuid.toUpperCase(), path, data: part })
+ }
+ }
+ }
+ if (slices.length === 0) {
+ throw new Error(`hog found no UUIDs in the dSYM at ${bundle}`)
+ }
+ return slices
+}
+
+export function dsymUpload(slice: DsymSlice, sources?: (zip: ZipWriter) => void): SymbolSetUpload {
+ const zip = new ZipWriter()
+ zip.add('dwarf', slice.data)
+ sources?.(zip)
+ return { chunkId: slice.uuid, releaseId: null, data: writeSymbolData(SymbolDataType.AppleDsym, zip.finish()) }
+}
+
+// `merge_uploads_prefer_dsym`: dSYM symbol sets that fit go first, so they win over a native file
+// with the same id, then native files, then oversized dSYMs. The first set per chunk id stays.
+export function mergePreferDsym(
+ dsyms: SymbolSetUpload[],
+ natives: SymbolSetUpload[],
+ onDuplicate: (dropped: SymbolSetUpload) => void
+): SymbolSetUpload[] {
+ const fits = (upload: SymbolSetUpload): boolean => upload.data.length <= MAX_FILE_SIZE
+ const ordered = [...dsyms.filter(fits), ...natives, ...dsyms.filter((upload) => !fits(upload))]
+ const seen = new Set<string>()
+ return ordered.filter((upload) => {
+ if (seen.has(upload.chunkId)) {
+ onDuplicate(upload)
+ return false
+ }
+ seen.add(upload.chunkId)
+ return true
+ })
+}
+
+export function dedupeNativeFiles(
+ files: NativeFile[],
+ onDuplicate: (dropped: NativeFile, kept: NativeFile) => void
+): NativeFile[] {
+ const kept = new Map<string, NativeFile>()
+ for (const file of files) {
+ const existing = kept.get(file.debugId)
+ if (!existing) {
+ kept.set(file.debugId, file)
+ } else if (file.data.length > existing.data.length) {
+ kept.set(file.debugId, file)
+ onDuplicate(existing, file)
+ } else {
+ onDuplicate(file, existing)
+ }
+ }
+ return [...kept.values()]
+}
diff --git a/hog/src/error-tracking/native/zip.ts b/hog/src/error-tracking/native/zip.ts
new file mode 100644
index 000000000000..4c4d26947886
--- /dev/null
+++ b/hog/src/error-tracking/native/zip.ts
@@ -0,0 +1,127 @@
+import { deflateRaw } from 'pako'
+
+// The zip posthog-cli builds with the `zip` crate 2.4.2: deflate at level 6 through stock zlib,
+// the fixed 1980-01-01 timestamp, Unix 0644 attributes, no extra fields, no data descriptor.
+// pako reproduces stock zlib's output. Bun's own deflate does not, and the zip is hashed.
+
+const LOCAL_HEADER = 0x04034b50
+const CENTRAL_HEADER = 0x02014b50
+const END_OF_CENTRAL_DIRECTORY = 0x06054b50
+const VERSION_NEEDED = 20
+const VERSION_MADE_BY = 0x0314
+const DEFLATED = 8
+const DOS_DATE = 0x0021
+const UNIX_FILE_0644 = 0x81a40000
+const UTF8_NAME = 0x0800
+
+const CRC_TABLE = (() => {
+ const table = new Uint32Array(256)
+ for (let index = 0; index < 256; index++) {
+ let value = index
+ for (let bit = 0; bit < 8; bit++) {
+ value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1
+ }
+ table[index] = value >>> 0
+ }
+ return table
+})()
+
+function crc32(bytes: Uint8Array): number {
+ let crc = 0xffffffff
+ for (const byte of bytes) {
+ crc = CRC_TABLE[(crc ^ byte) & 0xff]! ^ (crc >>> 8)
+ }
+ return (crc ^ 0xffffffff) >>> 0
+}
+
+export class ZipError extends Error {}
+
+interface Entry {
+ name: Buffer
+ flags: number
+ crc: number
+ compressedSize: number
+ size: number
+ offset: number
+}
+
+export class ZipWriter {
+ private readonly chunks: Uint8Array[] = []
+ private readonly entries: Entry[] = []
+ private length = 0
+ private readonly names = new Set<string>()
+
+ add(name: string, data: Uint8Array): void {
+ if (this.names.has(name)) {
+ throw new ZipError('Duplicate filename')
+ }
+ if (data.length > 0xffffffff) {
+ throw new ZipError('Large file option has not been set')
+ }
+ this.names.add(name)
+ const encoded = Buffer.from(name, 'utf8')
+ const compressed = deflateRaw(data, { level: 6, windowBits: 15, memLevel: 8, strategy: 0 })
+ const entry: Entry = {
+ name: encoded,
+ flags: encoded.every((byte) => byte < 0x80) ? 0 : UTF8_NAME,
+ crc: crc32(data),
+ compressedSize: compressed.length,
+ size: data.length,
+ offset: this.length,
+ }
+ const header = Buffer.alloc(30)
+ header.writeUInt32LE(LOCAL_HEADER, 0)
+ header.writeUInt16LE(VERSION_NEEDED, 4)
+ header.writeUInt16LE(entry.flags, 6)
+ header.writeUInt16LE(DEFLATED, 8)
+ header.writeUInt16LE(0, 10)
+ header.writeUInt16LE(DOS_DATE, 12)
+ header.writeUInt32LE(entry.crc, 14)
+ header.writeUInt32LE(entry.compressedSize, 18)
+ header.writeUInt32LE(entry.size, 22)
+ header.writeUInt16LE(encoded.length, 26)
+ header.writeUInt16LE(0, 28)
+ this.push(header, encoded, compressed)
+ this.entries.push(entry)
+ }
+
+ finish(): Buffer {
+ if (this.entries.length > 0xffff || this.length > 0xffffffff) {
+ throw new ZipError('Zip64 archives are not supported')
+ }
+ const directoryOffset = this.length
+ for (const entry of this.entries) {
+ const header = Buffer.alloc(46)
+ header.writeUInt32LE(CENTRAL_HEADER, 0)
+ header.writeUInt16LE(VERSION_MADE_BY, 4)
+ header.writeUInt16LE(VERSION_NEEDED, 6)
+ header.writeUInt16LE(entry.flags, 8)
+ header.writeUInt16LE(DEFLATED, 10)
+ header.writeUInt16LE(0, 12)
+ header.writeUInt16LE(DOS_DATE, 14)
+ header.writeUInt32LE(entry.crc, 16)
+ header.writeUInt32LE(entry.compressedSize, 20)
+ header.writeUInt32LE(entry.size, 24)
+ header.writeUInt16LE(entry.name.length, 28)
+ header.writeUInt32LE(UNIX_FILE_0644, 38)
+ header.writeUInt32LE(entry.offset, 42)
+ this.push(header, entry.name)
+ }
+ const directorySize = this.length - directoryOffset
+ const end = Buffer.alloc(22)
+ end.writeUInt32LE(END_OF_CENTRAL_DIRECTORY, 0)
+ end.writeUInt16LE(this.entries.length, 8)
+ end.writeUInt16LE(this.entries.length, 10)
+ end.writeUInt32LE(directorySize, 12)
+ end.writeUInt32LE(directoryOffset, 16)
+ this.push(end)
+ return Buffer.concat(this.chunks)
+ }
+
+ private push(...parts: Uint8Array[]): void {
+ for (const part of parts) {
+ this.chunks.push(part)
+ this.length += part.length
+ }
+ }
+}
diff --git a/hog/src/error-tracking/run.ts b/hog/src/error-tracking/run.ts
index 9199a6ecdfcc..51e73b2a5b55 100644
--- a/hog/src/error-tracking/run.ts
+++ b/hog/src/error-tracking/run.ts
@@ -7,7 +7,7 @@ import { EXIT_USAGE, HogError } from '@/core/errors'
import { cleanUp, cssTargets, jsTarget, type CleanupTarget } from './cleanup'
import { contentHash } from './container'
-import { discover, isIgnored, listFiles, type Artifact, type Root } from './discover'
+import { discover, isDsymBundle, isIgnored, listFiles, type Artifact, type Root } from './discover'
import { GitError, gitInfo, type GitInfo } from './git'
import {
injectEventMode,
@@ -31,6 +31,16 @@ import {
type SourcePair,
} from './kinds/js'
import { proguardContainer } from './kinds/proguard'
+import {
+ dedupeNativeFiles,
+ dsymSlices,
+ dsymUpload,
+ mergePreferDsym,
+ nativeCandidates,
+ nativeUpload,
+ type NativeFile,
+ type NativeProblem,
+} from './native/package'
import { fetchOrCreateRelease, resolveRelease, type Release, type ReleaseFields } from './release'
import { SymbolSetClient, type SymbolSetUpload, type UploadStatus } from './upload'
@@ -42,7 +52,8 @@ export interface ErrorTrackingOptions {
publicPathPrefix?: string
force: boolean
skipOnConflict: boolean
- batchSize: number
+ // Undefined uses posthog-cli's default for each artifact type.
+ batchSize?: number
concurrency: number
deleteAfter: boolean
dryRun: boolean
@@ -267,7 +278,7 @@ export interface UploadReport {
interface Planned {
artifact: Artifact
upload: SymbolSetUpload
- policy: { force: boolean; skipOnConflict: boolean }
+ policy: { force: boolean; skipOnConflict: boolean; batchSize: number }
}
function proguardGit(ctx: Context, artifact: Artifact): GitInfo | undefined {
@@ -329,7 +340,11 @@ export async function upload(
releaseId: release?.id ?? null,
data: proguardContainer(artifact.path, artifact.display),
},
- policy: { force: options.force, skipOnConflict: options.skipOnConflict },
+ policy: {
+ force: options.force,
+ skipOnConflict: options.skipOnConflict,
+ batchSize: options.batchSize ?? 50,
+ },
})
}
}
@@ -385,10 +400,12 @@ export async function upload(
warnings.push(`Duplicate chunk ID ${chunkId} across symbol sets: hog uploads the first one.`)
}
// Event mode always replaces what PostHog has, because the payload changes with each release.
- const policy =
- options.releaseMode === 'event'
+ const policy = {
+ ...(options.releaseMode === 'event'
? { force: true, skipOnConflict: false }
- : { force: options.force, skipOnConflict: options.skipOnConflict }
+ : { force: options.force, skipOnConflict: options.skipOnConflict }),
+ batchSize: options.batchSize ?? 50,
+ }
for (const { pair, upload: item } of prepared.uploads) {
planned.push({ artifact: read.artifacts.get(pair)!, upload: item, policy })
}
@@ -418,10 +435,12 @@ export async function upload(
}
}
}
- const policy =
- options.releaseMode === 'event'
+ const policy = {
+ ...(options.releaseMode === 'event'
? { force: true, skipOnConflict: false }
- : { force: options.force, skipOnConflict: options.skipOnConflict }
+ : { force: options.force, skipOnConflict: options.skipOnConflict }),
+ batchSize: options.batchSize ?? 50,
+ }
let uploadable = 0
for (const { artifact, map } of maps) {
const reason = hermesSkipReason(map)
@@ -448,6 +467,52 @@ export async function upload(
}
}
+ const nativeArtifacts = selection.artifacts.filter(
+ (artifact) => artifact.kind === 'elf' || artifact.kind === 'dsym'
+ )
+ if (nativeArtifacts.length > 0) {
+ const before = skipped.length
+ const native = packageNative(nativeArtifacts, selection.cwd, skipped)
+ if (native.length === 0 && planned.length === 0) {
+ const details = skipped
+ .slice(before)
+ .map((skip) => `\n ${skip.path}: ${skip.reason}`)
+ .join('')
+ throw new HogError(
+ 'no_debug_symbols',
+ `None of the native files or dSYM bundles could be uploaded:${details}`,
+ 'Build with debug info and a build ID, and upload before stripping.'
+ )
+ }
+ // Like `symbol-sets upload`, the release comes from the flags, then git around the first
+ // path. A git error only drops the git metadata.
+ let git: GitInfo | undefined
+ try {
+ git = gitInfo(ctx.runtime.env, resolve(selection.cwd, nativeArtifacts[0]!.root.path))
+ } catch (error) {
+ if (!(error instanceof GitError)) {
+ throw error
+ }
+ }
+ const { name, version } = resolveRelease(fields, git)
+ let releaseId: string | null = null
+ if (name !== undefined && version !== undefined) {
+ reported = { name, version, id: null }
+ if (!options.dryRun) {
+ releaseId = (await releases.get(name, version, git)).id
+ reported.id = releaseId
+ }
+ }
+ const policy = {
+ force: options.force,
+ skipOnConflict: options.skipOnConflict,
+ batchSize: options.batchSize ?? 10,
+ }
+ for (const { artifact, upload: item } of native) {
+ planned.push({ artifact, upload: { ...item, releaseId }, policy })
+ }
+ }
+
// posthog-cli's Hermes upload fails when it finds nothing to upload, so a build step that lost
// its composed maps doesn't pass while every exception stays unreadable.
if (composed.length === 0 && selection.artifacts.some((artifact) => artifact.kind === 'hermes')) {
@@ -482,7 +547,7 @@ export async function upload(
const statuses = new Map<string, UploadStatus>()
const groups = new Map<string, Planned[]>()
for (const item of planned) {
- const key = `${item.policy.force}:${item.policy.skipOnConflict}`
+ const key = `${item.policy.force}:${item.policy.skipOnConflict}:${item.policy.batchSize}`
const group = groups.get(key)
if (group) {
group.push(item)
@@ -494,7 +559,7 @@ export async function upload(
const client = await session.getClient()
const outcome = await client.upload(
group.map((item) => item.upload),
- { batchSize: options.batchSize, concurrency: options.concurrency, ...group[0]!.policy }
+ { concurrency: options.concurrency, ...group[0]!.policy }
)
for (const [chunkId, status] of outcome.status) {
statuses.set(chunkId, status)
@@ -616,3 +681,72 @@ export async function cloneMaps(
releaseId: to.map.releaseId,
}
}
+
+const NATIVE_PROBLEMS: Record<NativeProblem, string> = {
+ no_debug_info: 'it has no debug info. Build with debug info, and upload before stripping it.',
+ no_build_id:
+ "it has no GNU build ID, so crashes can't be matched to it. Link with `-Wl,--build-id=sha1`. Go needs `-ldflags=-B=gobuildid`.",
+ missing_uuid: "it has no LC_UUID, so crashes can't be matched to it. Link without `-no_uuid`.",
+ compressed_dwarf:
+ "its DWARF is compressed (`__zdebug` sections), which PostHog can't read yet. Go needs `-ldflags=-compressdwarf=false` on macOS.",
+}
+
+// `symbol-sets upload`: native files are parsed and deduplicated by debug ID, dSYM bundles are
+// split per slice, and a dSYM wins over a native file with the same ID.
+function packageNative(
+ artifacts: Artifact[],
+ cwd: string,
+ skipped: Skip[]
+): { artifact: Artifact; upload: SymbolSetUpload }[] {
+ const owners = new Map<SymbolSetUpload, Artifact>()
+ const files: { file: NativeFile; artifact: Artifact }[] = []
+ for (const artifact of artifacts.filter((candidate) => !isDsymBundle(candidate.path))) {
+ let candidates
+ try {
+ candidates = nativeCandidates(artifact.path)
+ } catch (error) {
+ skipped.push({ path: artifact.display, reason: `hog couldn't parse it: ${(error as Error).message}` })
+ continue
+ }
+ for (const candidate of candidates) {
+ if ('problem' in candidate) {
+ skipped.push({ path: artifact.display, reason: NATIVE_PROBLEMS[candidate.problem] })
+ } else {
+ files.push({ file: candidate.file, artifact })
+ }
+ }
+ }
+ const byFile = new Map(files.map(({ file, artifact }) => [file, artifact]))
+ const natives = dedupeNativeFiles(
+ files.map(({ file }) => file),
+ (dropped, kept) =>
+ skipped.push({
+ path: byFile.get(dropped)!.display,
+ reason: `${byFile.get(kept)!.display} has the same debug ID and is at least as large, so hog uploads that one.`,
+ })
+ ).map((file) => {
+ const upload = nativeUpload(file)
+ owners.set(upload, byFile.get(file)!)
+ return upload
+ })
+ const dsyms: SymbolSetUpload[] = []
+ for (const artifact of artifacts.filter((candidate) => isDsymBundle(candidate.path))) {
+ try {
+ const folder = resolve(cwd, artifact.root.path)
+ for (const slice of dsymSlices(artifact.path, (member) => !isIgnored(artifact.root, folder, member))) {
+ const upload = dsymUpload(slice)
+ owners.set(upload, artifact)
+ dsyms.push(upload)
+ }
+ } catch (error) {
+ skipped.push({ path: artifact.display, reason: `hog couldn't read the dSYM: ${(error as Error).message}` })
+ }
+ }
+ const merged = mergePreferDsym(dsyms, natives, (dropped) =>
+ skipped.push({
+ path: owners.get(dropped)!.display,
+ reason: `a dSYM bundle has the same UUID ${dropped.chunkId}, so hog uploads the bundle.`,
+ })
+ )
+ return merged.map((upload) => ({ artifact: owners.get(upload)!, upload }))
+}
diff --git a/hog/src/error-tracking/upload.ts b/hog/src/error-tracking/upload.ts
index 5c8bd8b3a72d..43e940fa716b 100644
--- a/hog/src/error-tracking/upload.ts
+++ b/hog/src/error-tracking/upload.ts
@@ -31,7 +31,7 @@ export interface UploadOutcome {
contentHashes: Map<string, string>
}
-const MAX_FILE_SIZE = 100 * 1024 * 1024
+export const MAX_FILE_SIZE = 100 * 1024 * 1024
const CHECK_BATCH_SIZE = 1000
const REQUEST_TIMEOUT_MS = 30_000
// A symbol set can be 100 MB. Its deadline grows with its size, so only a link slower than this fails.
diff --git a/hog/test/parity/README.md b/hog/test/parity/README.md
index c2ee810e11b9..1ef87d8e8f7e 100644
--- a/hog/test/parity/README.md
+++ b/hog/test/parity/README.md
@@ -24,6 +24,10 @@ They run on real bundler output in `bundles/` (esbuild, rollup, webpack and ters
Symbol-set mode mints random UUIDv7 chunk IDs, so `js-inject-symbol-set` compares where the IDs go, not their values.
The symbol-set upload scenarios then start from the files posthog-cli wrote in that scenario, so their content hashes are compared exactly.
+Native scenarios compare `hog error-tracking upload` with `posthog-cli symbol-sets upload`, which takes ELF files, Mach-O files and dSYM bundles from one folder.
+`native/build.sh` builds the binaries from the small C files in `native/src/` with Xcode's clang and ld.lld. Their DWARF records `/tmp/hog-parity-native` as the build folder.
+The fixtures cover a fat dSYM, loose Mach-O DWARF files, files without debug info or a build ID, and two files that share a build ID.
+
Hermes scenarios run the React Native steps in order with `before`: inject the Metro bundle, clone into the composed map, then upload.
The files in `hermes-fixtures.ts` are hand-written, with the Metro and Hermes keys, odd numbers and escapes that the serializer has to reproduce.
diff --git a/hog/test/parity/fixtures.ts b/hog/test/parity/fixtures.ts
index d21c76eb2c54..d96afd65219d 100644
--- a/hog/test/parity/fixtures.ts
+++ b/hog/test/parity/fixtures.ts
@@ -1,5 +1,5 @@
-import { mkdirSync, writeFileSync } from 'node:fs'
-import { dirname, join } from 'node:path'
+import { mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'
+import { dirname, join, relative } from 'node:path'
// Fixture files written into a fresh folder per run, outside any git repository unless a scenario
// builds one, so neither CLI picks up the machine's own git or CI state.
@@ -43,3 +43,20 @@ export const GIT_REPO: Record<string, string> = {
'.git/config':
'[core]\n\tbare = false\n[remote "origin"]\n\turl = https://x-access-token:[email protected]/PostHog/example-app.git\n\tfetch = +refs/heads/*:refs/remotes/origin/*\n',
}
+
+// Every file under a checked-in fixture folder except its README, keyed by relative path.
+export function readTree(root: string, prefix = ''): Record<string, Uint8Array> {
+ const files: Record<string, Uint8Array> = {}
+ const visit = (folder: string): void => {
+ for (const entry of readdirSync(folder, { withFileTypes: true })) {
+ const path = join(folder, entry.name)
+ if (entry.isDirectory()) {
+ visit(path)
+ } else if (entry.name !== 'README.md') {
+ files[join(prefix, relative(root, path))] = readFileSync(path)
+ }
+ }
+ }
+ visit(root)
+ return files
+}
diff --git a/hog/test/parity/golden/e2e/native-already-present.json b/hog/test/parity/golden/e2e/native-already-present.json
new file mode 100644
index 000000000000..788cf26a4d5a
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-already-present.json
@@ -0,0 +1,24 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-apple.json b/hog/test/parity/golden/e2e/native-apple.json
new file mode 100644
index 000000000000..c610a288440a
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-apple.json
@@ -0,0 +1,90 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/03b8a617-624e-57ff-a78a-fdee042e40a2?length=1437",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231",
+ "length": 1437
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/cb16c86e-05e6-5f21-af34-941756fc1ad7?length=1002",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f",
+ "length": 1002
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb?length=1047",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99",
+ "length": 1047
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"03b8a617-624e-57ff-a78a-fdee042e40a2\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"cb16c86e-05e6-5f21-af34-941756fc1ad7\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-dsym-root.json b/hog/test/parity/golden/e2e/native-dsym-root.json
new file mode 100644
index 000000000000..7e2dce8d7c08
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-dsym-root.json
@@ -0,0 +1,47 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":null,\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":null,\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/03b8a617-624e-57ff-a78a-fdee042e40a2?length=1437",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231",
+ "length": 1437
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"03b8a617-624e-57ff-a78a-fdee042e40a2\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-hash-mismatch-force.json b/hog/test/parity/golden/e2e/native-hash-mismatch-force.json
new file mode 100644
index 000000000000..4c53d4890037
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-hash-mismatch-force.json
@@ -0,0 +1,90 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":true,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":true,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/95b7661b-fb89-53c4-bdcb-bc1a62f7aebe?length=1493",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3",
+ "length": 1493
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/9df6ea99-d371-5ad2-83f1-9ce9293c58c2?length=1227",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d",
+ "length": 1227
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/fcc4e959-0957-51c0-887f-2b286c2fbca3?length=1510",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774",
+ "length": 1510
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"95b7661b-fb89-53c4-bdcb-bc1a62f7aebe\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"9df6ea99-d371-5ad2-83f1-9ce9293c58c2\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"fcc4e959-0957-51c0-887f-2b286c2fbca3\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-hash-mismatch.json b/hog/test/parity/golden/e2e/native-hash-mismatch.json
new file mode 100644
index 000000000000..03c48eaac3b7
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-hash-mismatch.json
@@ -0,0 +1,44 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":true}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":true}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-linux-release.json b/hog/test/parity/golden/e2e/native-linux-release.json
new file mode 100644
index 000000000000..9db039feff59
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-linux-release.json
@@ -0,0 +1,90 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/95b7661b-fb89-53c4-bdcb-bc1a62f7aebe?length=1493",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3",
+ "length": 1493
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/9df6ea99-d371-5ad2-83f1-9ce9293c58c2?length=1227",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d",
+ "length": 1227
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/fcc4e959-0957-51c0-887f-2b286c2fbca3?length=1510",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774",
+ "length": 1510
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"95b7661b-fb89-53c4-bdcb-bc1a62f7aebe\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"9df6ea99-d371-5ad2-83f1-9ce9293c58c2\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"fcc4e959-0957-51c0-887f-2b286c2fbca3\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-linux.json b/hog/test/parity/golden/e2e/native-linux.json
new file mode 100644
index 000000000000..0bf733f7f090
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-linux.json
@@ -0,0 +1,71 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":null,\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":null,\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":null,\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":null,\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":null,\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":null,\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/95b7661b-fb89-53c4-bdcb-bc1a62f7aebe?length=1493",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3",
+ "length": 1493
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/9df6ea99-d371-5ad2-83f1-9ce9293c58c2?length=1227",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d",
+ "length": 1227
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/fcc4e959-0957-51c0-887f-2b286c2fbca3?length=1510",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774",
+ "length": 1510
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"95b7661b-fb89-53c4-bdcb-bc1a62f7aebe\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"9df6ea99-d371-5ad2-83f1-9ce9293c58c2\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"fcc4e959-0957-51c0-887f-2b286c2fbca3\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-macho-loose.json b/hog/test/parity/golden/e2e/native-macho-loose.json
new file mode 100644
index 000000000000..01a637111bc8
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-macho-loose.json
@@ -0,0 +1,78 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/cb16c86e-05e6-5f21-af34-941756fc1ad7?length=1002",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f",
+ "length": 1002
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb?length=1047",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99",
+ "length": 1047
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"cb16c86e-05e6-5f21-af34-941756fc1ad7\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-mixed-from-git.json b/hog/test/parity/golden/e2e/native-mixed-from-git.json
new file mode 100644
index 000000000000..3155fe2726dc
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-mixed-from-git.json
@@ -0,0 +1,126 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/1a090dd726e5233c41faaa8e3cdd0d85f295c741f72d295ca5bfac0b9a78d3bb86b23b73148563c49bd81c11d0b8782285a24420156dfddec37f4cb239e4705f",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"metadata\":{\"git\":{\"branch\":\"main\",\"commit_id\":\"c0ffee00c0ffee00c0ffee00c0ffee00c0ffee00\",\"remote_url\":\"https://github.com/PostHog/example-app.git\",\"repo_name\":\"example-app\"}},\"hash_id\":\"1a090dd726e5233c41faaa8e3cdd0d85f295c741f72d295ca5bfac0b9a78d3bb86b23b73148563c49bd81c11d0b8782285a24420156dfddec37f4cb239e4705f\",\"version\":\"c0ffee00c0ffee00c0ffee00c0ffee00c0ffee00\",\"project\":\"example-app\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"36a34f25-35f2-5a0c-9248-4587b214cebe\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/03b8a617-624e-57ff-a78a-fdee042e40a2?length=1437",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231",
+ "length": 1437
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/95b7661b-fb89-53c4-bdcb-bc1a62f7aebe?length=1493",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3",
+ "length": 1493
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/9df6ea99-d371-5ad2-83f1-9ce9293c58c2?length=1227",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d",
+ "length": 1227
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/cb16c86e-05e6-5f21-af34-941756fc1ad7?length=1002",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f",
+ "length": 1002
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb?length=1047",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99",
+ "length": 1047
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/fcc4e959-0957-51c0-887f-2b286c2fbca3?length=1510",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774",
+ "length": 1510
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"03b8a617-624e-57ff-a78a-fdee042e40a2\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"95b7661b-fb89-53c4-bdcb-bc1a62f7aebe\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"9df6ea99-d371-5ad2-83f1-9ce9293c58c2\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"cb16c86e-05e6-5f21-af34-941756fc1ad7\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"fcc4e959-0957-51c0-887f-2b286c2fbca3\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-only-unusable.json b/hog/test/parity/golden/e2e/native-only-unusable.json
new file mode 100644
index 000000000000..6a9be8b00c9c
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-only-unusable.json
@@ -0,0 +1,4 @@
+{
+ "exitCode": 1,
+ "requests": []
+}
diff --git a/hog/test/parity/golden/e2e/native-post-only.json b/hog/test/parity/golden/e2e/native-post-only.json
new file mode 100644
index 000000000000..f709a2e46ba7
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-post-only.json
@@ -0,0 +1,108 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"0ce25816-6d4b-ac9f-e80f-343ac1673748\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"content_length\":1493},{\"chunk_id\":\"33221100-5544-7766-8899-aabbccddeeff\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\",\"content_length\":1510},{\"chunk_id\":\"b9297132-c61d-75d5-a1c6-6d01a0cad336\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"content_length\":1227}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/s3/post",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3",
+ "length": 1493,
+ "fields": {
+ "key": "symbolsets/95b7661b-fb89-53c4-bdcb-bc1a62f7aebe",
+ "policy": "policy",
+ "x-amz-signature": "signature"
+ },
+ "filename": "file"
+ },
+ "status": 204
+ },
+ {
+ "method": "POST",
+ "path": "/s3/post",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d",
+ "length": 1227,
+ "fields": {
+ "key": "symbolsets/9df6ea99-d371-5ad2-83f1-9ce9293c58c2",
+ "policy": "policy",
+ "x-amz-signature": "signature"
+ },
+ "filename": "file"
+ },
+ "status": 204
+ },
+ {
+ "method": "POST",
+ "path": "/s3/post",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774",
+ "length": 1510,
+ "fields": {
+ "key": "symbolsets/fcc4e959-0957-51c0-887f-2b286c2fbca3",
+ "policy": "policy",
+ "x-amz-signature": "signature"
+ },
+ "filename": "file"
+ },
+ "status": 204
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"95b7661b-fb89-53c4-bdcb-bc1a62f7aebe\":\"ebc327e35e3515fcb22815ddcc793987e15758250bd00d337a479d026811b283b642c5b4f0865305d2528da00b89973460470f7f439fee667f67b77621c08fb3\",\"9df6ea99-d371-5ad2-83f1-9ce9293c58c2\":\"96e418abb16bd380e071543c5ae37dd948bf32dacf5c48fe6382a83ecf50968a8472316750b841284b1360e3dfb6bb538df8d3da72d5a9f3fc30f96fbf3c359d\",\"fcc4e959-0957-51c0-887f-2b286c2fbca3\":\"eee21b1c0d7f71e7d7d3876bcb879d88cefc38c5ed363534d8ec0b16f4ee9a1163f7097b0201ee3b5e218f45516cbb9ce4afcdf0782125dde05e620c3429e774\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/golden/e2e/native-release-mismatch.json b/hog/test/parity/golden/e2e/native-release-mismatch.json
new file mode 100644
index 000000000000..fc256e2ed72e
--- /dev/null
+++ b/hog/test/parity/golden/e2e/native-release-mismatch.json
@@ -0,0 +1,130 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "status": 404
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/releases",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"hash_id\":\"2fe445ce7d3dbca51f8170eff7d191a77579d1d0e6702eaf0485b1ffb4377bf11ed333df66d045aafd8c38d6aec52123fe7757f0a73d46fdf09d3f2966de5f45\",\"version\":\"3.2.0\",\"project\":\"shop\"}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 400
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 400
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":\"a3614f5f-44e8-5368-b5a4-7de9e0b00620\",\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 400
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_check_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":null,\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":null,\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":null,\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"force\":false,\"skip_on_conflict\":false}",
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_start_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"symbol_sets\":[{\"chunk_id\":\"323D87C5-2905-3FEF-9169-2E28016F6EA3\",\"release_id\":null,\"content_hash\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"content_length\":1002},{\"chunk_id\":\"8FCB60C2-B0D7-3006-B807-B2CFF36F7CA3\",\"release_id\":null,\"content_hash\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\",\"content_length\":1047},{\"chunk_id\":\"98EFEF90-68BF-3A75-A89C-A388EDB05326\",\"release_id\":null,\"content_hash\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"content_length\":1437}],\"upload_attempt_id\":\"<attempt-2>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/03b8a617-624e-57ff-a78a-fdee042e40a2?length=1437",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231",
+ "length": 1437
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/cb16c86e-05e6-5f21-af34-941756fc1ad7?length=1002",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f",
+ "length": 1002
+ },
+ "status": 200
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb?length=1047",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99",
+ "length": 1047
+ },
+ "status": 200
+ },
+ {
+ "method": "POST",
+ "path": "/api/projects/1/error_tracking/symbol_sets/bulk_finish_upload",
+ "headers": {
+ "authorization": "Bearer phx_<key>",
+ "content-type": "application/json"
+ },
+ "body": "{\"content_hashes\":{\"03b8a617-624e-57ff-a78a-fdee042e40a2\":\"2fe769ea8fbfd2d7aacb74166256526eefba74d134a58d3042461dec4ed2cb76c9a079e8edfae482124df188788a4870fab0dbbb14db17d1ad9526c2f2920231\",\"cb16c86e-05e6-5f21-af34-941756fc1ad7\":\"d613244a3f058b41148ee3efd124dadd493c2bae01f8a2eae20454c12387875d3eb825b39e49440f9a31e9f70eb8ac30d8af55b0ae028dd8cd146386733c9a8f\",\"f7fc99bc-8eab-5b64-b76f-5c19ac73fbcb\":\"c9b24b01acf2afea83f6a8404925c9f36cdc53c2cf6d5ac4d2b48391b460ba7ec06511334aaf688d9b87f7823cba4fad62c74aaed8699a9187cbf66aef8d2f99\"},\"upload_attempt_id\":\"<attempt-2>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ]
+}
diff --git a/hog/test/parity/js-fixtures.ts b/hog/test/parity/js-fixtures.ts
index b696bfffd167..8ca925f78a2a 100644
--- a/hog/test/parity/js-fixtures.ts
+++ b/hog/test/parity/js-fixtures.ts
@@ -1,5 +1,6 @@
-import { readdirSync, readFileSync } from 'node:fs'
-import { join, relative } from 'node:path'
+import { join } from 'node:path'
+
+import { readTree } from './fixtures'
// JavaScript bundles and maps for the parity scenarios. Each case sits in its own folder, because
// posthog-cli walks folders in file-system order, and only cases with one bundle per folder give
@@ -130,19 +131,4 @@ export const STYLESHEET_LOOKUP: Record<string, string> = {
}
// Real bundler output, built from the small app in bundles/README.md.
-export function bundles(): Record<string, Uint8Array> {
- const root = join(import.meta.dir, 'bundles')
- const files: Record<string, Uint8Array> = {}
- const visit = (folder: string): void => {
- for (const entry of readdirSync(folder, { withFileTypes: true })) {
- const path = join(folder, entry.name)
- if (entry.isDirectory()) {
- visit(path)
- } else if (entry.name !== 'README.md') {
- files[relative(root, path)] = readFileSync(path)
- }
- }
- }
- visit(root)
- return files
-}
+export const bundles = (): Record<string, Uint8Array> => readTree(join(import.meta.dir, 'bundles'))
diff --git a/hog/test/parity/native/bin/apple-loose/Badge.dwarf b/hog/test/parity/native/bin/apple-loose/Badge.dwarf
new file mode 100644
index 000000000000..0d39f16fff59
Binary files /dev/null and b/hog/test/parity/native/bin/apple-loose/Badge.dwarf differ
diff --git a/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Info.plist b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Info.plist
new file mode 100644
index 000000000000..a1977a3b64bb
--- /dev/null
+++ b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.Badge.framework</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/DWARF/Badge b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/DWARF/Badge
new file mode 100644
index 000000000000..0d39f16fff59
Binary files /dev/null and b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/DWARF/Badge differ
diff --git a/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/aarch64/Badge.yml b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/aarch64/Badge.yml
new file mode 100644
index 000000000000..49220c7a2eaf
--- /dev/null
+++ b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/aarch64/Badge.yml
@@ -0,0 +1,5 @@
+---
+triple: 'arm64-apple-darwin'
+binary-path: Badge
+relocations: []
+...
diff --git a/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/x86_64/Badge.yml b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/x86_64/Badge.yml
new file mode 100644
index 000000000000..5700524c10a0
--- /dev/null
+++ b/hog/test/parity/native/bin/apple/Badge.framework.dSYM/Contents/Resources/Relocations/x86_64/Badge.yml
@@ -0,0 +1,5 @@
+---
+triple: 'x86_64-apple-darwin'
+binary-path: Badge
+relocations: []
+...
diff --git a/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Info.plist b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Info.plist
new file mode 100644
index 000000000000..cc8f2e6d8c05
--- /dev/null
+++ b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.Shop.app</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/DWARF/Shop b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/DWARF/Shop
new file mode 100644
index 000000000000..2cfc8451a418
Binary files /dev/null and b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/DWARF/Shop differ
diff --git a/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/Relocations/aarch64/Shop.yml b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/Relocations/aarch64/Shop.yml
new file mode 100644
index 000000000000..71f0c3a3a6e5
--- /dev/null
+++ b/hog/test/parity/native/bin/apple/Shop.app.dSYM/Contents/Resources/Relocations/aarch64/Shop.yml
@@ -0,0 +1,5 @@
+---
+triple: 'arm64-apple-darwin'
+binary-path: Shop
+relocations: []
+...
diff --git a/hog/test/parity/native/bin/apple/Shop.dwarf b/hog/test/parity/native/bin/apple/Shop.dwarf
new file mode 100644
index 000000000000..2cfc8451a418
Binary files /dev/null and b/hog/test/parity/native/bin/apple/Shop.dwarf differ
diff --git a/hog/test/parity/native/bin/apple/shop-no-debug b/hog/test/parity/native/bin/apple/shop-no-debug
new file mode 100755
index 000000000000..2ae3f66e2f66
Binary files /dev/null and b/hog/test/parity/native/bin/apple/shop-no-debug differ
diff --git a/hog/test/parity/native/bin/linux/badge.o b/hog/test/parity/native/bin/linux/badge.o
new file mode 100644
index 000000000000..b70cf7c118cf
Binary files /dev/null and b/hog/test/parity/native/bin/linux/badge.o differ
diff --git a/hog/test/parity/native/bin/linux/checkout b/hog/test/parity/native/bin/linux/checkout
new file mode 100755
index 000000000000..4ff12a93bd93
Binary files /dev/null and b/hog/test/parity/native/bin/linux/checkout differ
diff --git a/hog/test/parity/native/bin/linux/checkout-no-build-id b/hog/test/parity/native/bin/linux/checkout-no-build-id
new file mode 100755
index 000000000000..96ed91139590
Binary files /dev/null and b/hog/test/parity/native/bin/linux/checkout-no-build-id differ
diff --git a/hog/test/parity/native/bin/linux/checkout-no-debug b/hog/test/parity/native/bin/linux/checkout-no-debug
new file mode 100755
index 000000000000..ccbfa2fa3e01
Binary files /dev/null and b/hog/test/parity/native/bin/linux/checkout-no-debug differ
diff --git a/hog/test/parity/native/bin/linux/libbadge.so b/hog/test/parity/native/bin/linux/libbadge.so
new file mode 100755
index 000000000000..c4edcb59ec28
Binary files /dev/null and b/hog/test/parity/native/bin/linux/libbadge.so differ
diff --git a/hog/test/parity/native/bin/linux/same-id-large b/hog/test/parity/native/bin/linux/same-id-large
new file mode 100755
index 000000000000..36bcbc5de7da
Binary files /dev/null and b/hog/test/parity/native/bin/linux/same-id-large differ
diff --git a/hog/test/parity/native/bin/linux/same-id-small b/hog/test/parity/native/bin/linux/same-id-small
new file mode 100755
index 000000000000..87bf9710f9ad
Binary files /dev/null and b/hog/test/parity/native/bin/linux/same-id-small differ
diff --git a/hog/test/parity/native/build.sh b/hog/test/parity/native/build.sh
new file mode 100755
index 000000000000..8823fa987540
--- /dev/null
+++ b/hog/test/parity/native/build.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Builds the native fixtures from src/. Run from this folder on macOS with Xcode's clang and an
+# ld.lld on PATH. The DWARF records /tmp/hog-parity-native as the build folder, so the parity
+# tests can put the sources there for --include-source.
+set -euo pipefail
+cd "$(dirname "$0")"
+OUT=bin
+BUILD=/tmp/hog-parity-native
+rm -rf "$OUT" "$BUILD"
+mkdir -p "$OUT/linux" "$OUT/apple" "$BUILD"
+cp src/* "$BUILD/"
+cd "$BUILD"
+ELF=(clang --target=x86_64-linux-gnu -g -O0 -ffreestanding -nostdlib -fuse-ld=lld -fdebug-prefix-map="$BUILD=$BUILD")
+"${ELF[@]}" -Wl,--build-id=sha1 checkout.c -o checkout
+"${ELF[@]}" -shared -fPIC -Wl,--build-id=sha1 badge.c -o libbadge.so
+"${ELF[@]}" -Wl,--build-id=none checkout.c -o checkout-no-build-id
+clang --target=x86_64-linux-gnu -g0 -O0 -ffreestanding -nostdlib -fuse-ld=lld -Wl,--build-id=sha1 checkout.c -o checkout-no-debug
+clang --target=x86_64-linux-gnu -g -O0 -c badge.c -o badge.o
+# Two files with one build ID: hog and posthog-cli keep the larger one.
+"${ELF[@]}" -Wl,--build-id=0x00112233445566778899aabbccddeeff00112233 checkout.c -o same-id-small
+"${ELF[@]}" -Wl,--build-id=0x00112233445566778899aabbccddeeff00112233 -Wl,-z,separate-code checkout.c -o same-id-large
+mv checkout libbadge.so checkout-no-build-id checkout-no-debug badge.o same-id-small same-id-large "$OLDPWD/$OUT/linux/"
+# dsymutil reads the DWARF from the object files, so they must outlive the link.
+APPLE=(clang -g -O0 -fdebug-prefix-map="$BUILD=$BUILD")
+"${APPLE[@]}" -arch arm64 -c main.c -o main.o
+"${APPLE[@]}" -arch arm64 -c badge.c -o badge-arm64.o
+clang -arch arm64 main.o badge-arm64.o -o Shop
+dsymutil Shop -o Shop.app.dSYM
+"${APPLE[@]}" -arch x86_64 -c badge.c -o badge-x86_64.o
+clang -arch arm64 -dynamiclib badge-arm64.o -o Badge-arm64
+clang -arch x86_64 -dynamiclib badge-x86_64.o -o Badge-x86_64
+lipo -create Badge-arm64 Badge-x86_64 -output Badge
+dsymutil Badge -o Badge.framework.dSYM
+clang -g0 -O0 -arch arm64 main.c badge.c -o shop-no-debug
+# Loose DWARF files: Shop.dwarf repeats the bundle's UUID, so the dSYM wins, and Badge.dwarf is fat.
+cp Shop.app.dSYM/Contents/Resources/DWARF/Shop Shop.dwarf
+cp Badge.framework.dSYM/Contents/Resources/DWARF/Badge Badge.dwarf
+mv Shop.app.dSYM Badge.framework.dSYM shop-no-debug Shop.dwarf "$OLDPWD/$OUT/apple/"
+mkdir -p "$OLDPWD/$OUT/apple-loose"
+mv Badge.dwarf "$OLDPWD/$OUT/apple-loose/"
diff --git a/hog/test/parity/native/src/badge.c b/hog/test/parity/native/src/badge.c
new file mode 100644
index 000000000000..36c4ef4e63dd
--- /dev/null
+++ b/hog/test/parity/native/src/badge.c
@@ -0,0 +1,7 @@
+int badge_width(const char *label) {
+ int width = 0;
+ while (label[width] != 0) {
+ width++;
+ }
+ return width * 7 + 12;
+}
diff --git a/hog/test/parity/native/src/checkout.c b/hog/test/parity/native/src/checkout.c
new file mode 100644
index 000000000000..22c4e47cea4a
--- /dev/null
+++ b/hog/test/parity/native/src/checkout.c
@@ -0,0 +1,12 @@
+#include "pricing.h"
+
+int checkout(int cents, int quantity) {
+ return apply_discount(cents * quantity, quantity > 10);
+}
+
+void _start(void) {
+ volatile int total = checkout(1250, 3);
+ (void)total;
+ for (;;) {
+ }
+}
diff --git a/hog/test/parity/native/src/main.c b/hog/test/parity/native/src/main.c
new file mode 100644
index 000000000000..28d9dd39d79e
--- /dev/null
+++ b/hog/test/parity/native/src/main.c
@@ -0,0 +1,7 @@
+#include "pricing.h"
+
+int badge_width(const char *label);
+
+int main(int argc, char **argv) {
+ return apply_discount(argc * 100, argc > 2) + badge_width(argv[0]);
+}
diff --git a/hog/test/parity/native/src/pricing.h b/hog/test/parity/native/src/pricing.h
new file mode 100644
index 000000000000..5fc33fcfd800
--- /dev/null
+++ b/hog/test/parity/native/src/pricing.h
@@ -0,0 +1,3 @@
+static inline int apply_discount(int total, int bulk) {
+ return bulk ? total - total / 10 : total;
+}
diff --git a/hog/test/parity/scenarios.ts b/hog/test/parity/scenarios.ts
index 07176937879c..adfbf138b805 100644
--- a/hog/test/parity/scenarios.ts
+++ b/hog/test/parity/scenarios.ts
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { Scenario } from './fake-server'
-import { GIT_REPO, mappingOfSize, SMALL_MAPPING } from './fixtures'
+import { GIT_REPO, mappingOfSize, readTree, SMALL_MAPPING } from './fixtures'
import { EXPO_BUILD, HERMES_BUILD, HERMES_BUNDLES } from './hermes-fixtures'
import { bundles, EDGE_CASES, MALFORMED_MAP_DEBUG_ID, PUBLIC_PATH, STYLESHEET_LOOKUP, STYLESHEETS } from './js-fixtures'
import { decodeFile, type ParityResult } from './run'
@@ -242,3 +242,43 @@ SCENARIOS.push(
}),
hermes('upload-no-chunk-id', hermesArgs.upload('android/hbc'), () => HERMES_BUILD)
)
+
+// posthog-cli's `symbol-sets upload`, which takes ELF files, Mach-O files and dSYM bundles in one
+// folder, and `hog error-tracking upload`. native/build.sh builds the binaries.
+const linux = (): Files => readTree(join(import.meta.dir, 'native', 'bin', 'linux'), 'linux')
+const apple = (): Files => readTree(join(import.meta.dir, 'native', 'bin', 'apple'), 'apple')
+const appleLoose = (): Files => readTree(join(import.meta.dir, 'native', 'bin', 'apple-loose'), 'apple-loose')
+
+const native = (
+ name: string,
+ path: string,
+ files: () => Files,
+ options: Partial<ParityScenario> & { args?: string[] } = {}
+): ParityScenario => ({
+ name: `native-${name}`,
+ server: 'fresh',
+ files,
+ rust: ['symbol-sets', 'upload', '-d', path, ...(options.args ?? [])],
+ hog: ['error-tracking', 'upload', path, ...(options.args ?? [])],
+ ...options,
+})
+
+const nativeRelease = ['--release-name', 'shop', '--release-version', '3.2.0']
+
+SCENARIOS.push(
+ native('linux', 'linux', linux),
+ native('linux-release', 'linux', linux, { args: nativeRelease }),
+ native('apple', 'apple', apple, { args: nativeRelease }),
+ native('dsym-root', 'apple/Shop.app.dSYM', apple),
+ native('macho-loose', 'apple-loose', appleLoose, { args: nativeRelease }),
+ native('mixed-from-git', '.', () => ({ ...GIT_REPO, ...linux(), ...apple() })),
+ native('already-present', '.', () => ({ ...linux(), ...apple() }), { args: nativeRelease, runs: 2 }),
+ native('hash-mismatch', '.', () => ({ ...linux(), ...apple() }), {
+ args: [...nativeRelease, '--skip-on-conflict'],
+ server: 'hash-mismatch',
+ }),
+ native('hash-mismatch-force', 'linux', linux, { args: [...nativeRelease, '--force'], server: 'hash-mismatch' }),
+ native('post-only', 'linux', linux, { args: nativeRelease, server: 'post-only' }),
+ native('release-mismatch', 'apple', apple, { args: nativeRelease, server: 'release-mismatch' }),
+ native('only-unusable', 'linux/checkout-no-build-id', linux)
+)
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0f33b97850e3..0b823c08198f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1529,6 +1529,9 @@ importers:
commander:
specifier: 15.0.0
version: 15.0.0
+ pako:
+ specifier: 2.1.0
+ version: 2.1.0
zod:
specifier: ^4.3.6
version: 4.3.6
@@ -1536,6 +1539,9 @@ importers:
'@types/bun':
specifier: 1.3.14
version: 1.3.14
+ '@types/pako':
+ specifier: 2.0.4
+ version: 2.0.4
typescript:
specifier: 6.0.3
version: 6.0.3
@@ -13921,6 +13927,9 @@ packages:
resolution: {integrity: sha512-kK1eBS/Adeyis+3OlBDMeQQuasIDLUYXsi2T15ccNJ0iyUpQ4xDF7svFu3+bGVrI0CMBUclPciz+lsQR3JX3TQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==}
+
resolution: {integrity: sha512-ArKIEOOWULbhi53wkAiRy1ze4wvrTfhpAj7Yfzva+EkmX2sV8PpFB+xqzJfzXNzK4me95FJH9QZt5NXFVGzOoQ==}
@@ -20210,6 +20219,9 @@ packages:
resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==}
+ resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==}
+
resolution: {integrity: sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw==}
@@ -33855,6 +33867,8 @@ snapshots:
dependencies:
'@types/node': 22.18.8
+ '@types/[email protected]': {}
+
dependencies:
'@types/node': 22.18.8
@@ -42482,6 +42496,8 @@ snapshots:
+