Skip to content

Commit fdb7656

Browse files
committed
refactor: move package execution facts to review boundary
1 parent 7c4d3a6 commit fdb7656

6 files changed

Lines changed: 28 additions & 16 deletions

File tree

crates/rsscript-compiler/src/package.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ pub(super) use rsscript_project::{
3939
mod analysis;
4040
#[path = "package/review/review_await.rs"]
4141
mod analysis_await;
42-
mod analysis_execution;
42+
mod analysis_execution {
43+
pub(super) use rsscript_package_review::*;
44+
}
4345
mod authorization;
4446
mod check;
4547
// Contract extraction is review-owned. Keep only a private compatibility

crates/rsscript-compiler/src/package/analysis_execution.rs renamed to crates/rsscript-package-review/src/execution_facts.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
use std::collections::BTreeSet;
22

3-
use crate::syntax::ast::{Block, Callee, DataEffect, Expr, Item, Stmt};
3+
use rsscript_syntax::ast::{Block, Callee, DataEffect, Expr, Item, Stmt};
44

5-
use super::{
5+
use crate::PackageSource;
6+
use rsscript_package_model::{
67
PackageAnalysisResourceLifetime, PackageAnalysisResourceTransfer, PackageAnalysisTaskGroup,
7-
PackageReviewFileKind, PackageSource,
8+
PackageReviewFileKind,
89
};
910

10-
pub(super) fn collect_execution_facts(
11+
pub fn collect_execution_facts(
1112
sources: &[PackageSource],
12-
database: &crate::semantic::SemanticDatabase,
13+
database: &rsscript_semantics::SemanticDatabase,
1314
) -> (
1415
Vec<PackageAnalysisResourceLifetime>,
1516
Vec<PackageAnalysisResourceTransfer>,
@@ -366,7 +367,7 @@ fn count_select_arms(block: &Block) -> u32 {
366367
#[cfg(test)]
367368
mod tests {
368369
use super::*;
369-
use crate::syntax::parse_source;
370+
use rsscript_syntax::parse_source;
370371

371372
#[test]
372373
fn records_only_explicit_take_of_with_binding_as_resource_transfer() {

crates/rsscript-package-review/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
//! the compiler for semantic facts.
77
88
mod contract;
9+
mod execution_facts;
910
mod source_set;
1011

1112
pub use contract::*;
13+
pub use execution_facts::*;
1214
pub use source_set::*;
1315

1416
use std::collections::BTreeSet;

crates/rsscript-sdk/tests/architecture.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,10 +1907,15 @@ fn native_package_dependency_model_is_not_owned_by_aot_lowering() {
19071907
&& contract.contains("use rsscript_syntax::ast::"),
19081908
"package contract extraction must use the review-owned session and syntax boundaries directly"
19091909
);
1910-
let manifest_loader = function_source(
1911-
&source_set,
1912-
"pub fn load_package_manifest_with_source(",
1910+
let execution_facts_path = root.join("crates/rsscript-package-review/src/execution_facts.rs");
1911+
assert!(
1912+
execution_facts_path.is_file()
1913+
&& !root
1914+
.join("crates/rsscript-compiler/src/package/analysis_execution.rs")
1915+
.exists(),
1916+
"package resource/task execution facts must be physically owned by the package-review boundary"
19131917
);
1918+
let manifest_loader = function_source(&source_set, "pub fn load_package_manifest_with_source(");
19141919
assert!(
19151920
manifest_loader.contains("capture_project_manifest(package_dir, MANIFEST_MAX_BYTES)"),
19161921
"package-review manifest semantics must consume project-captured manifest bytes"

docs/architecture/adr/0225-own-captured-package-review-inputs-outside-compiler.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ the compiler the physical owner of project/review input representation.
1515
`rsscript-package-review` owns the captured package manifest model,
1616
feature-selected source-set model, bounded loader, and source-level contract
1717
extractor. The latter calls `CompilationSession` and syntax directly rather
18-
than routing semantic facts through compiler-local helpers. The crate depends
18+
than routing semantic facts through compiler-local helpers. It also owns the
19+
neutral resource/task execution-fact collector used by package analysis. The crate depends
1920
on `rsscript-project` for confined/no-follow capture and on
2021
`rsscript-package-model` for versioned file-kind identity; it has no compiler
2122
dependency.

docs/architecture/migration-baseline.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,12 @@ an arbitrary shell executor.
875875
captured package-review execution and its presentation still need to move
876876
to dedicated project/review/AOT crates before this item can close.
877877
The captured manifest/source-set representation and package contract
878-
extractor are now physically owned by `rsscript-package-review`; its
879-
extractor directly uses the semantic `CompilationSession` and syntax
880-
boundary. Compiler package compatibility retains only private forwarding
881-
modules while review execution, policy, lock/check/diff, and the public
882-
compatibility façade continue their staged migration.
878+
extractor, plus neutral resource/task execution-fact collection, are now
879+
physically owned by `rsscript-package-review`; its extractor directly uses
880+
the semantic `CompilationSession` and syntax boundary. Compiler package
881+
compatibility retains only private forwarding modules while review
882+
execution, policy, lock/check/diff, and the public compatibility façade
883+
continue their staged migration.
883884
- [x] **S05.3a — Extract neutral risk facts and calculation.** The review
884885
risk lattice and its pure evidence evaluator now live in
885886
`rsscript-review-core`. Compiler compatibility code collects neutral

0 commit comments

Comments
 (0)