Skip to content

JUL-159: Keep rejected LLVM declarations atomic - #454

Draft
julia-script wants to merge 2 commits into
mainfrom
julia/jul-159-declaration-failure-atomicity
Draft

julia-script wants to merge 2 commits into
mainfrom
julia/jul-159-declaration-failure-atomicity

Conversation

@julia-script

@julia-script julia-script commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • validate new function prefixes and prologues before allocating their module-global entry
  • validate retained variable debug expressions before allocating their module-global entry
  • expose every global actor handle table in internal declaration snapshots so atomicity checks cover the complete state
  • cover all three foreign-handle failures with unchanged snapshots, precise InvalidState errors, successful same-name retries, compatible occupied-function reuse, and preserved strip-mode behavior
  • publish the LLVM correction as a patch changeset

Why this matters

A handled foreign-owner rejection previously left an orphan global, handle, attachment slot, and reserved name without a function or variable actor. The rejected call poisoned the reusable builder and made a valid same-name retry fail.

Before

const allocated = yield* GlobalState.allocate(/* ... */)
const prefix = yield* optionalConstant(/* possibly foreign */)

After

const prefix = yield* optionalConstant(/* possibly foreign */)
const allocated = yield* GlobalState.allocate(/* commit point */)

The compatible occupied-function fast path remains ahead of prefix/prologue validation. strip: true still ignores debug expressions.

Tracking

  • Linear: JUL-159
  • OpenSpec: not required; this is a focused internal @silklang/llvm correction with no Silk language or standard-library contract change
  • Final head: 518513e78b276e4fa4bd2a808caed6ad747ae047

Verification

  • Regression characterization before the fix: focused Global.test.ts failed with the expected orphan global/handle/attachment diff
  • pnpm --filter @silklang/llvm exec vitest run test/Global.test.ts — 6 tests passed (469 ms final local run)
  • pnpm --filter @silklang/llvm typecheck — passed
  • focused Oxfmt, Oxlint, and git diff --check — passed
  • required pull-request CI — passed on the exact final head; 21 jobs completed with no failures
  • Vercel — passed on the exact final head
  • independent general review — approved the exact base/head diff with zero findings after the review revisions
  • dedicated test-economics review — approved; base/head whole-file in-test medians were 10/12 ms (approximately +2 ms), with no parsing, compiler, backend, or subprocess boundary

Risk and deferred work

Risk is limited to declaration validation order and fuller internal snapshots. General BuilderState rollback, function compatibility changes, adjacent already-safe declaration actors, and JUL-158 performance work remain out of scope.

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
silk-effect-docs Ready Ready Preview Sep 15, 2026 2:39am UTC

Request Review

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