网络测出了什么
下面每一行都是测量结果,不是观点。每一条都链接到一个已发布的样本,其 contract 在断网的固定容器中执行,你可以自己重跑并反驳结论。
操作系统和运行时来自所链接样本记录的环境;缺少该维度的条目会在筛选时排除。
597 条发现,覆盖 8 个生态。
- cargo
- composer
- gem
- golang
- hex
- npm
- pub
- pypi
样本自述,其契约实测
正在显示已发布样本测得的第 251–275 条(共 568 条)。
-
npm样本契约node · linux/x64happy-dom@20.11.2
普遍认为A competent reader expects that omitting script-evaluation settings in happy-dom still evaluates inline `<script>` blocks like a browser would.
实测In happy-dom 20.11.2, constructing `Window` without `settings.enableJavaScriptEvaluation` means inline script execution is disabled, so a script that sets `window.__ran = true` leaves `window.__ran` undefined.
-
npm样本契约node · linux/x64jest@30.4.2
普遍认为A strong implementation instinct is that `jest.setSystemTime` accepts any date-like input, including ISO strings, when using fake timers.
实测Calling `jest.setSystemTime` with an ISO string under fake timers throws; it only accepts a `Date` object or a numeric epoch timestamp.
-
npm样本契约node · linux/x64express@4.19.1
普遍认为A seasoned developer expects `app.configure(...)` to remain available in Express 4 as it did in v3.
实测In Express 4.19.1, `app.configure` is undefined and calling `app.configure(...)` throws `TypeError`, showing the v3-style helper no longer exists.
-
npm样本契约node · linux/x64es-toolkit@1.49.0
普遍认为Most callers assume the second argument of `chunk` defaults to 1 when omitted.
实测Calling `chunk([1, 2, 3])` must throw a runtime error because `size` is required.
-
npm样本契约node · linux/x64express@4.19.1
普遍认为Forwarded client IP headers should always be reflected in `req.ip` even when `trust proxy` is disabled.
实测A request to `/ip` without `trust proxy` ignores `X-Forwarded-For` and `req.ip` is not the forwarded client value.
-
npm样本契约node · linux/x64commander@10.0.0
普遍认为A leading space before a positional signature is ignored by Commander, so `program.arguments(' <name>')` is equivalent to `program.arguments('<name>')`.
实测In Commander 10, a leading-space argument signature is not ignored, so parsing `['node', 'app', 'only']` with `new Command().arguments(' <required> [optional]')` throws `commander.missingArgument` and does not accept a single positional argument.
-
npm样本契约node · linux/x64commander@15.0.0
普遍认为When both `--cache` and `--no-cache` are defined, omitting both options should leave `cache` as `true` because the negated form implies a true default.
实测With both `--cache` and `--no-cache`, parsing without either flag leaves `program.opts().cache` as `undefined`, even though the negated option alone would default to true.
-
npm样本契约node · linux/x64bun@1.3.14
普遍认为Calling server.stop() on a Bun.serve HTTP server terminates all active client connections and immediately frees server resources.
实测assert server.pendingRequests is 1 while an in-flight request is being processed by the fetch handler
-
npm样本契约node · linux/x64chalk@6.0.0
普遍认为A caller should get the same kind of rejection for all obviously malformed `chalk.hex(...)` inputs.
实测`chalk.hex('')('x')` also returns black 24-bit ANSI output instead of an error.
-
npm样本契约node · linux/x64bun@1.3.14
普遍认为Bun.password.verify returns false whenever a candidate password fails to verify against an unparseable, legacy, or corrupted hash string.
实测Bun.password.verify throws an Error with code PASSWORD_UNSUPPORTED_ALGORITHM for arbitrary non-empty hash strings and PASSWORD_INVALID_ENCODING for malformed prefixes rather than returning false, while an empty string hash returns false.
-
npm样本契约node · linux/x64@babel/preset-env@8.0.2
普遍认为A shared preset-env tuple can be safely mutated between runs so each transform picks up the latest target value.
实测Calling transformAsync twice with the same preset tuple and then changing `targets` in between does not recompute the tuple for the second run.
-
npm样本契约node 22.18 · linux/x64@babel/core@8.0.1
普遍认为Because @babel/core 8 ships as ESM, `require('@babel/core')` must always throw ERR_REQUIRE_ESM.
实测CommonJS require and ESM import expose the same transformSync function.
-
golang样本契约go 1.26 · linux/x64github.com/gin-gonic/gin@v1.12.0
普遍认为AbortWithStatusJSON immediately returns from the current handler, so code after it cannot run and an explicit return is unnecessary.
实测assert binding an empty required name with ShouldBindJSON lets the handler choose HTTP 422 and a JSON error response
-
npm样本契约node · linux/x64@babel/core@8.0.1
普遍认为Because Babel 8 presents an ES module API, `require('@babel/core')` throws `ERR_REQUIRE_ESM` and only dynamic `import()` can reach `transformSync`.
实测In @babel/core 8.0.1, `require('@babel/core')` returns an API object whose `transformSync` member is a function.
-
npm样本契约node · linux/x64@babel/core@7.29.6
普遍认为A model would likely expect Babel to treat `new super()` like a standard callable super-expression form and return transpiled output instead of throwing.
实测`transformSync` does not return transformed code for `class A extends class {} { constructor() { new super() } }`; it throws a syntax error for this invalid `new super()` form.
-
pub样本契约dart · linux/x64collection@1.18.0
普遍认为IterableExtension.sample provides a randomly ordered subset of elements, meaning that requesting a sample equal to the collection's size will return a shuffled permutation.
实测Before 1.19.0, calling sample() on an iterable requesting its full length returns the elements in their exact original order, rather than a randomly shuffled permutation.
-
gem样本契约ruby · linux/x64zeitwerk@2.6.0
普遍认为Zeitwerk silently skips a file that defines a different constant than its path implies
实测Accessing Foo when lib/foo.rb defines Bar raises Zeitwerk::NameError and the error identifies the missing expected constant Foo.
-
gem样本契约ruby · linux/x64zeitwerk@2.8.3
普遍认为Calling Zeitwerk::Loader.setup multiple times on the same loader raises a Zeitwerk::Error
实测Second call to loader.setup does NOT raise an error
-
gem样本契约ruby · linux/x64zeitwerk@2.8.3
普遍认为Calling loader.reload refreshes the source code for a constant while keeping the same Class object bound to that name, so existing instances continue to satisfy is_a?(Widget) and case/when Widget after reload.
实测After loader.reload, Widget is a different Class object than it was before reload — klass_before.equal?(klass_after) is false — meaning reload undefines the constant and installs a new autoload rather than patching the existing class in place.
-
gem样本契约ruby · linux/x64zeitwerk@2.8.3
普遍认为Calling reload and unload-like operations is enough to refresh or remove constants, so explicit pre-setup reloading configuration should not matter.
实测assert a loader without `enable_reloading` raises `Zeitwerk::ReloadingDisabledError` on `reload` after `setup`, and then `unload` keeps a previously loaded constant in place
-
gem样本契约ruby · linux/x64zeitwerk@2.8.3
普遍认为push_dir without an explicit namespace parameter scopes autoloaded constants under a module matching the directory name.
实测assert push_dir with namespace left unset defaults the root namespace to Object rather than inferring a namespace from the directory name, mapping the directory to Object in all_expected_cpaths and expecting unprefixed top-level constants
-
gem样本契约ruby · linux/x64zeitwerk@2.8.2
普遍认为Loader callback APIs are expected to accept only bare constant names, so `::User` should be rejected as an invalid path.
实测assert `Zeitwerk::Loader#on_load` accepts a leading double-colon constant path and does not raise at registration (`::User`)
-
gem样本契约ruby · linux/x64sorbet-runtime@0.6.13427
普遍认为The legacy `pii:` property option is still accepted as a backward-compatible alias for `sensitivity:` in sorbet-runtime v0.x.
实测defining a `T::Struct` prop with `pii:` raises ArgumentError and the message says `pii:` was renamed to `sensitivity:`
-
gem样本契约ruby · linux/x64sorbet-runtime@0.6.13427
普遍认为Because T::Struct declares prop types and the .new constructor raises TypeError when a value does not match, from_hash — the documented deserialization path — applies the same check and raises on mismatched types.
实测T::Struct.from_hash accepts a String value for a prop declared Integer and returns it unchanged without raising TypeError, while T::Struct.new raises TypeError for the identical input — proving that the deserialization path skips the sig-based check the constructor applies
-
gem样本契约ruby · linux/x64sorbet-runtime@0.6.13427
普遍认为Replacing a `sig`-annotated method with a plain method definition should discard the prior runtime signature metadata so internal signature lookup returns no stale declaration for that method key.
实测After redefining a typed method without adding a new `sig`, `T::Private::Methods.signature_for_method` still returns a `T::Private::Methods::Signature` for that method key instead of clearing it.
如何核对这里的任何一行
打开样本,读它的 contract,然后运行。contract 就是该样本自己的测试:它在断网的固定容器中运行,那次运行的签名回执才是网络所存储的东西。这里没有一条依赖我们对某个库的理解,只依赖这个库实际做了什么。
有些已发布的样例不在这个页面上。它们的契约通过了,样例也是活的 —— 但契约里没有一行能当句子读。像 expect(x).toBe(1) 这样的断言,放在它所检验的那个认知旁边,对读者什么也没说。与其登出没人能读的证据,不如空着。