Преглед изворни кода

fix(code-runtime): match DUNDER_MEMBER to its distinct-pair contract

The seam's dunder-member test (added in the base seam PR) asserts
`DUNDER_MEMBER.test('____')` is true and `test('__')` is false, but the
regex `/^__.+__$/` rejected `____`: the `.+` demanded a non-empty middle,
while `____` is two adjacent `__` pairs with an empty middle. Widen to
`/^__.*__$/` so a name with distinct leading and trailing `__` pairs
matches whether or not it has a middle, and align the JSDoc. Regenerate
the cordis service catalog for the merged seam source line.
Chinesezjc пре 2 месеци
родитељ
комит
034e4f2d3f
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 1 1
      docs/cordis-catalog/services.md
  2. 3 2
      packages/code-runtime/code-runtime/src/index.ts

+ 1 - 1
docs/cordis-catalog/services.md

@@ -398,7 +398,7 @@ abstract run(request: CodeRunRequest): Promise<CodeRunResult>
 
 Types: [CodeRunRequest](../core-data-structures/code-runtime.md) · [CodeRunResult](../core-data-structures/code-runtime.md)
 
-Source: [`packages/code-runtime/code-runtime/src/index.ts:104`](../../packages/code-runtime/code-runtime/src/index.ts)
+Source: [`packages/code-runtime/code-runtime/src/index.ts:105`](../../packages/code-runtime/code-runtime/src/index.ts)
 
 ## `ctx.commands` — `CommandService`
 

+ 3 - 2
packages/code-runtime/code-runtime/src/index.ts

@@ -59,10 +59,11 @@ export const RESERVED_ERROR_MEMBERS: ReadonlySet<string> = new Set([
 ])
 
 /**
- * Dunder form (`__x__`, non-empty middle): object-protocol slots in Python,
+ * Dunder form (`__x__`, distinct leading and trailing `__` pairs, so at least
+ * four characters; the middle may be empty): object-protocol slots in Python,
  * refused as {@link RESERVED_ERROR_MEMBERS | error members} on every backend.
  */
-export const DUNDER_MEMBER = /^__.+__$/
+export const DUNDER_MEMBER = /^__.*__$/
 
 /**
  * Reserved words of every portable target language (ECMAScript ∪ Python),