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): add Hermes inject, clone and upload (#124570)

Rafael Audibert4514ad096925
diff --git a/hog/README.md b/hog/README.md
index c4b3f06ae027..32a667beb108 100644
--- a/hog/README.md
+++ b/hog/README.md
@@ -19,7 +19,8 @@ The commands `posthog-cli` keeps under `exp` (`query`, `endpoints`, `logs`, `tas
| `hog query run <query>` | Runs a HogQL query. `-` reads the query from stdin. |
| `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 upload [paths...]` | Uploads symbols for readable stack traces: JavaScript sourcemaps, and ProGuard and R8 mappings. |
+| `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 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. |
@@ -62,6 +63,8 @@ Point `$schema` at the published schema to get validation in your editor:
`hog error-tracking` finds the artifacts in each path and detects their type from the files:
- a `.js`, `.mjs` or `.cjs` file is a JavaScript bundle when its sourcemap exists, through its `sourceMappingURL` comment or a `.map` file next to it
+- 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
Without paths, the commands read `errorTracking.sources` from `posthog.json`, where `ignore` globs skip files.
@@ -72,9 +75,18 @@ JavaScript releases work in two modes, as in posthog-cli:
- `event`, the default, puts the release in the snippet hog adds to each bundle, so every event carries it. Chunk IDs come from the bundle content, so the same build gets the same IDs.
- `symbol-set` puts the release in the sourcemap, and gives a bundle a new random chunk ID when its release changes.
+React Native with Hermes takes three steps, because the Hermes build runs between them:
+
+```bash
+hog error-tracking inject android/app/build/generated/assets # before the Hermes build
+hog error-tracking clone index.android.bundle.map index.android.bundle.hbc.composed.map
+hog error-tracking upload android/app/build/generated/sourcemaps # the composed maps
+```
+
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` and `posthog-cli proguard` are `hog error-tracking`, with paths as arguments instead of `--directory` and `--path`
+- `posthog-cli sourcemap`, `hermes` and `proguard` are `hog error-tracking`, with paths as arguments instead of `--directory` and `--path`
+- `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/src/cli.test.ts b/hog/src/cli.test.ts
index 0231ef16cc18..23d267d91b6d 100644
--- a/hog/src/cli.test.ts
+++ b/hog/src/cli.test.ts
@@ -100,6 +100,7 @@ describe('hog', () => {
'query check',
'query editor',
'error-tracking inject',
+ 'error-tracking clone',
'error-tracking upload',
'error-tracking process',
'config check',
diff --git a/hog/src/cli.ts b/hog/src/cli.ts
index 8d095c7d5a89..6d9bace5f50d 100644
--- a/hog/src/cli.ts
+++ b/hog/src/cli.ts
@@ -269,6 +269,10 @@ const RENAMED: Record<string, { to: string; hint: string }> = {
to: 'error-tracking inject|upload|process',
hint: 'Pass the folders as arguments instead of --directory, as in `hog error-tracking process dist`.',
},
+ hermes: {
+ 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.',
+ },
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/clone.ts b/hog/src/commands/error-tracking/clone.ts
new file mode 100644
index 000000000000..bad1bc8476ad
--- /dev/null
+++ b/hog/src/commands/error-tracking/clone.ts
@@ -0,0 +1,32 @@
+import { defineCommand } from '@/core/command'
+import { cloneMaps } from '@/error-tracking/run'
+
+import { DRY_RUN_OPTION, readOptions, RELEASE_OPTIONS, renderRelease } from './shared'
+
+export default defineCommand({
+ description: 'Copy the chunk ID and release from a Metro map to the map Hermes composed',
+ args: {
+ packagerMap: { description: "Metro's map of the bundle, after `hog error-tracking inject`" },
+ composedMap: { description: 'The map the Hermes compiler composed for the bytecode' },
+ },
+ options: { ...RELEASE_OPTIONS, ...DRY_RUN_OPTION },
+ scopes: ['error_tracking:write'],
+ notes: [
+ 'React Native with Hermes takes three steps: inject the Metro bundle before the Hermes build, clone its chunk ID into the composed map after it, then upload the composed map.',
+ 'In event mode, clone needs no network. In symbol-set mode, it creates the release and stamps both maps with it.',
+ ].join('\n'),
+ examples: [
+ 'hog error-tracking clone index.android.bundle.map index.android.bundle.hbc.composed.map',
+ 'hog et clone main.jsbundle.map main.jsbundle.hbc.composed.map --release-mode symbol-set',
+ ],
+
+ run({ args, options, ctx }) {
+ return cloneMaps(ctx, args.packagerMap, args.composedMap, readOptions(options, ctx.runtime.env))
+ },
+
+ human({ result, out }) {
+ renderRelease(out, result.release)
+ const what = result.chunkId ? `chunk ID ${out.style(result.chunkId, 'bold')}` : 'no chunk ID'
+ out.line(`${result.dryRun ? 'Would copy' : 'Copied'} ${what} to ${result.to}.`)
+ },
+})
diff --git a/hog/src/commands/error-tracking/error-tracking.test.ts b/hog/src/commands/error-tracking/error-tracking.test.ts
index 7fa8b43356ff..0b3866bd2e1b 100644
--- a/hog/src/commands/error-tracking/error-tracking.test.ts
+++ b/hog/src/commands/error-tracking/error-tracking.test.ts
@@ -8,6 +8,7 @@ import { contentHash, SymbolDataType, writeSymbolData } from '@/error-tracking/c
import { runHog } from '@/testing'
import { GIT_REPO, SMALL_MAPPING } from '../../../test/parity/fixtures'
+import { HERMES_BUILD } from '../../../test/parity/hermes-fixtures'
function project(files: Record<string, string>): string {
const folder = mkdtempSync(join(tmpdir(), 'hog-et-'))
@@ -162,6 +163,33 @@ describe('hog error-tracking upload', () => {
expect(readFileSync(join(folder, 'dist/a.js'), 'utf8')).toBe(bundle)
})
+ test('--dry-run plans a Hermes map once when two paths overlap', async () => {
+ const composed = 'android/hbc/index.android.bundle.hbc.composed.map'
+ const folder = project({
+ ...HERMES_BUILD,
+ [composed]: HERMES_BUILD[composed]!.replace('{', '{"chunk_id":"0b9f3c55-6a1e-4f43-9d9a-3a1f2c7e8b10",'),
+ })
+ const result = await runHog(['et', 'upload', '--dry-run', 'android', 'android/hbc'], {
+ env: { CLAUDECODE: '1' },
+ cwd: folder,
+ useDisk: true,
+ })
+ expect(result.exitCode).toBe(0)
+ expect(result.json().symbolSets).toEqual([expect.objectContaining({ path: composed, kind: 'hermes' })])
+ })
+
+ test('upload fails when Hermes bundles have no composed maps', async () => {
+ const { 'android/hbc/index.android.bundle.hbc.composed.map': _composed, ...metroOnly } = HERMES_BUILD
+ const folder = project(metroOnly)
+ const result = await runHog(['et', 'upload', '--dry-run', 'android'], {
+ env: { CLAUDECODE: '1' },
+ cwd: folder,
+ useDisk: true,
+ })
+ expect(result.exitCode).toBe(1)
+ expect(result.error()).toMatchObject({ code: 'no_hermes_maps' })
+ })
+
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/index.ts b/hog/src/commands/error-tracking/index.ts
index 93d5e2823357..010a23e9f118 100644
--- a/hog/src/commands/error-tracking/index.ts
+++ b/hog/src/commands/error-tracking/index.ts
@@ -1,5 +1,6 @@
import { defineGroup } from '@/core/command'
+import clone from './clone'
import inject from './inject'
import process from './process'
import upload from './upload'
@@ -7,5 +8,5 @@ import upload from './upload'
export default defineGroup({
description: 'Upload symbols for readable stack traces in error tracking',
aliases: ['et'],
- commands: { inject, upload, process },
+ commands: { inject, clone, upload, process },
})
diff --git a/hog/src/commands/error-tracking/inject.ts b/hog/src/commands/error-tracking/inject.ts
index 779819ef7df1..a68d78428216 100644
--- a/hog/src/commands/error-tracking/inject.ts
+++ b/hog/src/commands/error-tracking/inject.ts
@@ -1,4 +1,5 @@
import { defineCommand } from '@/core/command'
+import { plural } from '@/core/text'
import { inject, select } from '@/error-tracking/run'
import {
@@ -52,8 +53,8 @@ export default defineCommand({
out.line(
out.style(
result.dryRun
- ? `Dry run: ${changed} of ${result.injected.length} bundles would change. No file was written.`
- : `${changed} of ${result.injected.length} bundles changed.`,
+ ? `Dry run: ${changed} of ${plural(result.injected.length, 'bundle')} would change. No file was written.`
+ : `${changed} of ${plural(result.injected.length, 'bundle')} changed.`,
'dim'
)
)
diff --git a/hog/src/commands/error-tracking/upload.ts b/hog/src/commands/error-tracking/upload.ts
index 14406d44aa99..5eac07f7b06a 100644
--- a/hog/src/commands/error-tracking/upload.ts
+++ b/hog/src/commands/error-tracking/upload.ts
@@ -20,7 +20,7 @@ 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, and ProGuard or R8 mappings (mapping.txt).',
+ 'Supported: JavaScript bundles with sourcemaps, maps the Hermes compiler composed, and ProGuard or R8 mappings (mapping.txt).',
'JavaScript bundles need a chunk ID first: run `hog error-tracking inject`, or use `hog error-tracking process` to do both.',
].join('\n'),
examples: [
diff --git a/hog/src/commands/legacy.ts b/hog/src/commands/legacy.ts
index 999b4b7ea34b..5b8382fbf70a 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',
}),
- hermes: defineLegacy({ description: 'Upload Hermes sourcemaps to PostHog', use: 'posthog-cli hermes' }),
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',
diff --git a/hog/src/error-tracking/discover.ts b/hog/src/error-tracking/discover.ts
index ca78010f25d8..962aff3ddd0e 100644
--- a/hog/src/error-tracking/discover.ts
+++ b/hog/src/error-tracking/discover.ts
@@ -1,9 +1,10 @@
-import { readdirSync, readFileSync, statSync } from 'node:fs'
+import { readdirSync, readFileSync, realpathSync, statSync } from 'node:fs'
import { isAbsolute, join, relative, resolve } from 'node:path'
import type { ArtifactKind } from '@/core/config'
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'
@@ -50,6 +51,16 @@ const DETECTORS: readonly Detector[] = [
extensions: JS_EXTENSIONS,
matches: (path, options) => isJsBundle(path, options.publicPathPrefix),
},
+ {
+ kind: 'hermes',
+ extensions: HERMES_BUNDLE_EXTENSIONS,
+ matches: (path, options) => isJsBundle(path, options.publicPathPrefix, HERMES_BUNDLE_EXTENSIONS),
+ },
+ {
+ kind: 'hermes',
+ extensions: ['.map'],
+ matches: isComposedMap,
+ },
]
function detect(
@@ -63,15 +74,17 @@ function detect(
(kind === undefined || detector.kind === kind) &&
(!fromFolder || detector.extensions.some((extension) => path.endsWith(extension)))
)
- const matched = candidates.filter((detector) => detector.matches(path, options))
+ const matched = [
+ ...new Set(candidates.filter((detector) => detector.matches(path, options)).map((detector) => detector.kind)),
+ ]
if (matched.length > 1) {
throw new HogError(
'ambiguous_artifact',
- `${path} looks like more than one artifact type: ${matched.map((detector) => detector.kind).join(', ')}.`,
+ `${path} looks like more than one artifact type: ${matched.join(', ')}.`,
'Pass --kind to say which one it is.'
)
}
- return matched[0]?.kind
+ return matched[0]
}
function walk(folder: string, out: string[]): void {
@@ -125,6 +138,15 @@ export function listFiles(roots: readonly Root[], cwd: string): string[] {
export function discover(roots: readonly Root[], cwd: string, options: DiscoverOptions = {}): Artifact[] {
const artifacts: Artifact[] = []
+ // Overlapping paths, like `build build/hbc`, reach the same file twice.
+ const seen = new Set<string>()
+ const add = (artifact: Artifact): void => {
+ const canonical = realpathSync(artifact.path)
+ if (!seen.has(canonical)) {
+ seen.add(canonical)
+ artifacts.push(artifact)
+ }
+ }
for (const root of roots) {
const { path, isFile, files } = rootFiles(root, cwd)
if (isFile) {
@@ -138,13 +160,13 @@ export function discover(roots: readonly Root[], cwd: string, options: DiscoverO
root.kind ? undefined : 'Pass --kind to say which one it is.'
)
}
- artifacts.push({ kind, path, display: relative(cwd, path) || path, root })
+ add({ kind, path, display: relative(cwd, path) || path, root })
continue
}
for (const file of files) {
const kind = detect(file, true, root.kind, options)
if (kind) {
- artifacts.push({ kind, path: file, display: relative(cwd, file), root })
+ add({ kind, path: file, display: relative(cwd, file), root })
}
}
}
diff --git a/hog/src/error-tracking/git.ts b/hog/src/error-tracking/git.ts
index 49742585d877..6816d839e006 100644
--- a/hog/src/error-tracking/git.ts
+++ b/hog/src/error-tracking/git.ts
@@ -67,13 +67,18 @@ function fromVercel(env: Env): GitInfo | undefined {
return info
}
-function isDirectory(path: string): boolean {
- return statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false
+// Rust's `Path::is_dir` and `is_file` read any error as false. A walk that starts at a file looks
+// for `<file>/.git`, which fails with ENOTDIR rather than ENOENT.
+function stat(path: string): ReturnType<typeof statSync> | undefined {
+ try {
+ return statSync(path)
+ } catch {
+ return undefined
+ }
}
-function isFile(path: string): boolean {
- return statSync(path, { throwIfNoEntry: false })?.isFile() ?? false
-}
+const isDirectory = (path: string): boolean => stat(path)?.isDirectory() ?? false
+const isFile = (path: string): boolean => stat(path)?.isFile() ?? false
function readText(path: string): string | undefined {
try {
diff --git a/hog/src/error-tracking/kinds/hermes.ts b/hog/src/error-tracking/kinds/hermes.ts
new file mode 100644
index 000000000000..49ee649c971b
--- /dev/null
+++ b/hog/src/error-tracking/kinds/hermes.ts
@@ -0,0 +1,52 @@
+import { readFileSync } from 'node:fs'
+
+import { SymbolDataType, writeSymbolData } from '../container'
+import { decodeUtf8 } from '../json'
+import type { SymbolSetUpload } from '../upload'
+import { isEmptyMapContent, loadMapContent, serializeMapContent, type MapContent } from './js'
+
+// React Native with Hermes: Metro writes `.bundle` or `.jsbundle` files that get chunk IDs like
+// JavaScript bundles. The Hermes compiler then composes a second map for the bytecode, and that
+// composed map is what PostHog symbolicates with.
+
+export const HERMES_BUNDLE_EXTENSIONS = ['.bundle', '.jsbundle'] as const
+
+const FUNCTION_OFFSETS = 'x_hermes_function_offsets'
+
+export function isHermesBundlePath(path: string): boolean {
+ return HERMES_BUNDLE_EXTENSIONS.some((extension) => path.endsWith(extension))
+}
+
+// posthog-cli refuses to upload a map without this key, so it is what tells a composed map apart
+// from Metro's packager map.
+export function isComposedMap(path: string): boolean {
+ try {
+ return loadMapContent(decodeUtf8(readFileSync(path))).fields.has(FUNCTION_OFFSETS)
+ } catch {
+ return false
+ }
+}
+
+export const uploadChunkId = (map: MapContent): string | null => map.chunkId ?? map.debugId
+
+export function cloneMetadata(from: MapContent, to: MapContent): void {
+ to.chunkId = uploadChunkId(from) ?? to.chunkId
+ to.releaseId = from.releaseId
+}
+
+export type HermesMapSkip = 'no_chunk_id' | 'empty'
+
+export function hermesSkipReason(map: MapContent): HermesMapSkip | undefined {
+ if (uploadChunkId(map) === null) {
+ return 'no_chunk_id'
+ }
+ return isEmptyMapContent(map) ? 'empty' : undefined
+}
+
+export function hermesUpload(map: MapContent): SymbolSetUpload {
+ return {
+ chunkId: uploadChunkId(map)!,
+ releaseId: map.releaseId,
+ data: writeSymbolData(SymbolDataType.HermesMap, Buffer.from(serializeMapContent(map), 'utf8')),
+ }
+}
diff --git a/hog/src/error-tracking/kinds/js.ts b/hog/src/error-tracking/kinds/js.ts
index 3273eabeb6be..059be1d9cb4d 100644
--- a/hog/src/error-tracking/kinds/js.ts
+++ b/hog/src/error-tracking/kinds/js.ts
@@ -252,10 +252,14 @@ export function findSourceMap(
return candidates.find((candidate) => existsSync(candidate))
}
-export function isJsBundle(path: string, publicPathPrefix: string | undefined): boolean {
+export function isJsBundle(
+ path: string,
+ publicPathPrefix: string | undefined,
+ extensions: readonly string[] = JS_EXTENSIONS
+): boolean {
const name = basename(path)
// Rust's `Path::extension` gives no extension for a file named `.js`.
- if (name.lastIndexOf('.') === 0 || !JS_EXTENSIONS.some((extension) => name.endsWith(extension))) {
+ if (name.lastIndexOf('.') === 0 || !extensions.some((extension) => name.endsWith(extension))) {
return false
}
try {
diff --git a/hog/src/error-tracking/run.ts b/hog/src/error-tracking/run.ts
index 497db517b5b6..9199a6ecdfcc 100644
--- a/hog/src/error-tracking/run.ts
+++ b/hog/src/error-tracking/run.ts
@@ -1,4 +1,4 @@
-import { realpathSync } from 'node:fs'
+import { readFileSync, realpathSync, writeFileSync } from 'node:fs'
import { dirname, relative, resolve } from 'node:path'
import type { ArtifactKind } from '@/core/config'
@@ -19,7 +19,17 @@ import {
savePairs,
type InjectAction,
} from './js-flow'
-import { readPair, serializeMapContent, type ReleaseMode, type Skip, type SourcePair } from './kinds/js'
+import { decodeUtf8 } from './json'
+import { cloneMetadata, hermesSkipReason, hermesUpload, isHermesBundlePath } from './kinds/hermes'
+import {
+ loadMapContent,
+ readPair,
+ serializeMapContent,
+ type MapContent,
+ type ReleaseMode,
+ type Skip,
+ type SourcePair,
+} from './kinds/js'
import { proguardContainer } from './kinds/proguard'
import { fetchOrCreateRelease, resolveRelease, type Release, type ReleaseFields } from './release'
import { SymbolSetClient, type SymbolSetUpload, type UploadStatus } from './upload'
@@ -129,6 +139,9 @@ export class Session {
}
}
+const isBundle = (artifact: Artifact): boolean =>
+ artifact.kind === 'js' || (artifact.kind === 'hermes' && isHermesBundlePath(artifact.path))
+
function readPairs(
selection: Selection,
options: ErrorTrackingOptions,
@@ -137,7 +150,7 @@ function readPairs(
const seen = new Set<string>()
const pairs: SourcePair[] = []
const owners = new Map<SourcePair, Artifact>()
- for (const artifact of selection.artifacts.filter((candidate) => candidate.kind === 'js')) {
+ for (const artifact of selection.artifacts.filter(isBundle)) {
const pair = readPair(artifact.path, options.publicPathPrefix, skipped)
if (
pair &&
@@ -181,10 +194,13 @@ export async function inject(
if (pairs.length === 0) {
throw new HogError(
'no_bundles',
- 'hog found no JavaScript bundles with sourcemaps to inject in those paths.',
+ 'hog found no JavaScript or Hermes bundles with sourcemaps to inject in those paths.',
'Check the paths, or pass --public-path-prefix if your sourceMappingURL comments are absolute URLs.'
)
}
+ // Hermes bundles never carry a release in event mode: the app's own metadata names it.
+ const hermes = new Set(pairs.filter((pair) => owners.get(pair)?.kind === 'hermes'))
+ const js = pairs.filter((pair) => !hermes.has(pair))
const fields = await releaseFields(ctx, options)
let release = preset
let reported: ReleaseReport | null = release
@@ -192,9 +208,9 @@ export async function inject(
: null
if (!release) {
const needed =
- options.releaseMode === 'event' ||
- releaseRequested(fields) ||
- pairs.some((pair) => pair.map.releaseId === null)
+ options.releaseMode === 'event'
+ ? js.length > 0
+ : releaseRequested(fields) || pairs.some((pair) => pair.map.releaseId === null)
const resolved = needed ? resolveJsRelease(fields, ctx.runtime.env, selection.cwd, warnings) : undefined
if (resolved) {
reported = { name: resolved.name, version: resolved.version, id: null }
@@ -204,17 +220,20 @@ export async function inject(
release = await session.releases.get(resolved.name, resolved.version, resolved.git)
reported.id = release.id
}
- } else if (options.releaseMode === 'event') {
+ } else if (options.releaseMode === 'event' && js.length > 0) {
warnings.push(
'No release could be resolved, so hog injected chunk IDs only and events will carry no release.'
)
}
}
const releaseId = release?.id ?? null
- const outcomes =
- options.releaseMode === 'event'
- ? injectEventMode(pairs, releaseId, warnings)
+ const byPair = new Map(
+ (options.releaseMode === 'event'
+ ? [...injectEventMode(js, releaseId, warnings), ...injectEventMode([...hermes], null, warnings)]
: injectSymbolSetMode(pairs, releaseId, randomChunkId(ctx.runtime.now))
+ ).map((outcome) => [outcome.pair, outcome])
+ )
+ const outcomes = pairs.map((pair) => byPair.get(pair)!)
if (!options.dryRun) {
savePairs(pairs, (pair) => serializeMapContent(pair.map))
}
@@ -315,18 +334,22 @@ export async function upload(
}
}
- const read = injected
- ? { pairs: injected.pairs, artifacts: injected.owners }
- : readPairs(selection, options, skipped)
+ // Metro bundles upload through their composed maps, so upload never reads their own pairs.
+ const jsOnly = { ...selection, artifacts: selection.artifacts.filter((artifact) => artifact.kind === 'js') }
+ const read = injected ? { pairs: injected.pairs, artifacts: injected.owners } : readPairs(jsOnly, options, skipped)
+ read.pairs = read.pairs.filter((pair) => read.artifacts.get(pair)?.kind === 'js')
let targets: { pair: SourcePair; target: CleanupTarget }[] = []
// posthog-cli stops before any cleanup when no bundle has an id to upload under.
let jsUploadable = false
+ const composed = selection.artifacts.filter(
+ (artifact) => artifact.kind === 'hermes' && !isHermesBundlePath(artifact.path)
+ )
+ if (options.releaseMode === 'event' && options.skipOnConflict && (read.pairs.length > 0 || composed.length > 0)) {
+ warnings.push(
+ '--skip-on-conflict is ignored in event mode: every chunk is overwritten, so events never keep an old release.'
+ )
+ }
if (read.pairs.length > 0) {
- if (options.releaseMode === 'event' && options.skipOnConflict) {
- warnings.push(
- '--skip-on-conflict is ignored in event mode: every chunk is overwritten, so events never keep an old release.'
- )
- }
const uploadable = read.pairs.filter((pair) => pair.chunkId() !== null || pair.debugId() !== null)
jsUploadable = uploadable.length > 0
if (!jsUploadable) {
@@ -371,6 +394,72 @@ export async function upload(
}
}
+ if (composed.length > 0) {
+ if (options.releaseMode === 'event' && !(fields.name && fields.version && fields.build)) {
+ warnings.push(
+ 'In event mode, exceptions take their release from the app. Pass --release-name, --release-version and --build matching the app identifier, version and build number, or exceptions will report no release.'
+ )
+ }
+ const maps = composed.map((artifact) => ({
+ artifact,
+ map: loadMapContent(decodeUtf8(readFileSync(artifact.path))),
+ }))
+ // posthog-cli creates the release even in event mode, so PostHog has a row to match the
+ // app metadata of an event to.
+ let releaseId: string | null = null
+ if (releaseRequested(fields) || maps.some(({ map }) => map.releaseId === null)) {
+ const start = resolve(selection.cwd, composed[0]!.root.path)
+ const resolved = resolveJsRelease(fields, ctx.runtime.env, start, warnings)
+ if (resolved) {
+ reported = { name: resolved.name, version: resolved.version, id: null }
+ if (!options.dryRun) {
+ releaseId = (await releases.get(resolved.name, resolved.version, resolved.git)).id
+ reported.id = releaseId
+ }
+ }
+ }
+ const policy =
+ options.releaseMode === 'event'
+ ? { force: true, skipOnConflict: false }
+ : { force: options.force, skipOnConflict: options.skipOnConflict }
+ let uploadable = 0
+ for (const { artifact, map } of maps) {
+ const reason = hermesSkipReason(map)
+ if (reason) {
+ skipped.push({
+ path: artifact.display,
+ reason:
+ reason === 'no_chunk_id'
+ ? 'the map has no chunk ID. Run `hog error-tracking clone` after the Hermes build.'
+ : 'the sourcemap is empty. Check your bundler sourcemap setting.',
+ })
+ continue
+ }
+ map.releaseId = options.releaseMode === 'event' ? null : (releaseId ?? map.releaseId)
+ planned.push({ artifact, upload: hermesUpload(map), policy })
+ uploadable++
+ }
+ if (uploadable === 0) {
+ throw new HogError(
+ 'no_hermes_chunk_ids',
+ 'None of the Hermes maps has a chunk ID, so nothing was uploaded.',
+ 'Run `hog error-tracking inject` on the Metro bundle before the Hermes build, and `hog error-tracking clone` after it.'
+ )
+ }
+ }
+
+ // 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')) {
+ const message = 'hog found Hermes bundles but no composed Hermes sourcemaps'
+ const hint =
+ 'Run `hog error-tracking clone` after the Hermes build, and upload the folder with its composed maps.'
+ if (planned.length === 0) {
+ throw new HogError('no_hermes_maps', `${message}, so nothing was uploaded.`, hint)
+ }
+ warnings.push(`${message}, so their stack traces stay unreadable. ${hint}`)
+ }
+
const report = (item: Planned, status: SymbolSetReport['status']): SymbolSetReport => ({
path: item.artifact.display,
kind: item.artifact.kind,
@@ -459,8 +548,71 @@ export async function processArtifacts(
preset = await session.releases.get(resolved.name, resolved.version, resolved.git)
}
}
- const hasJs = selection.artifacts.some((artifact) => artifact.kind === 'js')
- const injected = hasJs ? await inject(ctx, selection, options, session, preset) : undefined
+ const injected = selection.artifacts.some(isBundle)
+ ? await inject(ctx, selection, options, session, preset)
+ : undefined
const report = await upload(ctx, selection, options, session, injected)
return { ...report, injected: injected?.injected ?? [] }
}
+
+export interface CloneReport {
+ dryRun: boolean
+ release: ReleaseReport | null
+ from: string
+ to: string
+ chunkId: string | null
+ releaseId: string | null
+}
+
+function readMap(cwd: string, path: string, role: string): { path: string; map: MapContent } {
+ const full = resolve(cwd, path)
+ try {
+ return { path: full, map: loadMapContent(decodeUtf8(readFileSync(full))) }
+ } catch (error) {
+ throw new HogError('map_unreadable', `hog couldn't read the ${role} map ${path}: ${(error as Error).message}`)
+ }
+}
+
+export async function cloneMaps(
+ ctx: Context,
+ fromPath: string,
+ toPath: string,
+ options: ErrorTrackingOptions
+): Promise<CloneReport> {
+ const cwd = ctx.runtime.cwd()
+ const from = readMap(cwd, fromPath, 'packager')
+ const to = readMap(cwd, toPath, 'composed')
+ const warnings: string[] = []
+ let reported: ReleaseReport | null = null
+ let releaseId: string | null = null
+ if (options.releaseMode === 'symbol-set') {
+ const fields = await releaseFields(ctx, options)
+ if (releaseRequested(fields) || from.map.releaseId === null) {
+ const resolved = resolveJsRelease(fields, ctx.runtime.env, from.path, warnings)
+ if (resolved) {
+ reported = { name: resolved.name, version: resolved.version, id: null }
+ if (!options.dryRun) {
+ releaseId = (await new Session(ctx).releases.get(resolved.name, resolved.version, resolved.git)).id
+ reported.id = releaseId
+ }
+ }
+ }
+ }
+ const fromChanged = from.map.releaseId !== releaseId
+ from.map.releaseId = releaseId
+ cloneMetadata(from.map, to.map)
+ if (!options.dryRun) {
+ if (fromChanged) {
+ writeFileSync(from.path, serializeMapContent(from.map))
+ }
+ writeFileSync(to.path, serializeMapContent(to.map))
+ }
+ return {
+ dryRun: options.dryRun,
+ release: reported,
+ from: fromPath,
+ to: toPath,
+ chunkId: to.map.chunkId,
+ releaseId: to.map.releaseId,
+ }
+}
diff --git a/hog/test/parity/README.md b/hog/test/parity/README.md
index fd80e65b7098..c2ee810e11b9 100644
--- a/hog/test/parity/README.md
+++ b/hog/test/parity/README.md
@@ -24,6 +24,9 @@ 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.
+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.
+
## What is normalized
`normalize.ts` rewrites only values that are random by design:
diff --git a/hog/test/parity/golden/e2e/hermes-clone-debug-id.json b/hog/test/parity/golden/e2e/hermes-clone-debug-id.json
new file mode 100644
index 000000000000..91a8d75c7e01
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-clone-debug-id.json
@@ -0,0 +1,8 @@
+{
+ "exitCode": 0,
+ "requests": [],
+ "files": {
+ "ios/hbc/main.jsbundle.hbc.composed.map": "utf8:{\"chunk_id\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "ios/main.jsbundle.map": "utf8:{\"version\": 3, \"sources\": [\"src/App.js\", \"node_modules/react-native/Libraries/polyfill.js\"], \"sourcesContent\": [\"function App() {\\n return \\\"h\\u00e9llo\\\";\\n}\\nApp();\\n\", null], \"x_facebook_sources\": [[{\"names\": [\"<global>\", \"App\"], \"mappings\": \"AAA,CCC\"}], null], \"names\": [\"App\"], \"mappings\": \"AACA;AAAA,SAAUA\", \"x_google_ignoreList\": [1], \"debugId\": \"c96bfa94-ca84-4f98-8d5e-f15adba692ca\"}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-clone-symbol-set.json b/hog/test/parity/golden/e2e/hermes-clone-symbol-set.json
new file mode 100644
index 000000000000..c49a329a178f
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-clone-symbol-set.json
@@ -0,0 +1,29 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.example.app\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-clone.json b/hog/test/parity/golden/e2e/hermes-clone.json
new file mode 100644
index 000000000000..3b4825701017
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-clone.json
@@ -0,0 +1,9 @@
+{
+ "exitCode": 0,
+ "requests": [],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-inject-symbol-set.json b/hog/test/parity/golden/e2e/hermes-inject-symbol-set.json
new file mode 100644
index 000000000000..36fe4d38587f
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-inject-symbol-set.json
@@ -0,0 +1,32 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.example.app\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"01a18083-5d59-7422-9e10-c88db2b0a3e7\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=01a18083-5d59-7422-9e10-c88db2b0a3e7",
+ "android/index.android.bundle.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"01a18083-5d59-7422-9e10-c88db2b0a3e7\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}",
+ "ios/main.jsbundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"01a18083-5d59-7422-9e10-c87d3c63afef\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=main.jsbundle.map\n//# debugId=C96BFA94CA844F988D5EF15ADBA692CA\n//# chunkId=01a18083-5d59-7422-9e10-c87d3c63afef",
+ "ios/main.jsbundle.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"01a18083-5d59-7422-9e10-c87d3c63afef\",\"debugId\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"debug_id\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1]}",
+ "short/x.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"01a18083-5d59-7422-9e10-c86c6376d8bd\")}catch(e){}}();a\n\n//# chunkId=01a18083-5d59-7422-9e10-c86c6376d8bd",
+ "short/x.bundle.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"01a18083-5d59-7422-9e10-c86c6376d8bd\",\"mappings\":\"qTAAA\",\"names\":[],\"sources\":[\"s.js\"],\"version\":3}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-inject-twice.json b/hog/test/parity/golden/e2e/hermes-inject-twice.json
new file mode 100644
index 000000000000..4a7b8df330e4
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-inject-twice.json
@@ -0,0 +1,12 @@
+{
+ "exitCode": 0,
+ "requests": [],
+ "files": {
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}",
+ "ios/main.jsbundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"C96BFA94CA844F988D5EF15ADBA692CA\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=main.jsbundle.map\n//# debugId=C96BFA94CA844F988D5EF15ADBA692CA\n//# chunkId=C96BFA94CA844F988D5EF15ADBA692CA",
+ "ios/main.jsbundle.map": "utf8:{\"chunk_id\":\"C96BFA94CA844F988D5EF15ADBA692CA\",\"debugId\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"debug_id\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"mappings\":\"iTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1]}",
+ "short/x.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8\")}catch(e){}}();a\n\n//# chunkId=3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8",
+ "short/x.bundle.map": "utf8:{\"chunk_id\":\"3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8\",\"mappings\":\"qTAAA\",\"names\":[],\"sources\":[\"s.js\"],\"version\":3}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-inject.json b/hog/test/parity/golden/e2e/hermes-inject.json
new file mode 100644
index 000000000000..4a7b8df330e4
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-inject.json
@@ -0,0 +1,12 @@
+{
+ "exitCode": 0,
+ "requests": [],
+ "files": {
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}",
+ "ios/main.jsbundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"C96BFA94CA844F988D5EF15ADBA692CA\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=main.jsbundle.map\n//# debugId=C96BFA94CA844F988D5EF15ADBA692CA\n//# chunkId=C96BFA94CA844F988D5EF15ADBA692CA",
+ "ios/main.jsbundle.map": "utf8:{\"chunk_id\":\"C96BFA94CA844F988D5EF15ADBA692CA\",\"debugId\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"debug_id\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"mappings\":\"iTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1]}",
+ "short/x.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8\")}catch(e){}}();a\n\n//# chunkId=3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8",
+ "short/x.bundle.map": "utf8:{\"chunk_id\":\"3f50dfcf-1184-5b2e-8c72-e2fb6735f7e8\",\"mappings\":\"qTAAA\",\"names\":[],\"sources\":[\"s.js\"],\"version\":3}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-already-present.json b/hog/test/parity/golden/e2e/hermes-upload-already-present.json
new file mode 100644
index 000000000000..bc2b06e12c48
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-already-present.json
@@ -0,0 +1,29 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"force\":true,\"skip_on_conflict\":false}",
+ "status": 200
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-debug-id.json b/hog/test/parity/golden/e2e/hermes-upload-debug-id.json
new file mode 100644
index 000000000000..87eb19aec086
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-debug-id.json
@@ -0,0 +1,70 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.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\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"release_id\":null,\"content_hash\":\"21c78373282cd1f598495f758156b0e85565ca640e136df79e36315e5799702a115bce8b76178e01b09de2e485d2fc6b30b66a547944bebded555e330b13c511\",\"content_length\":386}],\"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\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"release_id\":null,\"content_hash\":\"21c78373282cd1f598495f758156b0e85565ca640e136df79e36315e5799702a115bce8b76178e01b09de2e485d2fc6b30b66a547944bebded555e330b13c511\",\"content_length\":386}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":true,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/5776b505-d2f6-53e5-b7e5-8cb825de47cf?length=386",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "21c78373282cd1f598495f758156b0e85565ca640e136df79e36315e5799702a115bce8b76178e01b09de2e485d2fc6b30b66a547944bebded555e330b13c511",
+ "length": 386
+ },
+ "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\":{\"5776b505-d2f6-53e5-b7e5-8cb825de47cf\":\"21c78373282cd1f598495f758156b0e85565ca640e136df79e36315e5799702a115bce8b76178e01b09de2e485d2fc6b30b66a547944bebded555e330b13c511\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "ios/hbc/main.jsbundle.hbc.composed.map": "utf8:{\"chunk_id\":\"c96bfa94-ca84-4f98-8d5e-f15adba692ca\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "ios/main.jsbundle.map": "utf8:{\"version\": 3, \"sources\": [\"src/App.js\", \"node_modules/react-native/Libraries/polyfill.js\"], \"sourcesContent\": [\"function App() {\\n return \\\"h\\u00e9llo\\\";\\n}\\nApp();\\n\", null], \"x_facebook_sources\": [[{\"names\": [\"<global>\", \"App\"], \"mappings\": \"AAA,CCC\"}], null], \"names\": [\"App\"], \"mappings\": \"AACA;AAAA,SAAUA\", \"x_google_ignoreList\": [1], \"debugId\": \"c96bfa94-ca84-4f98-8d5e-f15adba692ca\"}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-from-git.json b/hog/test/parity/golden/e2e/hermes-upload-from-git.json
new file mode 100644
index 000000000000..4fad90597598
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-from-git.json
@@ -0,0 +1,71 @@
+{
+ "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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":true,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/757532d7-8438-5a33-8492-c49b7106884b?length=385",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4",
+ "length": 385
+ },
+ "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\":{\"757532d7-8438-5a33-8492-c49b7106884b\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-hash-mismatch.json b/hog/test/parity/golden/e2e/hermes-upload-hash-mismatch.json
new file mode 100644
index 000000000000..38f3a8c366c9
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-hash-mismatch.json
@@ -0,0 +1,49 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":true}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-no-chunk-id.json b/hog/test/parity/golden/e2e/hermes-upload-no-chunk-id.json
new file mode 100644
index 000000000000..37a9d53d062a
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-no-chunk-id.json
@@ -0,0 +1,9 @@
+{
+ "exitCode": 1,
+ "requests": [],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"version\":3,\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"names\":[\"App\",\"<global>\"],\"mappings\":\"AAAA,SACA,cAAAC\",\"x_facebook_sources\":[[{\"names\":[\"<global>\",\"App\"],\"mappings\":\"AAA,CCC\"}],null],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_google_ignoreList\":[1],\"release_id\":\"11111111-2222-4333-8444-555555555555\",\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}\n",
+ "android/index.android.bundle": "utf8:var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map",
+ "android/index.android.bundle.map": "utf8:{\n \"version\": 3,\n \"sources\": [\"src/App.js\", \"node_modules/react-native/Libraries/polyfill.js\"],\n \"sourcesContent\": [\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\", null],\n \"x_facebook_sources\": [[{\"names\": [\"<global>\", \"App\"], \"mappings\": \"AAA,CCC\"}], null],\n \"names\": [\"App\"],\n \"mappings\": \"AACA;AAAA,SAAUA\",\n \"x_google_ignoreList\": [1],\n \"x_test\": {\"b\": 1.0, \"a\": \"
/é\\u0001\\u007f\", \"z\": 1e21, \"n\": -0, \"big\": 18446744073709551616}\n}\n"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-post-only.json b/hog/test/parity/golden/e2e/hermes-upload-post-only.json
new file mode 100644
index 000000000000..c8ae520e1c71
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-post-only.json
@@ -0,0 +1,77 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":true,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "POST",
+ "path": "/s3/post",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4",
+ "length": 385,
+ "fields": {
+ "key": "symbolsets/757532d7-8438-5a33-8492-c49b7106884b",
+ "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\":{\"757532d7-8438-5a33-8492-c49b7106884b\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-release-mismatch.json b/hog/test/parity/golden/e2e/hermes-upload-release-mismatch.json
new file mode 100644
index 000000000000..8512d6b31035
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-release-mismatch.json
@@ -0,0 +1,111 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"upload_attempt_id\":\"<attempt-2>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/757532d7-8438-5a33-8492-c49b7106884b?length=423",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3",
+ "length": 423
+ },
+ "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\":{\"757532d7-8438-5a33-8492-c49b7106884b\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\"},\"upload_attempt_id\":\"<attempt-2>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload-symbol-set.json b/hog/test/parity/golden/e2e/hermes-upload-symbol-set.json
new file mode 100644
index 000000000000..ae66642acf65
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload-symbol-set.json
@@ -0,0 +1,61 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"content_hash\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\",\"content_length\":423}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":false,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/757532d7-8438-5a33-8492-c49b7106884b?length=423",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3",
+ "length": 423
+ },
+ "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\":{\"757532d7-8438-5a33-8492-c49b7106884b\":\"792263d30f2912cb8623ccdec292a6f68cba8c61394f322bae7929223c095829c56232ad02943c5c5a98175d5dd0e81feaa9f370a91f10f7d55035e3a0d6dde3\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"release_id\":\"3fd4c79f-4dd7-53b7-b5f3-e51dce5a9e80\",\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/golden/e2e/hermes-upload.json b/hog/test/parity/golden/e2e/hermes-upload.json
new file mode 100644
index 000000000000..6c1013ce834f
--- /dev/null
+++ b/hog/test/parity/golden/e2e/hermes-upload.json
@@ -0,0 +1,71 @@
+{
+ "exitCode": 0,
+ "requests": [
+ {
+ "method": "GET",
+ "path": "/api/projects/1/error_tracking/releases/hash/e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427",
+ "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\":\"e7495f569c486a19ec6e4a01b9f02703c99282233a5fe12485f654edbd03d65ac91a7ea8b5ec69ce9bafe158a9e3d459edd5b438509dad3e50447b21ec4c1427\",\"version\":\"1.4.0+42\",\"project\":\"com.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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"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\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"release_id\":null,\"content_hash\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\",\"content_length\":385}],\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\",\"force\":true,\"skip_on_conflict\":false}",
+ "status": 201
+ },
+ {
+ "method": "PUT",
+ "path": "/s3/put/symbolsets/757532d7-8438-5a33-8492-c49b7106884b?length=385",
+ "headers": {
+ "authorization": "<none>"
+ },
+ "upload": {
+ "sha512": "320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4",
+ "length": 385
+ },
+ "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\":{\"757532d7-8438-5a33-8492-c49b7106884b\":\"320a5642a5679518ebdd2c73c560f1893a2bfc93025a266fa57d608800e4be9023860a5aa9aee8d92597c65bfc52979f509dfe051536b216c50dc5cf945623e4\"},\"upload_attempt_id\":\"<attempt-1>\",\"upload_run_id\":\"<run>\"}",
+ "status": 201
+ }
+ ],
+ "files": {
+ "android/hbc/index.android.bundle.hbc.composed.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"AAAA,SACA,cAAAC\",\"names\":[\"App\",\"<global>\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_hermes_function_offsets\":{\"0\":[0,28],\"1\":[0]},\"x_unicode\":\"😀 </script> \\\"q\\\" \\\\ \\t\"}",
+ "android/index.android.bundle": "utf8:!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\")}catch(e){}}();var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return \"héllo\"}App();\n//# sourceMappingURL=index.android.bundle.map\n//# chunkId=26ad4cc5-09ee-599e-8a76-35ae37bf8c39",
+ "android/index.android.bundle.map": "utf8:{\"chunk_id\":\"26ad4cc5-09ee-599e-8a76-35ae37bf8c39\",\"mappings\":\"qTACA;AAAA,SAAUA\",\"names\":[\"App\"],\"sources\":[\"src/App.js\",\"node_modules/react-native/Libraries/polyfill.js\"],\"sourcesContent\":[\"function App() {\\n return \\\"héllo\\\";\\n}\\nApp();\\n\",null],\"version\":3,\"x_facebook_sources\":[[{\"mappings\":\"AAA,CCC\",\"names\":[\"<global>\",\"App\"]}],null],\"x_google_ignoreList\":[1],\"x_test\":{\"a\":\"
/é\\u0001\",\"b\":1.0,\"big\":1.8446744073709552e19,\"n\":-0.0,\"z\":1e21}}"
+ }
+}
diff --git a/hog/test/parity/hermes-fixtures.ts b/hog/test/parity/hermes-fixtures.ts
new file mode 100644
index 000000000000..15f56dfe5648
--- /dev/null
+++ b/hog/test/parity/hermes-fixtures.ts
@@ -0,0 +1,35 @@
+// Hand-written React Native files. The packager map has odd numbers and escapes to check key order
+// and number output, and the composed map has a stale release that event-mode `clone` must clear.
+
+const PACKAGER_MAP =
+ '{\n "version": 3,\n "sources": ["src/App.js", "node_modules/react-native/Libraries/polyfill.js"],\n "sourcesContent": ["function App() {\\n return \\"h\u00e9llo\\";\\n}\\nApp();\\n", null],\n "x_facebook_sources": [[{"names": ["<global>", "App"], "mappings": "AAA,CCC"}], null],\n "names": ["App"],\n "mappings": "AACA;AAAA,SAAUA",\n "x_google_ignoreList": [1],\n "x_test": {"b": 1.0, "a": "\u2028/\u00e9\\u0001\\u007f", "z": 1e21, "n": -0, "big": 18446744073709551616}\n}\n'
+
+const BUNDLE =
+ 'var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return "h\u00e9llo"}App();\n//# sourceMappingURL=index.android.bundle.map'
+
+export const COMPOSED_MAP =
+ '{"version":3,"sources":["src/App.js","node_modules/react-native/Libraries/polyfill.js"],"sourcesContent":["function App() {\\n return \\"h\u00e9llo\\";\\n}\\nApp();\\n",null],"names":["App","<global>"],"mappings":"AAAA,SACA,cAAAC","x_facebook_sources":[[{"names":["<global>","App"],"mappings":"AAA,CCC"}],null],"x_hermes_function_offsets":{"0":[0,28],"1":[0]},"x_google_ignoreList":[1],"release_id":"11111111-2222-4333-8444-555555555555","x_unicode":"\ud83d\ude00 </script> \\"q\\" \\\\ \\t"}\n'
+
+export const HERMES_BUNDLES: Record<string, string> = {
+ 'android/index.android.bundle': BUNDLE,
+ 'android/index.android.bundle.map': PACKAGER_MAP,
+ 'ios/main.jsbundle':
+ 'var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now();\nfunction App(){return "h\u00e9llo"}App();\n//# sourceMappingURL=main.jsbundle.map\n//# debugId=C96BFA94CA844F988D5EF15ADBA692CA',
+ 'ios/main.jsbundle.map':
+ '{"version": 3, "sources": ["src/App.js", "node_modules/react-native/Libraries/polyfill.js"], "sourcesContent": ["function App() {\\n return \\"h\\u00e9llo\\";\\n}\\nApp();\\n", null], "x_facebook_sources": [[{"names": ["<global>", "App"], "mappings": "AAA,CCC"}], null], "names": ["App"], "mappings": "AACA;AAAA,SAAUA", "x_google_ignoreList": [1], "debugId": "c96bfa94-ca84-4f98-8d5e-f15adba692ca"}',
+ 'short/x.bundle': 'a\n',
+ 'short/x.bundle.map': '{"version":3,"sources":["s.js"],"names":[],"mappings":"AAAA;AACA;AACA"}',
+}
+
+export const HERMES_BUILD: Record<string, string> = {
+ 'android/index.android.bundle': BUNDLE,
+ 'android/index.android.bundle.map': PACKAGER_MAP,
+ 'android/hbc/index.android.bundle.hbc.composed.map': COMPOSED_MAP,
+}
+
+// Expo stamps a debugId on the packager map instead of running inject.
+export const EXPO_BUILD: Record<string, string> = {
+ 'ios/main.jsbundle.map':
+ '{"version": 3, "sources": ["src/App.js", "node_modules/react-native/Libraries/polyfill.js"], "sourcesContent": ["function App() {\\n return \\"h\\u00e9llo\\";\\n}\\nApp();\\n", null], "x_facebook_sources": [[{"names": ["<global>", "App"], "mappings": "AAA,CCC"}], null], "names": ["App"], "mappings": "AACA;AAAA,SAAUA", "x_google_ignoreList": [1], "debugId": "c96bfa94-ca84-4f98-8d5e-f15adba692ca"}',
+ 'ios/hbc/main.jsbundle.hbc.composed.map': COMPOSED_MAP,
+}
diff --git a/hog/test/parity/scenarios.ts b/hog/test/parity/scenarios.ts
index c736ffac0eb1..07176937879c 100644
--- a/hog/test/parity/scenarios.ts
+++ b/hog/test/parity/scenarios.ts
@@ -3,6 +3,7 @@ import { join } from 'node:path'
import type { Scenario } from './fake-server'
import { GIT_REPO, mappingOfSize, 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'
@@ -148,3 +149,96 @@ SCENARIOS.push(
server: 'hash-mismatch',
})
)
+
+// posthog-cli's `hermes inject|clone|upload` and the hog commands that replace them.
+const hermesArgs = {
+ inject: (path: string, args: string[] = []) => ({
+ rust: ['hermes', 'inject', '-d', path, ...args],
+ hog: ['error-tracking', 'inject', path, ...args],
+ }),
+ clone: (from: string, to: string, args: string[] = []) => ({
+ rust: ['hermes', 'clone', '-m', from, '-c', to, ...args],
+ hog: ['error-tracking', 'clone', from, to, ...args],
+ }),
+ upload: (path: string, args: string[] = []) => ({
+ rust: ['hermes', 'upload', '-d', path, ...args],
+ hog: ['error-tracking', 'upload', path, ...args],
+ }),
+}
+
+const hermes = (
+ name: string,
+ step: { rust: string[]; hog: string[] },
+ files: () => Files,
+ options: Partial<ParityScenario> = {}
+): ParityScenario => ({ name: `hermes-${name}`, server: 'fresh', files, ...step, snapshot: true, ...options })
+
+const ANDROID_MAP = 'android/index.android.bundle.map'
+const ANDROID_COMPOSED = 'android/hbc/index.android.bundle.hbc.composed.map'
+const appRelease = ['--release-name', 'com.example.app', '--release-version', '1.4.0', '--build', '42']
+
+SCENARIOS.push(
+ hermes('inject', hermesArgs.inject('.'), () => HERMES_BUNDLES),
+ hermes('inject-twice', hermesArgs.inject('.'), () => HERMES_BUNDLES, { runs: 2 }),
+ hermes('inject-symbol-set', hermesArgs.inject('.', [...appRelease, ...symbolSet]), () => HERMES_BUNDLES, {
+ randomIds: true,
+ }),
+ hermes('clone', hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED), () => HERMES_BUILD, {
+ before: [hermesArgs.inject('android')],
+ }),
+ hermes(
+ 'clone-symbol-set',
+ hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED, [...appRelease, ...symbolSet]),
+ () => HERMES_BUILD,
+ {
+ before: [hermesArgs.inject('android')],
+ }
+ ),
+ hermes(
+ 'clone-debug-id',
+ hermesArgs.clone('ios/main.jsbundle.map', 'ios/hbc/main.jsbundle.hbc.composed.map'),
+ () => EXPO_BUILD
+ ),
+ hermes('upload', hermesArgs.upload('android/hbc', appRelease), () => HERMES_BUILD, {
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ }),
+ hermes('upload-from-git', hermesArgs.upload('android/hbc'), () => ({ ...GIT_REPO, ...HERMES_BUILD }), {
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ }),
+ hermes('upload-symbol-set', hermesArgs.upload('android/hbc', [...appRelease, ...symbolSet]), () => HERMES_BUILD, {
+ before: [
+ hermesArgs.inject('android'),
+ hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED, [...appRelease, ...symbolSet]),
+ ],
+ }),
+ hermes('upload-already-present', hermesArgs.upload('android/hbc', appRelease), () => HERMES_BUILD, {
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ runs: 2,
+ }),
+ hermes(
+ 'upload-hash-mismatch',
+ hermesArgs.upload('android/hbc', [...appRelease, ...symbolSet, '--skip-on-conflict']),
+ () => HERMES_BUILD,
+ {
+ server: 'hash-mismatch',
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ }
+ ),
+ hermes(
+ 'upload-release-mismatch',
+ hermesArgs.upload('android/hbc', [...appRelease, ...symbolSet]),
+ () => HERMES_BUILD,
+ {
+ server: 'release-mismatch',
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ }
+ ),
+ hermes('upload-post-only', hermesArgs.upload('android/hbc', appRelease), () => HERMES_BUILD, {
+ server: 'post-only',
+ before: [hermesArgs.inject('android'), hermesArgs.clone(ANDROID_MAP, ANDROID_COMPOSED)],
+ }),
+ hermes('upload-debug-id', hermesArgs.upload('ios/hbc', appRelease), () => EXPO_BUILD, {
+ before: [hermesArgs.clone('ios/main.jsbundle.map', 'ios/hbc/main.jsbundle.hbc.composed.map')],
+ }),
+ hermes('upload-no-chunk-id', hermesArgs.upload('android/hbc'), () => HERMES_BUILD)
+)