Skip to content

bugfix - preserve per-file inline test module context (#676)#678

Merged
dannymeijer merged 1 commit into
release/v0.3from
bugfix/676-inline-directory-test-modules
May 24, 2026
Merged

bugfix - preserve per-file inline test module context (#676)#678
dannymeijer merged 1 commit into
release/v0.3from
bugfix/676-inline-directory-test-modules

Conversation

@dannymeijer
Copy link
Copy Markdown
Contributor

@dannymeijer dannymeijer commented May 24, 2026

Summary

This PR fixes directory-level incan test runs for multiple source files that each define one inline module tests: block. The runner now keeps each inline source file as its own generated Rust module, with the generated #[test] harness injected beside that file's declarations. That preserves both parser cardinality and file-local import scope while still batching through one Cargo/libtest harness where the files are compatible. It also bumps the release train to 0.3.0-rc14 and records #676 in the 0.3 release notes.

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: incan test src can now run inline tests from multiple non-test .incn source files without reporting Only one module tests block is allowed per file across the whole directory batch and without Rust E0255 collisions when one inline-tested file imports a public item from another.
  • Internals: cross-file inline source batches now generate one Rust module per source file and mark runner-injected entrypoints reachable per module. Ordinary test batches keep the existing root-harness path.
  • Risks: this changes the generated harness shape for multi-file inline source batches. The regression now covers file-level consts/statics, models, helper functions, and the InQL-style from functions.columns import col collision shape.

Testing / verification

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

Manual verification notes:

  • Reproduced the residual bug - Directory test run treats multiple inline test modules as one file #676 failure before the structural fix: direct file runs passed, while the directory run failed during generated Rust compilation with E0255: the name col is defined multiple times.
  • cargo run --quiet --features cli --bin incan -- test <minimal-repro>/src/functions passed with the InQL-style import/public-name collision shape.
  • cargo test -p incan --test integration_tests e2e_directory_run_preserves_per_file_inline_test_modules_issue676 -- --nocapture passed.
  • cargo test -p incan --test integration_tests e2e_inline_and_imported_surfaces_share_one_project -- --nocapture passed.
  • cargo test -p incan cli::test_runner::execution::tests --quiet passed.
  • cargo fmt --check passed.
  • git diff --check passed.
  • make pre-commit passed.

Docs impact

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

If docs updated:

  • Link(s): workspaces/docs-site/docs/release_notes/0_3.md

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 #676

@incan-triage-bot incan-triage-bot Bot added documentation Improvements or additions to documentation tooling Suggestions, features, or bugs related to the Tooling (CLI/formatter/test runner) labels May 24, 2026
@dannymeijer dannymeijer force-pushed the bugfix/676-inline-directory-test-modules branch from 577e8c8 to 353602a Compare May 24, 2026 20:51
@dannymeijer dannymeijer added this to the 0.3 Release milestone May 24, 2026
@dannymeijer dannymeijer self-assigned this May 24, 2026
@dannymeijer dannymeijer marked this pull request as ready for review May 24, 2026 21:38
@dannymeijer dannymeijer merged commit 3789634 into release/v0.3 May 24, 2026
34 checks passed
@dannymeijer dannymeijer deleted the bugfix/676-inline-directory-test-modules branch May 24, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation tooling Suggestions, features, or bugs related to the Tooling (CLI/formatter/test runner)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug - Directory test run treats multiple inline test modules as one file

1 participant