Skip to content

fix(core): make @ambarltd/core/tracing resolve — promote facade to file-module - #64

Merged
christopherpcosta merged 2 commits into
mainfrom
dev/chcost/core-tracing-exports
Jun 12, 2026
Merged

fix(core): make @ambarltd/core/tracing resolve — promote facade to file-module#64
christopherpcosta merged 2 commits into
mainfrom
dev/chcost/core-tracing-exports

Conversation

@christopherpcosta

@christopherpcosta christopherpcosta commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Problem

@ambarltd/core/tracing does not resolve from the built package — caught while preparing the 0.1.17 release (0.1.17 is not yet published, so nothing shipped broken).

tracing was the package's first directory-index module (src/tracing/index.tsdist/tracing/index.js). The exports wildcard substitutes subpaths literally with no index fallback:

"./*" → "./dist/*.js"   ⇒   "@ambarltd/core/tracing" → dist/tracing.js   (did not exist)

So import { setTracer } from "@ambarltd/core/tracing" failed with MODULE_NOT_FOUND, while …/tracing/opentelemetry happened to work. HartAgency#173 imports both.

Fix — follow the package's own module convention

Every public module in core is a top-level file resolved by the single wildcard (future, router, maybe, json/schema, json/decoder, …; consumer base has zero directory-index imports). So instead of adding a special-case exports entry (first version of this PR), the facade moves to where the convention puts it:

  • src/tracing/index.tssrc/tracing.ts (file-module facade, like future.ts)
  • src/tracing/ keeps the implementations (opentelemetry, proxy, simple) — the same namespace shape as json/
  • 4 relative-import line updates; package.json untouched — the wildcard stays the only export rule

Public import paths are exactly as intended and unchanged: @ambarltd/core/tracing and @ambarltd/core/tracing/opentelemetry.

Validation (against the built artifact)

require.resolve('@ambarltd/core/tracing')               → dist/tracing.js              ✅ (was MODULE_NOT_FOUND)
require.resolve('@ambarltd/core/tracing/opentelemetry') → dist/tracing/opentelemetry.js ✅
require.resolve('@ambarltd/core/router')                → dist/router.js               ✅ (wildcard untouched)
dist/tracing.js exports: event, setTracer, trace, traceF, traceP                       ✅
tsc build clean · typecheck clean · core tests 123/123 pass                            ✅

Release note

No version bump needed — 0.1.17 (already on main, unpublished) ships this. After merge: cd core && pnpm publish (manual — the ambar-core workflow is CI-only).

tracing is the package's first directory module. The wildcard exports
entry ("./*" -> "./dist/*.js") substitutes the subpath literally with
no directory-index fallback, so '@ambarltd/core/tracing' resolved to the
non-existent dist/tracing.js and failed with MODULE_NOT_FOUND in
consumers — while './tracing/opentelemetry' happened to work. Caught
before 0.1.17 was published.

Verified against the built package: with the explicit entry,
require.resolve('@ambarltd/core/tracing') -> dist/tracing/index.js and
existing wildcard subpaths (e.g. ./router) still resolve.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Drop the special-case exports entry and instead match the package's
module convention: every public module is a top-level file resolved by
the single "./*" wildcard (future, router, json/schema, ...). The
facade moves from src/tracing/index.ts to src/tracing.ts and the
tracing/ directory keeps the implementations (opentelemetry, proxy,
simple) — the same shape as the json/ namespace. Public import paths
are unchanged: '@ambarltd/core/tracing' and
'@ambarltd/core/tracing/opentelemetry' both resolve.

Verified: tsc build clean, require.resolve OK for tracing,
tracing/opentelemetry and router against the built package, typecheck
clean, 123/123 core tests pass.
@christopherpcosta christopherpcosta changed the title fix(core): map ./tracing subpath to dist/tracing/index explicitly fix(core): make @ambarltd/core/tracing resolve — promote facade to file-module Jun 12, 2026
@christopherpcosta
christopherpcosta merged commit 4fdd0ef into main Jun 12, 2026
1 check passed
@christopherpcosta
christopherpcosta deleted the dev/chcost/core-tracing-exports branch June 12, 2026 12:37
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