← Back to Pull requests

Normative: Add text modules #4088

Open
eemeli opened this pull request with 33 lines diff across 1 files
View on GitHub
eemeli eemeli commented on Nov 18, 2026 13:29 UTC
Author

This is the Stage 4 PR for proposal-import-text.

Diff: 33 lines (+31 / -2) across 1 files Reviewer: michaelficarra Review duration: 25671m
All Vouch review confidence checks passed
Residual risk 0.03 = Change Risk (0.24) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.24 · 33 lines diff across 1 files
0.24
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.82 · 5 substantive comment(s)
0.82
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
86%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.211
Real PR Conversation Timeline
15 items
github-actions[bot] github-actions[bot] commented on Nov 18, 2026 13:34 UTC
Bot

The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/4088 and as multiple pages at https://tc39.es/ecma262/pr/4088/multipage .

<hidden purpose="for-rewritable-pr-comment-action-use" value="tc39_pr_preview_comment"></hidden>

michaelficarra michaelficarra commented on code on Nov 18, 2026 21:04 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>

          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without a `type` attribute. Similarly, hosts are not prohibited from supporting text modules when imported without a `type` attribute.</p>

This is a subtle normative distinction. When we only had type: "json", saying "without type: "json"" was roughly equivalent to saying "without a type attribute". But now that there's multiple values allowed for type, we want to clearly disallow importing JSON with type: "text" or importing text with type: "json". I'm not sure if the committee was ever presented this consequence, and I'd like you to confirm this behaviour prior to Stage 4 advancement.

eemeli eemeli commented on code on Nov 18, 2026 23:24 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>

I think your proposed change is good, and I'll make sure it's presented to the committee; by my recollection this part has not been specifically discussed in committee.

One detail, though: This is within an <emu-note>, which Ecmarkup presents as "Non-normative explanatory text". However, I can't find any part of ECMA-262 that makes that clear, and its reference to Ecmarkup in the Colophon presents it as subservient to ECMA-262, and not as a normative reference.

Given the style of language we have in notes, I don't think they're intended to be normative, but this seems like something that ought to be made explicit, no?

michaelficarra michaelficarra commented on code on Nov 18, 2026 23:59 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>

You are correct that notes are non-normative: we cannot introduce new normative requirements in notes. But In this case, I think the clarification in the note does directly follow from the normative steps above. It's just making the consequences of those steps explicit for the reader. So I think it's fine as a note.

nicolo-ribaudo nicolo-ribaudo commented on code on Nov 19, 2026 11:12 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>

          <p>The above text requires that hosts support JSON and text modules when imported with the corresponding value for the `type` attribute (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting them when imported without a `type` attribute.</p>

There is also the byte modules proposal that will come at some point, so we can make this note a bit easier to generalize.

nicolo-ribaudo nicolo-ribaudo commented on code on Nov 19, 2026 16:43 UTC
Code Review
spec.html:1
@@ -29026,6 +29026,25 @@ <h1>
           </emu-alg>
         </emu-clause>
 
+        <emu-clause id="sec-create-text-module" type="abstract operation">
+          <h1>
+            CreateTextModule (
+              _source_: a String,
+            ): a normal completion containing a Synthetic Module Record
+          </h1>
+          <dl class="header">
+            <dt>description</dt>
+            <dd>
+              It creates a Synthetic Module Record whose default export is _source_,
+              a String whose value should represent textual data.

              It creates a Synthetic Module Record whose default export is _source_, a String whose value should represent textual data.

eemeli eemeli commented on code on Nov 19, 2026 17:18 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>

My point about notes is that I don't think the ECMA-262 spec actually states that notes are non-normative.

michaelficarra michaelficarra commented on code on Nov 19, 2026 19:08 UTC
Code Review
spec.html:1
@@ -29240,7 +29270,7 @@ <h1>
         <p>The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.</p>
 
         <emu-note>
-          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`.</p>
+          <p>The above text requires that hosts support JSON modules when imported with `type: "json"` (and HostLoadImportedModule completes normally), but it does not prohibit hosts from supporting JSON modules when imported without `type: "json"`. Similarly, hosts are not prohibited from supporting the import of text modules with no type specified.</p>
eemeli eemeli commented on code on Nov 19, 2026 20:00 UTC
Code Review
spec.html:1
@@ -29026,6 +29026,25 @@ <h1>
           </emu-alg>
         </emu-clause>
 
+        <emu-clause id="sec-create-text-module" type="abstract operation">
+          <h1>
+            CreateTextModule (
+              _source_: a String,
+            ): a normal completion containing a Synthetic Module Record
+          </h1>
+          <dl class="header">
+            <dt>description</dt>
+            <dd>
+              It creates a Synthetic Module Record whose default export is _source_,
+              a String whose value should represent textual data.

I couldn't apply this from the web UI (is the spec file too long or something?), but did so manually.

michaelficarra michaelficarra commented on code on Nov 19, 2026 20:24 UTC
Code Review
spec.html:1
@@ -29026,6 +29026,25 @@ <h1>
           </emu-alg>
         </emu-clause>
 
+        <emu-clause id="sec-create-text-module" type="abstract operation">
+          <h1>
+            CreateTextModule (
+              _source_: a String,
+            ): a normal completion containing a Synthetic Module Record
+          </h1>
+          <dl class="header">
+            <dt>description</dt>
+            <dd>
+              It creates a Synthetic Module Record whose default export is _source_,
+              a String whose value should represent textual data.

is the spec file too long or something?

yep, long-standing GitHub bug

michaelficarra michaelficarra approved these changes on Dec 01, 2026 17:22 UTC
Approved Reviewer

Approved these changes.

linusg linusg commented on code on Dec 01, 2026 18:12 UTC
Code Review
spec.html:1
@@ -29102,6 +29102,24 @@ <h1>
           </emu-alg>
         </emu-clause>
 
+        <emu-clause id="sec-create-text-module" type="abstract operation">
+          <h1>
+            CreateTextModule (
+              _source_: a String,
+            ): a normal completion containing a Synthetic Module Record

            ): a Synthetic Module Record

linusg linusg approved these changes on Dec 01, 2026 19:39 UTC
Approved Reviewer

Approved these changes.

nicolo-ribaudo nicolo-ribaudo approved these changes on Dec 01, 2026 20:11 UTC
Approved Reviewer

Approved these changes.

Assignees
eemeli eemeli
Labels
risk: low confidence: 86.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 24.1% (LOW) · Higher = larger blast radius
24.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 86.5% · Lower = rushed or shallow review
86.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 3.3% · Safe to merge
3.3%
Repository