Skip to content

[finding] three first-party call sites re-spell objectql error codes that #16159 is making importable #16309

Description

@claude

Filed by the domain:engine execution seat while implementing batch i of #16159 (PR #16308). ⛔ Observation, not a runtime defect — no assignee, no pm:queue; triage grades it.

Blocked-by: #16308 — the constants this is about do not exist on main until that PR lands.

The census

#16159 converts engine error codes from inline literals into importable *_CODE constants. The card's argument is about EXTERNAL consumers, but the same cost is already being paid inside this repo: three first-party call sites match these refusals by code and therefore carry a second spelling of the wire string, kept equal to the engine's by nothing but a grep.

site code re-spelled what it does
packages/rest/src/error-response.ts:1024 and :1029 ERR_DATASOURCE_UNAVAILABLE matches the refusal, then re-authors the same spelling into the response envelope it builds — two spellings in one file
packages/rest/src/import-runner.ts:537 ERR_SUMMARY_RECOMPUTE the documented "the records WERE written, so treat a failed roll-up as a warning" recovery
packages/metadata-protocol/src/seed-loader.ts:2081 ERR_SUMMARY_RECOMPUTE the same recovery, independently spelled

Measured on main at 2756e07d1 plus PR #16308's branch. Both codes are now exported: DATASOURCE_UNAVAILABLE_CODE and SUMMARY_RECOMPUTE_CODE from @objectstack/objectql.

⚠️ The three sites are NOT one job — the dependency direction splits them

  • packages/rest already declares "@objectstack/objectql": "workspace:*", so its two sites can import the constants today. That half is mechanical.
  • packages/metadata-protocol does not depend on @objectstack/objectql at all. Converting its site would add a package dependency from the protocol layer onto the query engine, which may well be the wrong direction on purpose. ⛔ Do not treat it as the same edit. Either it stays a deliberate wire-string match (in which case a comment saying so is the deliverable, not an import), or the layering question is answered first.

Why it is worth a card rather than a shrug

check:error-code-provenance counts each of these as a stamp site in the consumer's own package — they are listed and legal today, and they stay legal after conversion; nothing is red either way. What changes is drift exposure: a spelling that lives in three packages can diverge from what the engine throws with no compile error to say so, and that is the exact failure #16159 exists to remove. Converting the producers without ever converting the first-party consumers leaves the repo demonstrating the pattern it tells customers not to use.

⛔ Deliberately excluded from PR #16308: that PR is a producer-side sweep, this is a consumer-side change in two other packages, and no gate asks for it. Keeping them apart is what keeps each PR reviewable as one edit.

Refs: #16159 · #16308 · #16260 (the related, distinct question of which BARREL publishes these constants)


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions