Skip to content

bugfix - prevent imported static initialization deadlocks (#680)#691

Merged
dannymeijer merged 3 commits into
release/v0.3from
bugfix/680-imported-static-init-deadlock
May 25, 2026
Merged

bugfix - prevent imported static initialization deadlocks (#680)#691
dannymeijer merged 3 commits into
release/v0.3from
bugfix/680-imported-static-init-deadlock

Conversation

@dannymeijer
Copy link
Copy Markdown
Contributor

Summary

This PR fixes imported static initialization deadlocks by making generated static access call the defining module's static-init guard before forcing an imported LazyLock. It also chains that guard through public static re-export modules, merges the current origin/release/v0.3 state into the branch, and bumps the v0.3 release candidate to 0.3.0-rc16.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/RFCs/*)

Area(s)

Select the primary areas touched (used for review routing; labels are managed separately):

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)
  • Editor integration (LSP/VS Code extension)
  • Runtime / Core crates (stdlib/core/derive)
  • Documentation

Key details

  • User-facing behavior: Imported source statics can be used from other modules without deadlocking when their initializer calls back into the defining module's static initialization path. InQL-style shared registry statics are unblocked for decorator-driven helper modules.
  • Internals: Static access emission now tracks imported static bindings and routes reads, bindings, storage-rooted field/index operations, and assignments through a per-static init call plan. Public re-export modules import and chain the original defining module's __incan_init_module_statics helper.
  • Risks: Static initialization is shared generated-runtime plumbing. The fix touches core static emission paths, so the PR includes focused deadlock coverage, existing static/codegen snapshots, and the full pre-commit gate after merging upstream.

Testing / verification

  • make test / cargo test
  • make examples (if relevant)
  • incan fmt --check . (if relevant)
  • Manual verification described below

Manual verification notes:

  • cargo test test_imported_static_initializer_does_not_deadlock_issue680 --features cli --test integration_tests
  • cargo test --features cli --test codegen_snapshot_tests
  • git diff --check
  • make pre-commit

Docs impact

  • No docs changes needed
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

If docs updated:

  • Link(s): n/a

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Closes #680

@incan-triage-bot incan-triage-bot Bot added incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) incan language semantics Suggestions, features, or bugs related to the Incan Language itself (syntax and semantics) runtime / core crates Suggestions, features, or bugs related to the `incan-core`, `incan-stdlib`, 'incan-derive` crates labels May 25, 2026
@dannymeijer dannymeijer self-assigned this May 25, 2026
@dannymeijer dannymeijer added this to the 0.3 Release milestone May 25, 2026
@dannymeijer dannymeijer marked this pull request as ready for review May 25, 2026 04:58
@dannymeijer dannymeijer merged commit d6068c9 into release/v0.3 May 25, 2026
33 checks passed
@dannymeijer dannymeijer deleted the bugfix/680-imported-static-init-deadlock branch May 25, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) incan language semantics Suggestions, features, or bugs related to the Incan Language itself (syntax and semantics) runtime / core crates Suggestions, features, or bugs related to the `incan-core`, `incan-stdlib`, 'incan-derive` crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug - Imported static access can deadlock module static initialization

1 participant