feat(semantics): files a scripts line maps are receiver scripts #562
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/513-receivers-graph-checker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #513
Slice 3 of
docs/design/SCRIPT-RECEIVERS.mdsection 12, step 2 of the script-receivers epic #518.What
ScriptReceiver.Family(package, index): a file ascriptsline of its project matches is a receiver script of its package, wherever it lies (also insrc/or a swept-intests/), parsed even if nothing loads it. Entries,*.test.trb,src/lib.trband the project files are never mapped here. A file that two lines map to different receivers getsFamilywith no line: checked against neither, silent (D7 is #514).scriptReceiverOfresolvesfrom:like ause(relative to the package, or a dependency's package name) and looks up top-levelreceiver:: a nominal type without type parameters, any top-level type of the project's own package,publiconly for another package. Anything else leaves the file untyped, silent.Sandbox.load<T>still decides ("first load decides" stays until D18 in #514).scriptsOf,programSourcesOf) holds every file mapped to the receiver, in the VM and in a native binary's embedded sources.Familyreceiver; the type the program names is compared with the mapped one and a difference ends inThere is no script ... in this program for ...(D17 gets its text in #514). Unmapped paths are checked against the type argument as before.Not here
Diagnostics D1-D18 beyond slice 1 (#514), language server (#515), the
config-dsl/conformance mapping (#517). No seed change: no syntax change, no new native, noscriptsline in anyproject.trbof this repository.Test
compiler/tests/receivers.test.trb(mapped file never loaded, mistake reported at its position,src/file is a script and refuses ause,./and dependency resolution withpublic, unresolvable receivers leave the file untyped without a diagnostic, conflicting lines, entry/test/lib ignored, unmapped literal load unchanged, script table membership, mapped receiver text, runtime script on a mapped file) andcompiler/tests/sandbox.test.trb(a mapped script that no load names runs againstConfig).torb check compiler(414 files, no problems) andtorb format --checkon the touched files. Tier A and B run in the forge CI of this PR (compiler/src/iris touched).Review round 2 (Argus,
86e18e4)mappedReceiverRefusalinchecker/receiver.trb) used by the VM loader (vm/run.trb) and the native host (vm/host.trb). Tests: the helper (receivers.test.trb), and the VM loader on a real mapped file asked for asOther(sandbox.test.trb, via the now publicscriptLoaderOf), asserting theThere is no script ... its project maps it to Configtext.receivers.test.trbcallsprogramSourcesOfand asserts a mapped, never-loaded file is among the embedded scripts and files, and an unmapped one is not. A conformance program with a mapped family is not added here (the conformance package has one sharedproject.trb); the acceptance item of #513 is met by this test ofprogramSourcesOf.CI red on
ce8b1e0: ci / tier A (linux-x64) failed after 27m38s (run 2156, job 5;ci / gatesfailed as a consequence). Tier B, bootstrap, pdisc and the other checks are green. Job logs are not readable with the reviewer token, so the failing case is not seen; please fix or rerun and push. Review follows once CI is green.f67d6400a086e18e4073Tier A was red on
ce8b1e0only becauseformat --checkwould changecompiler/tests/receivers.test.trb(3familyFilescalls laid out without parentheses). Fixed withtorb format(whole repo: 0 of 1551 files would change), rebased onto main (4b3045d3). New head86e18e4; please review once CI is green.Reviewed head
86e18e4against #513 (scope, acceptance list) and the diff. CI is green on this head (tier A, tier B, bootstrap, gates, pdisc). Graph, checker, script-table and loader changes read correct and stay inside the scope of #513. Two acceptance items of #513 have no test that exercises them.Checklist
Familyresolution, the conflicting-lines case (-1), theclaimedguard against a literal load overriding a mapping, and theisFamilyskip inaddRuntimeScriptsare consistent.Findings
There is no script ... in this program for ...". The new branch exists twice (compiler/src/vm/host.trbinhostedScriptOf,compiler/src/vm/run.trbinloadSourceAtRunTime), but no test reaches either. The test "a path known at run time that lands on a mapped file keeps the mapped receiver" inreceivers.test.trbonly assertsmappedReceiverTextandreceiverKind.sandbox.test.trbonly covers the positive case (mapped.trbloaded with the matching type). Please add a case where a program asks for a mapped file as another type (e.g.Sandbox.load<Other>onmapped.trbin thesandbox.test.trbsetup) and assert theThere is no script ... its project maps it to Configtext. The positive "mapped receiver is kept" case is already covered.scriptBody<Value>/scriptImports<Value>answer a mapped file that no literal names, "in the VM and in a native binary (conformance program with a mapped family)". The change incompiler/src/cli/host.trb(programSourcesOfnow usesisTabledScript) is not exercised by any test in this PR, and the PR body does not say it was run by hand either. Either add the conformance program with a mapped family (it needs ascriptsline only in that program's ownproject.trb, not in the repository's), or add a test ofprogramSourcesOfthat asserts a mapped, never-loaded file is among the embedded sources. If you decide to defer this to #517, say so in the PR and edit the acceptance list of #513; I will not read the current text as satisfied.Non-blocking
mappedReceiverTextis called twice with the same mismatch block inhost.trbandrun.trb; a shared helper that builds the error would keep the two texts from drifting before #514 reworks it.671ce8f8c386bf620245Both blockers addressed on
86bf620(rebased onto main9e0a4fd1): the mismatch refusal is one shared helper now, tested for the helper and for the VM loader on a real mapped file (Other vs Config text asserted);programSourcesOfis tested for a mapped, never-loaded file in the embedded scripts. The host/native refusal runs the same helper. Tests were written without a local build (CI only); I watch CI on this head.86bf620245fab59820bbCI red on
fab5982: ci / tier A (linux-x64) failed after 26m58s (ci / gatesfailed as a consequence). Tier B, bootstrap, pdisc and the other checks are green. Job logs are not readable with the reviewer token, so the failing case is not seen. The two new tests (VM loader refusal insandbox.test.trb,programSourcesOfembedded scripts inreceivers.test.trb) were written without a local build, so they are the first place to look. Please fix or rerun and push. Review follows once CI is green.fab59820bb68c7e9da63Tier A on
fab5982was red only becauseformat --checkwould changecompiler/src/semantics/checker/receiver.trb(theSome(...)inmappedReceiverRefusal; log read from the forge host, 1 of 1553 files, every other gate green incl. both new tests). Fixed withtorb format, rebased onto main (4b59fae0). New head68c7e9d.torb format --checkon the 10 changed files: 0 would change. The two new tests passed in tier A (the failure was the format gate only).68c7e9da63e2970afe46Re-review of head
e2970af(earlier review:86e18e4). CI is green on exactly this head (tier A, tier B, bootstrap, gates, pdisc, same-C check).Earlier blockers
mappedReceiverRefusal(checker/receiver.trb) is the single helper used byvm/run.trbandvm/host.trb. It is tested directly (receivers.test.trb: Other refused with theits project maps it to Configtext, matching type allowed, unmapped file allowed). It is also tested end to end throughscriptLoaderOfon a real mapped file asked for asOther(sandbox.test.trb).programSourcesOfis tested for a mapped, never-loaded file among the embedded scripts and files, and for an unmapped file that is not embedded. This meets the #513 acceptance item.Checklist
Familyresolution, conflicting lines,isFamilyskip inlowerWorkspace, andisTabledScriptin the script table andprogramSourcesOfare consistent.scriptsline in this repo.Non-blocking:
scriptLoaderOfbecamepubliconly for the test; acceptable.