Public: anyone can read this; the crew can change it.

Errors: suspect pull — name the commit that likely caused an error group #17134

opened this

Merged 39h 24m ago, live in production

An error group now names a suspect commit, and the pull that carried it when there is one. The new test passes and tsc is clean, but I did not run the dead-code test (no test/dead-code.test.ts) or the whole suite.

Notes

opened this

An error group now names a suspect commit, and the pull that carried it when there is one. The new test passes and tsc is clean, but I did not run the dead-code test (no test/dead-code.test.ts) or the whole suite. I did run tests/error-groups, tui-errors, displays and openapi-errors, and scripts/gate.ts --fix and design-lint come back clean. I pushed without running the "every export under src/ has a caller" check, so the forge's check will be the first to run it.

What changed

  • Suspect lookup: src/core/error_suspect.ts (new) reads the group's first release as a commit id. It returns the newest commit at or before that release which changed the file the error was thrown in, matched by file name. If none did, it falls back to the release's own commit. It also names the merged pull whose merge or head commit is that one.
  • When there is no suspect: a release that is not a commit in the repository gives null; nothing is guessed.
  • API: GET …/app/errors/:group now answers suspect alongside group and events. errorGroup is async because of the git read, and the route handler is updated to match.
  • Terminal: : → Errors → pick a group shows a suspect: line on the Resolve screen.
  • Docs: docs/features/errors.md has a Suspect section, and #16972 is removed from the follow-ups list.
  • Test: test/error-groups.test.ts builds real commits. It asserts the suspect's oid, subject, reason and pull, that a non-commit release gives null, and that a non-admin is refused.

Reuse: resolveOid and commitLog from src/git/, commitToBranch from the repo actions, and the mergedPull test helper.

Left out

  • Web card: the Errors card on the app's page is a list with no per-group view, so I did not add a suspect there. The commit says No door: for that reason.
  • Filename match: matching is by file name only, so two files with the same name are not told apart.
  • Dependencies: none added.

Try it: GET /api/v1/repos/<owner>/<name>/app/errors/<group> on the preview for a group whose release is a commit id. In the terminal, use : → Errors → pick a group.

Closes #16972

2 earlier comments
commented

An error group now names a suspect commit, and the pull that carried it when there is one. The new test passes and tsc is clean, but I did not run the dead-code test (no test/dead-code.test.ts) or the whole suite. I did run tests/error-groups, tui-errors, displays and openapi-errors, and scripts/gate.ts --fix and design-lint come back clean. I pushed without running the "every export under src/ has a caller" check, so the forge's check will be the first to run it.

What changed

  • Suspect lookup: src/core/error_suspect.ts (new) reads the group's first release as a commit id. It returns the newest commit at or before that release which changed the file the error was thrown in, matched by file name. If none did, it falls back to the release's own commit. It also names the merged pull whose merge or head commit is that one.
  • When there is no suspect: a release that is not a commit in the repository gives null; nothing is guessed.
  • API: GET …/app/errors/:group now answers suspect alongside group and events. errorGroup is async because of the git read, and the route handler is updated to match.
  • Terminal: : → Errors → pick a group shows a suspect: line on the Resolve screen.
  • Docs: docs/features/errors.md has a Suspect section, and #16972 is removed from the follow-ups list.
  • Test: test/error-groups.test.ts builds real commits. It asserts the suspect's oid, subject, reason and pull, that a non-commit release gives null, and that a non-admin is refused.

Reuse: resolveOid and commitLog from src/git/, commitToBranch from the repo actions, and the mergedPull test helper.

Left out

  • Web card: the Errors card on the app's page is a list with no per-group view, so I did not add a suspect there. The commit says No door: for that reason.
  • Filename match: matching is by file name only, so two files with the same name are not told apart.
  • Dependencies: none added.

Try it: GET /api/v1/repos/<owner>/<name>/app/errors/<group> on the preview for a group whose release is a commit id. In the terminal, use : → Errors → pick a group.

commented

Pushed, with all six review points addressed. One gap: nothing exercises the terminal's new throw path.

  • Merged pulls only. The pull lookup now matches merged_oid and no longer matches head_oid, so an open pull is no longer named as the one that carried a commit. A new test makes an open pull whose head is the commit and expects no pull.
  • Frames from the first release. errorGroup takes the frames from the event whose release is the group's first release. Before, it took the newest event. If no event matches, there are no frames and so no file match. The double cast is gone, and a test covers a later sighting in a different file.
  • Bounded git read. commitLog already had git's 30 s default timeout, which is too long for a group view. I added an optional timeoutMs to LogOptions, and the suspect's two log reads use 3 s. A timeout shows up as no suspect.
  • Terminal failure. onPick in src/tui/screens/errors.ts turns a thrown errorGroup into suspect: none. The body array is tidied. I have no test that forces the throw. resolveOid returns undefined rather than throwing, so a test would have needed a mock.
  • New tests.
    • The "release itself" fallback, for a commit that changed no matching file.
    • The terminal's Resolve screen shows both suspect: none and suspect: <oid8> break pay. The dialog truncates the line, so the test checks only that prefix.
    • The old long test is split into short ones in test/error-suspect.test.ts. They share one suspectFor helper and don't build envelopes by hand.

tsc is clean, and error-suspect, tui-errors and error-groups pass. I didn't run the full suite.

The gate notes that my test's commit helper looks like land in test/boundary-fork-objects.test.ts. I left it; I haven't compared the two to see whether one could replace the other.

The commit carries No door:: the web card lists groups only and has no per-group view, and the API and terminal both already show the suspect.

commented

I merged main into the branch and pushed it. The only conflict was in docs/features/errors.md.

Conflict. The "What is not here" paragraph disagreed in both directions. My side said there was no OpenTelemetry intake, and main's side said there was no suspect pull. Both features now exist, so I removed both claims. Only #16974 (automatic resolve) remains as a follow-up.

Commits. The merge commit is followed by a small one that rewraps comments in src/core/error_suspect.ts, as the gate's --fix asked.

Tests.

  • bun x tsc --noEmit printed nothing, so I took it as clean.
  • I ran the five error test files: error-suspect, error-groups, api-errors, otlp-errors and tui-errors. All 46 tests pass.
  • scripts/fast.ts named 3865 of 4652 test files, so I didn't run that set. The forge's check will run the full suite on the push.

Gate. It reported that commit in test/error-suspect.test.ts looks 0.82 similar to land in test/boundary-fork-objects.test.ts. I left that alone, since my own branch hadn't touched either helper.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs