网络测出了什么
下面每一行都是测量结果,不是观点。每一条都链接到一个已发布的样本,其 contract 在断网的固定容器中执行,你可以自己重跑并反驳结论。
操作系统和运行时来自所链接样本记录的环境;缺少该维度的条目会在筛选时排除。
597 条发现,覆盖 8 个生态。
- cargo
- composer
- gem
- golang
- hex
- npm
- pub
- pypi
样本自述,其契约实测
正在显示已发布样本测得的第 376–400 条(共 568 条)。
-
npm样本契约node · linux/x64core-js@3.49.0
普遍认为A naive expectation is that `Iterator.range` coerces `NaN` arguments to usable numbers, so `Iterator.range(NaN, 10)` would still return an iterable.
实测Calling `Iterator.range` with `NaN` as `start` throws `RangeError` in the patched `core-js` behavior.
-
npm样本契约node · linux/x64commander@15.0.0
普遍认为An option configured with an optional value accepts negative numbers like -1 as its argument regardless of what other short option flags are registered on the command.
实测Passing -1 after an optional-argument option evaluates that option to boolean true and parses -1 as a distinct flag if any single-digit short option is defined on the command hierarchy, because Commander disables negative number heuristics whenever a digit flag exists.
-
npm样本契约node · linux/x64commander@13.1.0
普遍认为Parsing multiple command invocations concurrently with parseAsync on a shared Command instance keeps options isolated within each execution promise.
实测Calling parseAsync on a shared Command instance while an earlier parseAsync execution is suspended at an await overwrites the option store, causing the earlier execution to resume with option values from the later invocation.
-
npm样本契约node · linux/x64commander@15.0.0
普遍认为An option configured with an optional value and a custom argParser coerces a fallback value through argParser when the flag is invoked without an argument on the command line.
实测Option.preset() supplies a fallback value passed to argParser when an optional-value flag is invoked without arguments, preventing Commander from storing boolean true and bypassing custom parser coercion.
-
npm样本契约node · linux/x64bun@1.3.14
普遍认为Pinning bun in package.json should let Node import it as a normal dependency module.
实测bun@1.3.14 has no Node import surface in lockfile metadata, because neither `main` nor `exports` is present even though the package is installed as a dependency.
-
npm样本契约node · linux/x64bun@1.3.14
普遍认为Bun binary APIs receive a typed array's entire backing ArrayBuffer, so passing a subarray with a non-zero offset hashes, compresses, or writes bytes outside the view.
实测Bun.hash produces the same result for a non-zero-offset Uint8Array view and an independent array containing only the view bytes, and a different result for the full backing array
-
npm样本契约node · linux/x64@babel/preset-env@7.26.9
普遍认为Targeting modern environments like Node 22 or setting targets.esmodules to true causes @babel/preset-env to preserve ES module import and export syntax by default without transforming them to CommonJS.
实测Even when targeting modern environments that natively support ES modules such as Node 22 or esmodules: true, @babel/preset-env defaults modules to 'auto' and transforms import and export statements into CommonJS require and exports unless the caller declares supportsStaticESM or modules is explicitly set to false.
-
npm样本契约node · linux/x64@babel/preset-env@8.0.2
普遍认为Targeting modern JavaScript runtimes with @babel/preset-env and default modules: 'auto' preserves native export * as ns syntax because the targeted environments natively support ECMAScript namespace re-exports.
实测When modules is unset or 'auto', @babel/preset-env unconditionally injects transform-export-namespace-from and desugars export * as ns statements even when targeting modern runtimes like Chrome 120 or Node 22, unless modules is explicitly false or the caller declares supportsExportNamespaceFrom.
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为Equivalent inline plugin option objects are reused across transformSync calls, and createConfigItem remains a synchronous convenience API in Babel 8.
实测A ConfigItem created once with createConfigItemSync reuses its plugin descriptor so five transformSync calls execute the factory exactly once
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为Calling babel.transformAsync allows plugin visitor methods to be async functions whose returned Promises are awaited before AST traversal completes and transformed output code is generated.
实测babel.transformAsync completes AST traversal synchronously and generates untransformed output code when a plugin visitor returns a Promise, leaving the Promise un-awaited.
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为transformFromAstSync modifies the provided AST object in place during traversal and populates result.ast with the transformed tree.
实测transformFromAstSync preserves the input AST node unmodified and sets result.ast to null unless cloneInputAst is set to false and ast is set to true.
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为babel.transformSync automatically discovers and loads .babelrc configuration files from the current working directory when transforming code strings.
实测babel.transformSync and babel.loadPartialConfigSync ignore .babelrc configuration files when filename is omitted, defaulting options.babelrc to false
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为Setting configFile: false disables all filesystem configuration loading, while subpackage .babelrc.json configurations are discovered and applied automatically.
实测Setting configFile: false disables only project-wide babel.config.json while leaving file-relative .babelrc.json active, and subpackage .babelrc.json files are ignored under default babelrcRoots: true
-
hex样本契约elixir · linux/x64nimble_pool@1.1.0
普遍认为NimblePool.handle_info/2 follows the same return convention as GenServer.handle_info/2, accepting (message, state) and returning {:noreply, state}, because NimblePool is built on GenServer.
实测Returning {:noreply, worker_state} from handle_info/2 crashes the pool process with CaseClauseError, because NimblePool routes stray messages to each idle worker's handle_info/2, then pattern-matches the result against {:ok, _}, killing the pool and making all subsequent checkouts exit with :noproc.
-
golang样本契约go · linux/x64net/http@go1.26.5
普遍认为Headers set on http.ResponseWriter after calling WriteHeader are included in the HTTP response.
实测Headers set on http.ResponseWriter after calling WriteHeader are omitted from the client response.
-
golang样本契约go · linux/x64net/http@v1.26.5
普遍认为Setting the Host header via http.Request.Header.Set("Host", ...) overrides the Host header sent on the wire by http.Client.
实测req.Header.Set("Host", ...) does not override the wire Host header sent by http.Client
-
golang样本契约go 1.26 · linux/x64gorm.io/gorm@v1.31.2
普遍认为Calling Scopes(Tenant(id)) before Where(...).Or(...) keeps the tenant predicate in force for both OR branches because the scope appears first in the chain.
实测assert Scopes(Tenant(7)).Where("active = ?", true).Or("role = ?", "admin") generates WHERE active = ? OR role = ? AND tenant_id = ?, so SQL precedence allows active rows from other tenants
-
golang样本契约go 1.26 · linux/x64google.golang.org/grpc@v1.83.0
普遍认为A unary client interceptor can call metadata.NewOutgoingContext to add its own field without affecting outgoing metadata the caller already attached.
实测A grpc.NewClient call reaches a manually registered unary service through bufconn, a context dialer, and insecure transport credentials without opening a TCP listener.
-
golang样本契约go 1.26 · linux/x64github.com/spf13/viper@v1.21.0
普遍认为MergeConfigMap treats its argument as immutable input and copies it, so changing or reusing the caller's map after the call cannot alter Viper's configuration.
实测assert MergeConfigMap lowercases both top-level and nested keys in the caller-supplied maps themselves
-
golang样本契约go · linux/x64github.com/golang-jwt/jwt/v5@v5.3.1
普遍认为providing an invalid key type (such as a byte slice instead of an RSA public key) to jwt.Parse during RSA verification returns jwt.ErrTokenUnverifiable or jwt.ErrInvalidKeyType rather than jwt.ErrTokenSignatureInvalid
实测assert jwt.Parse returns jwt.ErrTokenSignatureInvalid when a key of invalid type is provided for RSA verification, rather than ErrTokenUnverifiable or ErrInvalidKeyType directly
-
golang样本契约go · linux/x64github.com/golang-jwt/jwt/v5@v5.3.1
普遍认为Defining a Valid() error method on a custom claims struct in github.com/golang-jwt/jwt/v5 triggers custom validation during parsing, and missing expiration claims cause parsing to fail by default.
实测Defining a Valid() error method on a custom claims struct has no effect in v5 because custom validation requires implementing the jwt.ClaimsValidator interface via a Validate() error method.
-
golang样本契约go · linux/x64github.com/golang-jwt/jwt/v5@v5.3.1
普遍认为A single-element jwt.ClaimStrings slice serializes to a JSON string value by default.
实测Serializing a single-element jwt.ClaimStrings audience produces a JSON array by default because jwt.MarshalSingleStringAsArray is true.
-
golang样本契约go · linux/x64github.com/golang-jwt/jwt/v5@v5.2.2
普遍认为ParseUnverified returns a slice containing all split string segments when parsing a malformed token string with extra dot delimiters.
实测ParseUnverified returns a nil parts slice rather than a populated slice of all split segments when given a token with extra dot delimiters.
-
golang样本契约go · linux/x64github.com/golang-jwt/jwt/v5@v5.3.1
普遍认为Defining a Valid() error method on a custom claims struct validates claims during jwt.ParseWithClaims.
实测jwt.ParseWithClaims silently ignores a custom claims Valid() error method, passing validation unless the struct implements ClaimsValidator with Validate() error.
-
golang样本契约go · linux/x64github.com/go-chi/chi/v5@v5.2.1
普遍认为middleware.AllowContentType rejects POST requests lacking a Content-Type header and ignores Content-Type headers on GET requests.
实测middleware.AllowContentType allows a body-less POST request with an empty Content-Type header through to the handler with HTTP 200 rather than rejecting it based on the HTTP method
如何核对这里的任何一行
打开样本,读它的 contract,然后运行。contract 就是该样本自己的测试:它在断网的固定容器中运行,那次运行的签名回执才是网络所存储的东西。这里没有一条依赖我们对某个库的理解,只依赖这个库实际做了什么。
有些已发布的样例不在这个页面上。它们的契约通过了,样例也是活的 —— 但契约里没有一行能当句子读。像 expect(x).toBe(1) 这样的断言,放在它所检验的那个认知旁边,对读者什么也没说。与其登出没人能读的证据,不如空着。