Skip to content

fix: remove duplicate const declarations, fix broken test/contracts/config — closes #38#56

Open
rishab11250 wants to merge 1 commit into
NEXARA-oss:mainfrom
rishab11250:fix/issue-38-duplicate-const-declarations
Open

fix: remove duplicate const declarations, fix broken test/contracts/config — closes #38#56
rishab11250 wants to merge 1 commit into
NEXARA-oss:mainfrom
rishab11250:fix/issue-38-duplicate-const-declarations

Conversation

@rishab11250
Copy link
Copy Markdown

Description

Fixes issue #38 — the WorkflowRuntime.execute() method crashed at parse time due to duplicate const declarations. Also fixes 5 additional bugs introduced by PRs #33 and #34 that left the code in a broken state.

Changes

packages/core/src/lib/runtime.ts (4 fixes)

  • Deleted duplicate first-draft loop (lines 80-131) — PR fix runtime tenant tracing events #34 added a redundant execution loop that declared const state and const results, but kept the original retry-enabled loop below it with identical declarations. This caused SyntaxError: Identifier 'state' has already been declared.
  • Moved workflow.started event — relocated from the deleted loop to the retry-enabled loop so the event is still published.
  • Fixed runStepWithRetry caller args — was passing args.correlationId as the tenantId parameter and attempt as correlationId. All step events (tool.called, llm.requested) had wrong tenant and correlation IDs.
  • Fixed runStep method signature — had orphaned parameter declarations and two ): Promise<...> { return-type declarations, making it invalid TypeScript.
  • Added missing tenantId to the startSpan call in the second loop — the call was missing this required field, causing Zod validation failures.

packages/contracts/src/index.ts (1 fix)

  • Removed duplicate kind field in traceSpanSchema — the schema had two kind declarations. The second (narrower) one overwrote the first, silently dropping 'memory' and 'trigger' span types from validation.

packages/core/src/lib/config.ts (1 fix)

  • Removed merge artifact issue-30-auth-disabled-false bare string literal.
  • Removed duplicate AUTH_DISABLED declarationz.coerce.boolean().default(true) was overriding the booleanEnv preprocessor.

packages/core/src/lib/runtime.test.ts (1 fix)

  • Closed unclosed it() and describe() blocks — the first test suite was never terminated, causing a parse error.
  • Removed duplicate import block that was injected in the middle of the file with no enclosing scope.
  • Merged missing type imports (ExecutionSnapshot, TraceSpan, PulseInfra) into the top-level import block.

Testing

  • ✅ All 15 tests across 7 test files pass
  • ✅ TypeScript compilation: clean (both @pulsestack/contracts and @pulsestack/core)
  • ✅ No changes pushed to main — branch fix/issue-38-duplicate-const-declarations only

Related Issues

…s/config files

Closes NEXARA-oss#38

Fixes 6 bugs:
- runtime.ts: delete duplicate first-draft loop causing SyntaxError
- runtime.ts: fix runStepWithRetry caller args (wrong tenantId/correlationId)
- runtime.ts: fix runStep method signature (orphaned params, double return type)
- runtime.ts: add missing tenantId to startSpan call in second loop
- contracts/index.ts: remove duplicate kind field dropping 'memory'/'trigger'
- config.ts: remove merge artifact and duplicate AUTH_DISABLED
- runtime.test.ts: close unclosed test blocks, remove duplicate imports
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]: WorkflowRuntime.execute() crashes at parse time due to duplicate const declarations

1 participant