Skip to content

objectql: the value-bearing-diagnostic list in driver-fault-redaction.ts has one entry and no way to notice a second is missing (observation) #9160

Description

@os-zhuang

Filed unassigned from #8823's implementation (PR pending). Observation-class: nothing here is measured off a thrown error, which is exactly why it is a card and not a patch. Duplicate-searched first (keyword + file path over open issues): no existing card.

What #8823 established

redactStatementFromMessage (packages/objectql/src/driver-fault-redaction.ts) keeps the database's diagnostic after the statement cut, on the premise that the diagnostic names identifiers. #8823 measured one family where that premise is false — MySQL's ER_DUP_ENTRY (1062) inlines the conflicting value — and its fix redacts that one value slot while keeping the index name.

That fix introduces a small list of value-bearing templates. It has exactly one entry, and the source states the rule for adding a second: a dialect's spelling goes in once measured off a thrown error, never from a reading of the manual (the standing rule in packages/types/src/unique-violation.ts).

The gap this records

The list is correct and the rule is right. What does not exist is any way to notice a missing entry. Nothing measures whether a diagnostic a driver produced carries a value; the single entry got there because a human read one template closely, and the next one will need the same accident.

Two families that read like candidates, both from the manual and therefore deliberately NOT added by #8823's PR:

  • MySQL ER_TRUNCATED_WRONG_VALUE_FOR_FIELD (1366) — Incorrect integer value: 'abc' for column 'age' at row 1. The first slot is the caller's value; the second is an identifier.
  • Postgres invalid input syntax for type integer: "abc" — a caller value on error.message, unlike the unique-violation case where Postgres' value sits on error.detail and is saved only by Logger not serializing that field.

⛔ Neither is a claim that these leak. Neither has been raised off a live server here, so under the standing rule neither may be added, and both may be phrased differently in practice than the manual says.

What would actually close this

Not "add the two above". Probably one of:

  • a probe that raises each candidate family against the live MySQL/Postgres services CI already stands up, and records the real phrasing — which converts these from manual-reading to measurement and makes them addable;
  • or a decision that the redactor's contract should invert for this one slot (keep an allowlist of identifier-shaped tails rather than a denylist of value-bearing ones) — a wider contract change with its own cost, since over-matching deletes the diagnostic an operator came for.

The second is a real design question and is not something #8739's ruling covers, which is why this is filed rather than decided.

Related

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions