Skip to content

PatchSession classifies errors by parsing err.message #152

Description

@flyingrobots

Migrated from Method backlog

GitHub Issues are now the live work tracker. Repository docs remain Method evidence.

Field Value
Source backlog docs/method/backlog/bad-code/BND_patch-session-message-parsing.md
Archived source docs/archive/backlog/github-issue-migration-2026-06-01/docs/method/backlog/bad-code/BND_patch-session-message-parsing.md
Original lane bad-code
Original id BND_patch-session-message-parsing
Original legend BND
Original feature observer-admission-runtime
Original release home v19.0.0

Original backlog card

PatchSession classifies errors by parsing err.message

Effort: S

What's Wrong

PatchSession._classifyCommitError() uses errMsg.includes('Concurrent commit detected') and errMsg.includes('has advanced') to classify errors. This is the "raccoon in a dumpster" anti-pattern from SSJS doctrine — behaviorally significant branching driven by string matching on human-readable text. If anyone rewords the message, the classification silently breaks.

Error type should be primary, not message content.

Suggested Fix

Introduce ConcurrentCommitError and RefAdvancedError classes extending the appropriate domain error base. Throw those from the origin sites. Replace _classifyCommitError() string matching with instanceof dispatch (P7).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:runtimePrimary work area: runtime.feature:observer-admission-runtimeMethod feature observer-admission-runtime.legend:bndMethod legend bnd.priority:laterDeferred or speculative work.release-home:v19.0.0Method release home v19.0.0.status:availableOpen and available for prioritization; not blocked or actively in progress.type:debtDebt, rot, or structural risk.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions