Skip to content

fix(sdk): reject competing durable OTel views - #956

Merged
zhongkechen merged 25 commits into
mainfrom
fix/otel-exclusive-views-943
Oct 7, 2026
Merged

zhongkechen merged 25 commits into
mainfrom
fix/otel-exclusive-views-943

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Reject competing bundled OTel views across explicit and environment configuration. The loader validates all declared provider types before calling any environment-selected factory, so a conflicting dynamic pair cannot install sampler or ID-generator wrappers on the global tracer. Diagnostics identify the concrete plugin classes, including subclasses.

The bundled views declare inherited static metadata through a namespaced symbol shared across package copies. The base hook interface and ordinary plugin properties remain unchanged. Existing instance metadata remains supported, and returned instances are checked too so a v1 provider that declares a broader base class cannot bypass exclusivity. Explicit instances have already been constructed by the application before registration; validation cannot undo that construction.

Compatibility stays additive: provider API version 1 and handler-scoped factory calls remain unchanged. OTel's core peer stays optional (>=2.4.0 <3.0.0), including separate OTel-only layers beside a released core. The new exclusivity guarantee requires the coordinated core 2.7 / OTel 1.2 pair. The per-invocation factory migration remains separate in #924.

Validation:

  • All 107 core suites / 1,292 tests pass.
  • All 38 focused OTel composed and installed-consumer tests pass, covering both dynamic orders, mixed/explicit configuration, preserved global tracer fields, inherited subclass groups/names, valid single views, released/current package combinations, strict declarations and separate layers.
  • Seven new regression cases fail against the previous runtime and pass with the fix.
  • Core/OTel ESM, CJS and declaration builds, both package type checks, root Biome (1,177 files), and git diff --check pass.

The branch retains the shared bounded deployment/read-retry and scheduler-sensitive example fixture repairs from #959. Installed-consumer setup rebuilds candidate packages before packing to avoid stale outputs. Cloud checks run through PR CI; no packages were published.

Fixes #943.

zhongkechen added a commit that referenced this pull request Oct 2, 2026
The JS caller grants `contents: read`, but the pinned reusable AI-review
workflow requests `contents: write` for activity/publication jobs.
GitHub rejects the workflow before review generation; [this
run](https://github.com/aws/aws-durable-execution-sdk-js/actions/runs/37062142944)
reports that the nested job is requesting write while the caller allows
only read.

Grant `contents: write` to the reusable-workflow call, matching its
declared requirements and the Java/Python callers. The review generation
job retains its own narrower contents grant.

Validation: parsed the YAML and compared the before/after structures;
the only change is this permission value. Checked the pinned reusable
workflow and exact GitHub startup diagnostic; `git diff --check` passed.
This configuration-only change does not alter SDK code.

This must reach the trusted base/default branch before the blocked
automatic reviews for #953, #954, #955 and #956 can start. No successful
Actions execution is claimed from the PR-head change alone.
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 2, 2026 21:44 — with GitHub Actions Inactive
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 2, 2026 22:02 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 2, 2026 23:23 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 2, 2026 23:58 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 3, 2026 01:54 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen had a problem deploying to ai-pr-review-runtime October 6, 2026 22:23 — with GitHub Actions Failure
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 7, 2026 02:04 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 7, 2026 17:24 — with GitHub Actions Inactive
@github-actions

This comment has been minimized.

@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime October 7, 2026 19:15 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codex AI review

No actionable findings. Residual test risk: installed-package compatibility coverage exercises CommonJS consumers only; the equivalent ESM provider/layer path remains untested.

Reviewed commit 4dfe43018835cbdff184252fcdcd1afaa77e6b3f. Workflow run

@zhongkechen
zhongkechen merged commit 19ee19f into main Oct 7, 2026
42 checks passed
@zhongkechen
zhongkechen deleted the fix/otel-exclusive-views-943 branch October 7, 2026 20:34
zhongkechen added a commit that referenced this pull request Oct 21, 2026
The shared LocalDurableTestRunner fix landed in #1020. This PR targets
`main` and prepares Core 3.0 / OTel 2.0 with per-invocation plugin
factories. The renamed Durable Execution Telemetry exporter retains
upstream's `0.1.0-alpha.0` version and adopts the matching Core 3
contract.

### Issue Link, if available

Refs #950. Related: #953, #954, #955, #956, #959, #960, #962, and #964.
Business lifecycle cancellation and deadline handling remain tracked in
#927/#1014.

### Description

Handler-scoped plugin instances can mix concurrent Lambda Managed
Instances executions. SDK 3.x accepts `createPlugin(info)` factories and
constructs one plugin instance per invocation. Spans, operation maps,
clocks, execution identity, and buffers belong to that invocation;
providers, exporters, and environment initialization remain shared.
Declared legacy v1 providers fail before the factory or handler runs.
Factories may return null/undefined to skip an invocation; bundled
factories retain concrete return types.

Both OTel views preserve bounded finalization: synchronous child
completion and parent finalization, current checkpoint ancestry,
terminal ERROR status without invented exceptions, public
global-provider delegate flushing, and one `flushTimeoutMillis` budget
across all waits. Hooks freeze before the final provider wait. Closing
one instance does not close another invocation; attempts admitted during
the open drain phase retain their identity and are included in the final
bounded batch. The Telemetry exporter likewise keeps invocation-local
buffers and shared serialized exports.

The change includes invocation-local X-Ray carriers, replay export
suppression, fresh operation-update visibility, exclusive OTel views,
and chained-invoke propagation through each invocation's factory
instance. Carrier availability remains authoritative even when its value
is empty, undefined, null, or invalid. Shared-LMI examples require a
real runtime carrier. Initialization failure closes any known Invocation
span best effort, leaves that instance inert, and does not shut down the
shared provider.

Physical span boundaries use invocation-local wall/monotonic correlation
and `HrTime`; supplied backend Dates remain authoritative. Missing
logical boundaries use millisecond precision, and a missing deferred
start is bounded by a known completion. Already-recording attempts
cannot retroactively move their start across arbitrary backend clock
skew.

The integration with upstream's Telemetry rename updates package names,
imports, examples, and documentation while retaining the major factory
API and invocation isolation. All 26 conformance handlers use factory
registration. The reusable workflow discovers the pinned catalog and no
longer receives the unsupported `case_count` input.

Late completions during the open drain phase can outlive already-ended
enclosing spans. Updates after finalization, exporter failure, or a
frozen runtime have no delivery guarantee. No export acknowledgment is
persisted, and the OTel factory does not cancel detached business work.

### Testing

Validation on `65a3a036`, including upstream `5f0c707d`:

- 3,256 tests passed: Core 1,448; OTel 791; Telemetry Exporter 114;
Telemetry Core 385; MCP 406; VS Code 34; Desktop 48; peer compatibility
30.
- Full workspace build, Telemetry host/webview builds, affected type
checks, repository lint, and locked root/webview installs passed.
- Packed Core 3.0.0 and Telemetry Exporter 0.1.0-alpha.0 passed strict
CJS/ESM TypeScript checks with `skipLibCheck: false`. Both loaders
passed concurrent real public-wrapper invocations and completed-step
replay with a fake transport. Verified invocation isolation, serialized
exports, final flush, and renamed exports/discriminator; no runtime
network calls occurred.
- Installed-consumer checks included the exporter's declared optional
AWS peers. The inherited eager exporter imports still require those
peers at root import time; this merge does not change that packaging
limitation.

No AWS cloud deployment was run locally for this merge.

GitHub checks and workflows passed on `65a3a036`, including Build, Core
and OTel conformance, CodeQL, and AI review.

### Demo/Screenshots

Not applicable; public-handler, replay, installed-package, and
concurrent-invocation regressions cover the behavior.

### Checklist

- [x] Prepare the factory migration for the next major release
- [x] GitHub checks passed on `65a3a036`
- [ ] Required independent approval
- [ ] Complete release notes and coordinated package publication

---------

Co-authored-by: Frank Chen <[email protected]>
Co-authored-by: Frank Chen <[email protected]>

This branch was previously deployed

1 inactive deployment
ai-pr-review-runtime — 4dfe4301 Deployed Oct 7, 2026 by zhongkechen via ai-pr-review / Codex review / Generate Codex review #947
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.

[Bug]: enabling both OTel views is accepted without mutual-exclusion validation

2 participants