Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module tools.self_host_03_normalize_declared_source_refs

import std.types { List }
import v2.compiler.source_authority { SourceRef, source_ref_for_storage_path }
import v2.std.cross_tree.import_model { V2Tree }

// declared_source_refs for the 03_normalize behavioral witness only (review 41433 fix): this list
// opts src/v2/compiler/03_normalize.dag's witness entry into the cli_run.rs affected-set selection
Expand All @@ -13,9 +14,9 @@ import v2.compiler.source_authority { SourceRef, source_ref_for_storage_path }
// this selection axis onto all 16 entries; a dedicated per-entry module keeps the axis scoped to
// 03_normalize alone, matching the roster row's module_path and contract entry exactly.

data sn_source_ref: SourceRef = source_ref_for_storage_path(path: "src/v2/compiler/03_normalize.dag")
data sn_source_ref: SourceRef = source_ref_for_storage_path(path: "src/v2/compiler/03_normalize.dag", source_root: V2Tree)

data sn_contract_ref: SourceRef = source_ref_for_storage_path(path: "src/v2/test/claim/self_host_contract/normalize_emitted_contract_test.dag")
data sn_contract_ref: SourceRef = source_ref_for_storage_path(path: "src/v2/test/claim/self_host_contract/normalize_emitted_contract_test.dag", source_root: V2Tree)

// Hand-verified completeness (docs/plans/declared-source-ref-selection-design.md §5.1 flagship):
// every storage path this transport reads from the repository is listed -- the subject .dag and the
Expand Down
12 changes: 8 additions & 4 deletions dag/gunbc/instruments/source_reference_repoint.dag
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ fn repoint_pending_verdict(pending: List<String>) -> ProcessExit {
}

fn repoint_root_tasks() -> List<SourceRootWalkTask> {
source_reference_repoint_roots |> map(path => SourceRootWalkTask { path: path, root: true })
source_reference_repoint_roots |> map(path => SourceRootWalkTask { path: path, root: true, origin: path })
}

// The wet entry: rewrite every file under the roots that still references a moved module.
Expand All @@ -357,10 +357,10 @@ fn repoint() -> ProcessExit {
SourceRootPathsRefused { path: path, kind: kind, cause: cause } =>
exit_failure(reason: join(["source reference repoint: cannot walk ", path, " (", kind, "): ", cause], ""))
SourceRootPathsRead { paths: paths } =>
fold(paths, init: ExitSuccess, f: fn(acc, path) {
fold(paths, init: ExitSuccess, f: fn(acc, walked) {
match acc {
ExitFailure { code, reason } => ExitFailure { code: code, reason: reason }
ExitSuccess => repoint_one_path(path: path)
ExitSuccess => repoint_one_path(path: walked.path)
}
})
}
Expand All @@ -372,6 +372,10 @@ fn repoint_pending() -> ProcessExit {
SourceRootPathsRefused { path: path, kind: kind, cause: cause } =>
exit_failure(reason: join(["source reference repoint: cannot walk ", path, " (", kind, "): ", cause], ""))
SourceRootPathsRead { paths: paths } =>
repoint_pending_verdict(pending: paths |> filter(path => repoint_path_is_pending(path: path)))
repoint_pending_verdict(
pending: paths
|> filter(walked => repoint_path_is_pending(path: walked.path))
|> map(walked => walked.path)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module gunbc.recurring_failure_mode.two_source_files_claiming_one_module_path_misdiagnosed

import std.types { NonEmptyStr }
import std.decl_ref { DeclarationRef, WholeDeclaration }
import gunbc.recurring_failure_mode { RecurringFailureMode }

data two_source_files_claiming_one_module_path_misdiagnosed: RecurringFailureMode = RecurringFailureMode {
identity: "two_source_files_claiming_one_module_path_misdiagnosed" as NonEmptyStr,

receipts: [
"**two source files claiming one module path are not refused as that collision, and the native door reports a later unbound name instead** (INVALID STATE: either two files declare the same module path, or one walked root's layout maps two files onto one tree identity, and ingest continues. HARM: the operator sequences on `resolve_unbound_name_is_declared_elsewhere` at a real token in an innocent module -- DESIGN section 5 silent wrongness wearing a located diagnostic.",

"TRIGGER INCIDENT, lively-bear-908: dag/std/algebra.dag (`module std.algebra`) and src/v2/std/algebra.dag (`module v2.std.algebra`) were loaded under ONE copied source root. Those are DISTINCT declared module paths. What collided was PATH-DERIVED SOURCE-ROOT IDENTITY: v2.compiler.source_authority classified a file as V2Tree from the file's storage spelling. A copied tree `/tmp/copy/src/v2/std/algebra.dag` did not start with `src/`, so both files became DagTree. Widening that classifier to 'contains /src/' moved the same silent misclassification onto a dag path such as `dag/pkg/src/leaf.dag`. Resolve then named a token in std.change as declared elsewhere rather than naming the layout.",

"THE SAME DECLARED PATH IS A SECOND ARM OF THE SAME CLASS. The census already refused a second file declaring one QualifiedName (`closure_census_duplicate_module`), but located only that second file's module node. The first file was unnamed. v1's wall at v1_compiler.cli_run module_path_collision_panic_message names BOTH paths. A refusal that names one of two files is still a misdiagnosis of the collision.",

"DISTINGUISHING FACT: this is not `two_modules_answer_to_one_logical_qualified_name` (a logical-name strip after ingest). It is ingest identity: declared module path, or a tree tag guessed from the file's path, answering for two files as one.",

"RECOGNITION RULE: a native emit or census over a small tree reports `resolve_unbound_name_is_declared_elsewhere` (or any resolve unbound) while two walked files share a declared module path OR a copied layout is tagged by file spelling rather than by the discovering --source-root. The reviewer tell: the diagnostic's file is not one of the two that share the identity.",

"RUNG FOUND AT: OUTSIDE THE LADDER -- silent wrongness. The later diagnostic is typed and located, and it is the wrong subject.",

"CEILING: 3, structurally guaranteed. Ingest can refuse a second file that declares an already-ingested module path, with loci on both files, and can stamp SourceRootRef from the walk origin that discovered the file, refusing when that origin is not a dag or src/v2 tree. It cannot make two files unwritable.",

"NEXT-RUNG TRIGGER: the native CLI, over a two-file tree whose declared module paths collide, refuses `closure_census_duplicate_module` naming both files; a copied single-root argument refuses as unrecognized rather than guessing DagTree; a file under --source-root dag whose path contains /src/ is still DagTree. Sufficient that a copied closure cannot present as an unbound name in a third module. Not satisfied by classifying the file path.",

"CONSUMPTION: this per-class record joins the derived gunbc.recurring_failure_mode.roster recurring_failure_mode_roster.",
],

evidence: [
DeclarationRef { module_path: "v2.compiler.source_authority", decl_name: "admit_source_root_argument", field: WholeDeclaration },
DeclarationRef { module_path: "gunbc.source_root_read", decl_name: "source_root_read", field: WholeDeclaration },
DeclarationRef { module_path: "v2.compiler.self_host.closure_emission", decl_name: "closure_census_duplicate_module_outcome", field: WholeDeclaration },
],
}
Loading
Loading