beads/cmd/bd/if_revision_test.go
Alex fefcdf6533
fix(delete): resolve ids exactly, never by prefix abbreviation (#7375)
* test(delete): pin that a stale id never deletes the issue it prefixes (be-ksd)

bd delete resolves each id through the abbreviation-tolerant resolver
(resolveAndGetIssueForMutation -> utils.ResolvePartialID). When the exact
id is absent, that resolver falls through to leading-prefix abbreviation,
so an id that was already deleted resolves to a different issue whose id
it happens to begin, and --force deletes that issue.

The shape is ordinary: hash length is adaptive (3 to 8 characters) so a
grown store holds short ids beside longer ones, --id makes any shape, and
a hierarchical child's id always extends its parent's. On a fixture, after
fx-t00003 was deleted, bd delete fx-t00003 resolved to fx-t000031; a
re-run of a finished --from-file list with --force --quiet deleted two
issues it never named, silently.

The test drives deleteCmd in-process against a stub DoltStorage (no cgo,
no Dolt server) and records every request handed to the Deleter role. It
covers the single-id --force path, the preview, a deleted parent's id with
an orphaned child, the --from-file batch path, and an abbreviation of one
and of two live issues; each refusal must say delete needs the full id
and name the ids the input matches. An over-refusal guard checks that
exact ids (full, bare hash, child, batch) still delete exactly what they
name. The six refusal cases fail at this commit; the guard passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman

* fix(delete): resolve ids exactly, never by prefix abbreviation (be-ksd)

bd delete's direct route resolved each id with the abbreviation-tolerant
resolver, so an id that no longer exists resolved to the surviving issue
whose id it begins, and --force deleted that issue. Both of its resolution
sites now use resolveAndGetIssueForMutationExact (#5393's exact sibling,
until now used only by bd comment): the inline single-id path and
deleteBatch, which --from-file, multiple ids and --cascade take.

The resolver cannot tell a stale full id from an abbreviation. Hash length
is adaptive with store size, so one store holds 3- to 8-character ids side
by side and "fx-t00003" is both a valid full id and a valid abbreviation
of "fx-t000031". The rule therefore has to be per command, the way #5393
made it for bd comment. Delete is exact on both preview and --force: the
preview prints the next command to run ("To proceed, run: bd delete
fx-t000031 --force"), so a tolerant preview hands the caller the wrong
deletion to confirm.

This matches the team-server route, which passes ids to issueops.Deleter
unresolved, and DeleteRequest.IDs' own contract ("IDs ARE EXACT"). The
partial-ID notice (#6302) did not protect this path: --quiet silences it,
and a --force --quiet re-run of a finished --from-file list deleted two
issues it never named.

The refusal says what to do: "bd delete needs the full issue id: no issue
has the id "t000", which is the start of fx-t000031". To name the matches,
ResolvePartialIDExact now returns *utils.AbbreviatedIDError, which carries
the input and the sorted matches, wraps ErrAbbreviatedIDNotAllowed and
keeps the old error text, so bd comment's errors.Is checks and messages
are unchanged.

Cost: bd delete <abbreviation> is refused, naming the full ids, so the
caller retypes one. Exact ids, bare full hashes, child, cross-prefix and
routed ids resolve as before. The other deleteBatch callers (cleanup, wisp
gc, mol burn) pass full ids read from the store, so nothing changes for
them except under a race, where they now refuse instead of reaching a
neighbor. Reads and other writes keep abbreviation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman

* docs(ids): say bd delete requires the full id, like bd comment (be-ksd)

The Working with IDs section named bd comment as the one command that
refuses abbreviations and said every other mutation keeps them. bd delete
now requires the exact id too, so the section covers both, says why a
delete reaches the wrong issue so easily (an already-deleted id is still
the start of its child's id, or of a longer hash), and adds the bd delete
lines to the example block. Best Practices #1 names both commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman

* docs(changelog): link the bd delete exact-id entry to #7375 (be-ksd)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5-5 on behalf of A3Ackerman

* fix(delete): report a gone parent's id as a lost race under --if-revision (be-ksd)

Review-loop iteration 1 for #7375: a maintainer fixup on top of the
contributor's branch.

Major (codex+claude): a guarded `bd delete --if-revision` whose target
was deleted, and whose id is still the start of a surviving id (a gone
parent with a live <parent>.1 child), exited 1 with the abbreviation
refusal. Any other gone target gets the documented lost race
(precondition_failed, exit 13), and gascity's conditional deletes
switch on that code, so a benign race read as a hard failure.

- reportIfRevisionTargetGone (the single-id path) also takes
  utils.ErrAbbreviatedIDNotAllowed as a gone target: under delete's
  exact resolution that id names no row either.
- The refusal is a typed error, deleteAbbreviationError, that unwraps
  to storage.ErrNotFound beside the *utils.AbbreviatedIDError, so the
  --cascade caller of deleteBatch classifies it through
  reportIfRevisionFailure the same way. errors.New(msg) dropped every
  sentinel.

Minor (claude), taken: the refusal leads with the not-found fact,
`issue "t000" not found: bd delete needs the full issue id, and "t000"
is only the start of fx-t000031`, so gascity's isBdNotFound reads an
already-gone full id that begins a survivor's id as the idempotent
not-found it reads for any other gone id. The CHANGELOG entry quotes
the new text and the --if-revision outcome.

Minor (gemini), declined: threading the source command into the
refusal's wording. deleteBatch's other callers (bd cleanup, wisp gc,
mol burn) pass store-minted full ids that no user retypes, and the text
now leads with "issue X not found", which holds for every caller.

Tests:
- TestDeleteIfRevisionGoneIDThatPrefixesAnotherIssue: single id,
  --json, --cascade and --cascade --json each exit 13 with "precondition
  failed: issue no longer exists" and the precondition_failed body,
  never the refusal text, and the guarded write never runs. Two
  no-survivor rows are the plain gone id they must match.
- TestReportIfRevisionTargetGone: abbreviation rows, guarded and not.
- TestDeleteRefusesStaleIDThatPrefixesAnotherIssue also asserts the
  refusal says "not found".
- TestEmbeddedIfRevisionDeletePreflightGoneParentIsPreconditionFailed,
  end to end on embedded Dolt: delete a parent, its child survives and
  `bd show <parent>` resolves to it; a guarded delete of the parent
  exits 13 on the single-id and --cascade paths and leaves the child.
  The TestEmbedded name is what puts it in a CI lane; its line in
  embedded-cmd-test-shards.txt is the generator's incremental --write.

Mutation checks, each reverted afterwards: dropping the
ErrAbbreviatedIDNotAllowed match fails the single-id cases and the
abbreviation_guarded row; dropping ErrNotFound from Unwrap fails the
--cascade cases; dropping "not found" from the text fails every
refusal case; reverting both fixes fails both embedded legs (exit 1,
the refusal text, no "precondition failed").

Validation: the focused delete and if-revision tests; the embedded pair
under BEADS_TEST_EMBEDDED_DOLT=1; the scripts shard-manifest policy
tests and the generator's --check; gofmt; git diff --check. The full
./cmd/bd and ./internal/utils packages (-short, BEADS_TEST_SKIP=dolt)
pass but for TestRunApplyAllOK, which fails only because this worktree
sets core.hooksPath=/dev/null ("mkdir /dev/null: not a directory") and
passes with core.hooksPath overridden.

Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
2026-10-16 11:25:54 +00:00

349 lines
15 KiB
Go

package main
import (
"encoding/json"
"errors"
"fmt"
"os"
"strings"
"testing"
"github.com/steveyegge/beads/internal/storage"
"github.com/steveyegge/beads/internal/utils"
"github.com/steveyegge/beads/issueops"
)
// lastJSONLine returns the final non-empty line of out, which is where
// reportIfRevisionFailure writes its machine body (the human line comes
// first; see reportIfRevisionFailure's own doc comment).
func lastJSONLine(t *testing.T, out string) string {
t.Helper()
lines := strings.Split(strings.TrimRight(out, "\n"), "\n")
for i := len(lines) - 1; i >= 0; i-- {
if strings.TrimSpace(lines[i]) != "" {
return lines[i]
}
}
t.Fatalf("no non-empty line in output:\n%s", out)
return ""
}
// decodeIfRevisionBody decodes line as either the flat shape (schema_version
// beside the body's own fields) or the BD_JSON_ENVELOPE=1 shape
// ({"schema_version":N,"data":{...}}), returning the body fields as a plain
// map so a test can assert JSON TYPES (float64 for a number, never a string)
// without fighting a typed struct's own unmarshal coercion.
func decodeIfRevisionBody(t *testing.T, line string, enveloped bool) map[string]interface{} {
t.Helper()
var whole map[string]interface{}
if err := json.Unmarshal([]byte(line), &whole); err != nil {
t.Fatalf("decode JSON line: %v\nline: %s", err, line)
}
if !enveloped {
return whole
}
data, ok := whole["data"].(map[string]interface{})
if !ok {
t.Fatalf("enveloped line has no \"data\" object: %s", line)
}
return data
}
// TestIfRevisionEnvelopeGascityContract pins T4.3: the stderr JSON a refused
// --if-revision write emits, in both the flat and the BD_JSON_ENVELOPE=1
// shapes, must carry integer revisions and a `code` field exactly as
// gascity's bdstore_conditional.go classifier decodes them. A string
// revision -- the most tempting "it's just a big number" mistake -- makes
// gascity's json.Decoder fail closed on the WHOLE object
// (bdstore_conditional.go:134-139), discarding even the `code` beside it.
func TestIfRevisionEnvelopeGascityContract(t *testing.T) {
oldJSON := jsonOutput
t.Cleanup(func() { jsonOutput = oldJSON })
jsonOutput = true
runCase := func(t *testing.T, enveloped bool) {
t.Helper()
oldEnv, had := os.LookupEnv("BD_JSON_ENVELOPE")
t.Cleanup(func() {
if had {
os.Setenv("BD_JSON_ENVELOPE", oldEnv)
} else {
os.Unsetenv("BD_JSON_ENVELOPE")
}
})
if enveloped {
os.Setenv("BD_JSON_ENVELOPE", "1")
} else {
os.Unsetenv("BD_JSON_ENVELOPE")
}
t.Run("stale_revision_carries_integer_expected_and_current", func(t *testing.T) {
var reported error
out := captureStderr(t, func() {
reported, _ = reportIfRevisionFailure("updating", "bd-1", &issueops.VersionMismatchError{Expected: 5, Current: 7}, nil)
})
ee, ok := reported.(*exitError)
if !ok || ee.Code != ExitGuardMismatch {
t.Fatalf("reported error = %#v, want *exitError{Code: %d}", reported, ExitGuardMismatch)
}
if !strings.Contains(out, "precondition failed") {
t.Errorf("human line must contain gascity's code-less-fallback phrase \"precondition failed\", got:\n%s", out)
}
body := decodeIfRevisionBody(t, lastJSONLine(t, out), enveloped)
if body["code"] != ifRevisionCodePreconditionFailed {
t.Errorf("code = %v, want %q", body["code"], ifRevisionCodePreconditionFailed)
}
if body["id"] != "bd-1" {
t.Errorf("id = %v, want bd-1", body["id"])
}
expected, ok := body["expected_revision"].(float64)
if !ok {
t.Fatalf("expected_revision is %T (%v), want a JSON number -- a string here makes gascity's decoder fail closed on the whole object", body["expected_revision"], body["expected_revision"])
}
if expected != 5 {
t.Errorf("expected_revision = %v, want 5", expected)
}
current, ok := body["current_revision"].(float64)
if !ok {
t.Fatalf("current_revision is %T (%v), want a JSON number", body["current_revision"], body["current_revision"])
}
if current != 7 {
t.Errorf("current_revision = %v, want 7", current)
}
// The raw bytes must never show a quoted number either -- a
// correct float64 decode does not rule out "5" (json.Unmarshal
// happily coerces neither direction here, but a regression that
// switched the struct field to string would still decode into
// interface{} as a string, which the type assertion above already
// catches; this is the belt to that suspenders).
if strings.Contains(lastJSONLine(t, out), `"expected_revision":"`) {
t.Errorf("expected_revision is quoted in the raw JSON, want a bare integer:\n%s", out)
}
})
t.Run("stale_assignee_or_status_carries_no_revision_fields", func(t *testing.T) {
var reported error
out := captureStderr(t, func() {
reported, _ = reportIfRevisionFailure("updating", "bd-2", storage.ErrAssigneeMismatch, nil)
})
ee, ok := reported.(*exitError)
if !ok || ee.Code != ExitGuardMismatch {
t.Fatalf("reported error = %#v, want *exitError{Code: %d}", reported, ExitGuardMismatch)
}
body := decodeIfRevisionBody(t, lastJSONLine(t, out), enveloped)
if body["code"] != ifRevisionCodePreconditionFailed {
t.Errorf("code = %v, want %q", body["code"], ifRevisionCodePreconditionFailed)
}
if _, present := body["expected_revision"]; present {
t.Errorf("expected_revision must be absent (omitempty) for a non-revision guard, got %v", body["expected_revision"])
}
if _, present := body["current_revision"]; present {
t.Errorf("current_revision must be absent (omitempty) for a non-revision guard, got %v", body["current_revision"])
}
})
t.Run("schema_version_is_present_and_an_integer", func(t *testing.T) {
out := captureStderr(t, func() {
_, _ = reportIfRevisionFailure("updating", "bd-3", &issueops.VersionMismatchError{Expected: 1, Current: 2}, nil)
})
var whole map[string]interface{}
if err := json.Unmarshal([]byte(lastJSONLine(t, out)), &whole); err != nil {
t.Fatalf("decode: %v", err)
}
sv, ok := whole["schema_version"].(float64)
if !ok || sv != float64(JSONSchemaVersion) {
t.Errorf("schema_version = %v, want %d", whole["schema_version"], JSONSchemaVersion)
}
})
}
t.Run("flat", func(t *testing.T) { runCase(t, false) })
t.Run("enveloped_BD_JSON_ENVELOPE", func(t *testing.T) { runCase(t, true) })
}
// TestIfRevisionUnsupportedBackendCode pins T4.9: a backend whose Lifecycle
// cannot honor ExpectedVersion at all (issueops.ErrUnsupported) must report
// "conditional_write_unsupported" and exit 1 -- never ExitGuardMismatch,
// which promises callers "a racer won, do not retry", and never a silent
// unconditional fallback that drops the guard on the floor.
func TestIfRevisionUnsupportedBackendCode(t *testing.T) {
oldJSON := jsonOutput
t.Cleanup(func() { jsonOutput = oldJSON })
jsonOutput = true
var reported error
var ok bool
out := captureStderr(t, func() {
reported, ok = reportIfRevisionFailure("deleting", "bd-9", &issueops.ErrUnsupported{Op: "Delete.ExpectedVersion", Backend: "stub"}, nil)
})
if !ok {
t.Fatalf("reportIfRevisionFailure did not recognize issueops.ErrUnsupported as a guard outcome")
}
ee, isExitErr := reported.(*exitError)
if !isExitErr || ee.Code != 1 {
t.Fatalf("reported error = %#v, want *exitError{Code: 1}", reported)
}
if !strings.Contains(out, "conditional write unsupported") {
t.Errorf("human line should say the write is unsupported, got:\n%s", out)
}
body := decodeIfRevisionBody(t, lastJSONLine(t, out), false)
if body["code"] != ifRevisionCodeUnsupported {
t.Errorf("code = %v, want %q", body["code"], ifRevisionCodeUnsupported)
}
if _, present := body["expected_revision"]; present {
t.Errorf("expected_revision must be absent for an unsupported-backend refusal, got %v", body["expected_revision"])
}
// classifyIfRevisionFailure is reportIfRevisionFailure's own classifier;
// pinned directly too so a future refactor that bypasses the report
// function still has this assertion on the mapping itself.
code, _, expected, current, classified := classifyIfRevisionFailure(&issueops.ErrUnsupported{Op: "x", Backend: "y"}, nil)
if !classified || code != ifRevisionCodeUnsupported {
t.Errorf("classifyIfRevisionFailure(ErrUnsupported) = %q, %v, want %q, true", code, classified, ifRevisionCodeUnsupported)
}
if expected != nil || current != nil {
t.Errorf("classifyIfRevisionFailure(ErrUnsupported) revisions = %v, %v, want nil, nil", expected, current)
}
}
// TestClassifyIfRevisionFailureUnrelatedError pins ok=false for an error that
// is neither a guard outcome nor an unsupported-backend signal: the caller's
// own (unrelated) failure handling must run unchanged, and nothing here may
// claim the error as its own.
func TestClassifyIfRevisionFailureUnrelatedError(t *testing.T) {
if _, _, _, _, ok := classifyIfRevisionFailure(nil, nil); ok {
t.Errorf("classifyIfRevisionFailure(nil) ok = true, want false")
}
if _, _, _, _, ok := classifyIfRevisionFailure(errUnrelatedForIfRevisionTest, nil); ok {
t.Errorf("classifyIfRevisionFailure(unrelated error) ok = true, want false")
}
if reported, ok := reportIfRevisionFailure("updating", "bd-4", errUnrelatedForIfRevisionTest, nil); ok || reported != nil {
t.Errorf("reportIfRevisionFailure(unrelated error) = %v, %v, want nil, false", reported, ok)
}
}
var errUnrelatedForIfRevisionTest = errors.New("boom: unrelated failure")
// TestClassifyIfRevisionFailureBareVersionMismatchSentinel pins mc-zndi7.78:
// an HTTP-backed store (bd-enterprise, after the gascity sync) that returns
// the bare storage.ErrVersionMismatch sentinel -- not the typed
// *issueops.VersionMismatchError -- must still classify as
// "precondition_failed" / ExitGuardMismatch, falling back to the caller's own
// ifRevision for expected_revision (since the sentinel itself carries none)
// and omitting current_revision (genuinely unknown).
func TestClassifyIfRevisionFailureBareVersionMismatchSentinel(t *testing.T) {
ifRevision := int64(42)
code, _, expected, current, ok := classifyIfRevisionFailure(storage.ErrVersionMismatch, &ifRevision)
if !ok || code != ifRevisionCodePreconditionFailed {
t.Fatalf("classifyIfRevisionFailure(bare ErrVersionMismatch) = %q, %v, want %q, true", code, ok, ifRevisionCodePreconditionFailed)
}
if expected == nil || *expected != ifRevision {
t.Errorf("expected_revision = %v, want &%d (the caller's --if-revision value)", expected, ifRevision)
}
if current != nil {
t.Errorf("current_revision = %v, want nil (unknown to the bare sentinel)", current)
}
reported, ok := reportIfRevisionFailure("updating", "bd-5", storage.ErrVersionMismatch, &ifRevision)
if !ok {
t.Fatalf("reportIfRevisionFailure did not recognize the bare ErrVersionMismatch sentinel as a guard outcome")
}
ee, isExitErr := reported.(*exitError)
if !isExitErr || ee.Code != ExitGuardMismatch {
t.Fatalf("reported error = %#v, want *exitError{Code: %d}", reported, ExitGuardMismatch)
}
}
// TestClassifyIfRevisionFailureNotFoundSentinel pins mc-zndi7.81: a pre-flight
// existence check that fails with the bare storage.ErrNotFound sentinel --
// e.g. cmd/bd/delete.go's resolveAndGetIssueForMutation call, which runs
// before deleter.Delete() and the per-id lock fence #7244 added, so a
// same-token --if-revision racer that loses that fence can find the row
// already gone right there -- must classify exactly like a mid-guard version
// mismatch: "precondition_failed" / ExitGuardMismatch, falling back to the
// caller's own --if-revision value for expected_revision and omitting
// current_revision (the row is gone; there is nothing left to report).
// Without this, that pre-flight path surfaces an unclassified, uncoded exit 1
// instead of joining every other --if-revision loser at exit 13.
func TestClassifyIfRevisionFailureNotFoundSentinel(t *testing.T) {
ifRevision := int64(7)
code, _, expected, current, ok := classifyIfRevisionFailure(storage.ErrNotFound, &ifRevision)
if !ok || code != ifRevisionCodePreconditionFailed {
t.Fatalf("classifyIfRevisionFailure(ErrNotFound) = %q, %v, want %q, true", code, ok, ifRevisionCodePreconditionFailed)
}
if expected == nil || *expected != ifRevision {
t.Errorf("expected_revision = %v, want &%d (the caller's --if-revision value)", expected, ifRevision)
}
if current != nil {
t.Errorf("current_revision = %v, want nil (the row is gone; nothing to report)", current)
}
reported, ok := reportIfRevisionFailure("deleting", "bd-6", storage.ErrNotFound, &ifRevision)
if !ok {
t.Fatalf("reportIfRevisionFailure did not recognize storage.ErrNotFound as a guard outcome")
}
ee, isExitErr := reported.(*exitError)
if !isExitErr || ee.Code != ExitGuardMismatch {
t.Fatalf("reported error = %#v, want *exitError{Code: %d}", reported, ExitGuardMismatch)
}
}
// TestReportIfRevisionTargetGone pins ga-vnycm2.10's pre-flight mapping: a
// verb's resolution failing with not-found (the storage sentinel, or
// ResolvePartialID's unwrapped "no issue found matching" text) reports as
// precondition_failed / ExitGuardMismatch only under an active --if-revision
// guard; with no guard, or for any other resolution failure, it is not a
// guard outcome and the caller's own handling applies.
func TestReportIfRevisionTargetGone(t *testing.T) {
ifRevision := int64(3)
for _, tc := range []struct {
name string
err error
ifRevision *int64
wantOK bool
}{
{"sentinel_guarded", fmt.Errorf("resolving: %w", storage.ErrNotFound), &ifRevision, true},
{"partial_id_text_guarded", errors.New(`no issue found matching "bd-x"`), &ifRevision, true},
// bd delete's exact resolution: bd-x is gone, its child bd-x.1 is not.
{"abbreviation_guarded", &utils.AbbreviatedIDError{Input: "bd-x", Matches: []string{"bd-x.1"}}, &ifRevision, true},
{"abbreviation_unguarded", &utils.AbbreviatedIDError{Input: "bd-x", Matches: []string{"bd-x.1"}}, nil, false},
{"sentinel_unguarded", storage.ErrNotFound, nil, false},
{"other_error_guarded", errors.New("connection refused"), &ifRevision, false},
} {
t.Run(tc.name, func(t *testing.T) {
reported, ok := reportIfRevisionTargetGone("closing", "bd-x", tc.err, tc.ifRevision)
if ok != tc.wantOK {
t.Fatalf("reportIfRevisionTargetGone ok = %v, want %v", ok, tc.wantOK)
}
if !ok {
if reported != nil {
t.Errorf("reported = %v, want nil when not a guard outcome", reported)
}
return
}
ee, isExitErr := reported.(*exitError)
if !isExitErr || ee.Code != ExitGuardMismatch {
t.Fatalf("reported error = %#v, want *exitError{Code: %d}", reported, ExitGuardMismatch)
}
})
}
}
// TestClassifyIfRevisionFailureTypedBeforeSentinel pins ordering: a typed
// *issueops.VersionMismatchError (which also satisfies errors.Is against the
// same ErrVersionMismatch sentinel via Unwrap) must still report its OWN
// Expected/Current, not fall into the bare-sentinel branch and report the
// caller's ifRevision/nil instead.
func TestClassifyIfRevisionFailureTypedBeforeSentinel(t *testing.T) {
ifRevision := int64(999)
code, _, expected, current, ok := classifyIfRevisionFailure(&issueops.VersionMismatchError{Expected: 5, Current: 7}, &ifRevision)
if !ok || code != ifRevisionCodePreconditionFailed {
t.Fatalf("classifyIfRevisionFailure(typed) = %q, %v, want %q, true", code, ok, ifRevisionCodePreconditionFailed)
}
if expected == nil || *expected != 5 {
t.Errorf("expected_revision = %v, want &5 (the typed error's own Expected, not ifRevision)", expected)
}
if current == nil || *current != 7 {
t.Errorf("current_revision = %v, want &7 (the typed error's own Current)", current)
}
}