Skip to content

autter lineage: from a runtime issue to its release, commit, PR, owner and AI authorship (3.10.0) - #105

Merged
sagnik11 merged 2 commits into
mainfrom
feat/lineage-command
Nov 15, 2026
Merged

sagnik11 merged 2 commits into
mainfrom
feat/lineage-command

Conversation

@sagnik11

@sagnik11 sagnik11 commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What users saw

Users asked for a CLI way to go from a production error to the code behind it: the release it shipped in, the commit, the PR, who owns it, and whether an AI agent wrote the failing code. The CLI could explain one line (autter blame --why <file>:<line>) and answer free-form questions (autter ask), but nothing walked a Runtime issue back to its release, commit, PR, owner and authorship. That meant opening the issue page.

What changes

autter lineage <issue-id> (new src/commands/lineage.rs) calls the lineage route the backend now serves (GET /api/cli/orgs/:slug/runtime/issues/:issueId/lineage[?repo=<name>], Autter-dev/autter-monorepo#747). It signs in and picks the organization exactly as autter ask does (ask::org_api_context, the same ApiContext, base URL and --org). It prints the chain from top to bottom:

  • the issue: title, service, environment, status, first seen
  • the release it first appeared in, the commit that release runs, and the release before it. If the commit is not known, it says so and says that code was read at the default branch.
  • the suspect PR
  • the owner: the assigned owner, or the suggested owners if none is assigned
  • the suspect commits. Commits an AI agent wrote with no human author are marked "written by Claude, no human author".
  • who wrote each failing frame: "Claude (model X) in commit abc1234, edited by a person since", a person's name, or "Not known: no authorship notes". Missing notes are never shown as a person. Each frame also shows the AI share of its function, and "Line numbers are approximate." when lineCoordinates is best_effort.
  • why the error was grouped into this issue
  • the response's notes

When a frame has a sessionId and transcriptAvailable, the command prints autter show-prompt <sessionId> for you to run. It never fetches or prints prompt text.

Other behaviour:

  • --json prints the response for scripts.

  • --repo <name> sends the optional repo parameter. Without the flag the parameter is left out. The CLI has no convention for inferring a Runtime repository from the git remote: ask and logs also send --repo only when it is given.

  • Null parts: a part that is null prints one line saying it could not be read, followed by the matching note. The command still exits 0. Each note is printed once: notes no part used are listed at the end.

  • Errors:

    • 401: not signed in or the wrong organization, with the autter login / --org guidance that ask uses
    • 404 Issue not found: "Issue not found in this org (or repository)."
    • 400 Unknown repository: <name>: names the repository
    • anything else: ask's generic HTTP <code>: <error>
    • network failure: the API client's own message

    Errors exit 1 and usage errors exit 2, as in ask.

  • Emails: no email address is printed. The server already hides them, and the command reads no git config. Fields about people (names, owner reasons, owner notes) also have any email address replaced with "(email hidden)".

  • Issue URLs: no existing command has a helper that pulls an issue id out of an Autter URL, so lineage takes ids only. It rejects a URL with a message saying to pass the ri_… id.

autter lineage <file>:<line> goes through handle_ai_blame(["--why", "<file>:<line>", …]), the same code path as autter blame --why, so nothing is duplicated. In this form it uses the background service as blame does. The issue-id form, like ask, does not.

Help:

  • lineage has a top-level entry and its own --help.
  • autter ask --help gains one sentence saying it answers "why did this happen" and "what is the impact" questions from Runtime evidence. No explain or impact commands were added.

Docs:

  • README "System investigations" and "From a line to the prompt that wrote it"
  • docs/system-investigations.md: a new section with sample output
  • CHANGELOG.md

Release: the last commit bumps the version to 3.10.0 in Cargo.toml and Cargo.lock and moves the changelog entry under ## [3.10.0] - 2026-11-15, as earlier release commits did. Merging this PR publishes autter 3.10.0 (tag-release.yml).

Tests

  • Unit tests (src/commands/lineage.rs):
    • telling an issue id apart from a URL or a file:line, and forwarding to blame
    • option parsing
    • the repo query parameter
    • the full rendering of a complete response, matched exactly
    • an AI-only suspect
    • "Not known" authorship, never shown as a person
    • best-effort line numbers
    • the show-prompt hint
    • null parts and how their notes are matched
    • an issue with no repository
    • an unknown commit
    • assigned and suggested owners
    • email scrubbing
    • control characters
    • error mapping for 401, 404 issue, 404 org, 400, 500, a non-JSON body and a non-JSON 200
  • mockito tests: the request carries the CLI bearer token and ?repo=, and the value printed by --json equals the server's JSON. 401, 404 and 400 go through the real HTTP path.
  • Integration (tests/integration/blame_why.rs):
    • autter lineage f.txt:N prints exactly what autter blame --why f.txt:N prints
    • the issue-id form asks you to sign in
    • URL, unknown option and missing target are usage errors
  • help_flag_safety covers lineage --help and lineage <file>:<line> --help.

Notes

  • JSON key order: --json pretty-prints the parsed response, as ask --json does. Every value and field is unchanged, but serde_json without preserve_order sorts object keys alphabetically.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

sagnik11 and others added 2 commits November 15, 2026 13:11
…r and AI authorship

`autter lineage <issue-id>` reads GET /api/cli/orgs/:slug/runtime/issues/:id/lineage
(optional ?repo=) with the sign-in and org choice of `autter ask`, and prints the
chain top to bottom: the issue; the release it first appeared in, its commit and
the release before it (or that the commit is not known); the suspect PR; the
owner (assigned, else suggested); suspect commits, marking AI-only ones "written
by Claude, no human author"; who wrote each failing frame (agent and model, a
person, or "Not known: no authorship notes"), with the function's AI share and
"Line numbers are approximate" for best-effort lines; and why the error was
grouped into the issue. It prints `autter show-prompt <session>` when a
transcript is stored and never prints prompt text. --json prints the response.

A null part prints one line with its matching note and the command exits 0.
401, 404 (issue), 400 (unknown repository) map to plain guidance; other errors
use ask's generic message. No email address is printed.

`autter lineage <file>:<line>` is dispatched to `autter blame --why` (same code
path). Help entry for lineage; `autter ask --help` says it answers "why did this
happen" and "what is the impact" questions from Runtime evidence. README,
docs/system-investigations.md and CHANGELOG updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…release, commit, PR, owner and AI authorship

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sagnik11
sagnik11 merged commit d971f91 into main Nov 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant