Skip to content

style: align outliers in number/float32/base with namespace majority patterns#11816

Draft
Planeshifter wants to merge 4 commits intodevelopfrom
philipp/drift-number-float32-base-2026-04-27
Draft

style: align outliers in number/float32/base with namespace majority patterns#11816
Planeshifter wants to merge 4 commits intodevelopfrom
philipp/drift-number-float32-base-2026-04-27

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

Aligning outliers in number/float32/base with namespace majority patterns (random namespace pick, seed 20260427).

This PR was produced by an automated cross-package drift-detection routine. For each feature shared across the namespace's 18 sibling packages, the routine computed the majority pattern at a 75% conformance threshold, validated each outlier through three independent review agents, and grouped the surviving mechanical fixes into one commit per outlier package.

Namespace summary

  • Target: number/float32/base
  • Members analyzed: 18 (none autogenerated)
  • Random seed: 20260427
  • Selection pool: 51 public namespaces with 10–25 members (full random pool was 101; bracketed by size for session tractability — documented in the local report)
  • Features with clear majority (≥75% conformance): file tree, package.json keys, package.json directories keys, README H2 sections (Usage, Examples, See Also), lib/index.js require-alias variable name, validationPrologue (empty across all members), errorConstruction (none across all members except from-binary-string which already uses format).
  • Features without clear majority (excluded): native-addon scaffolding (binding.gyp, manifest.json, include/, src/, gypfile, benchmark.native.js, test.native.js) — all sit at 12/18 = 66.7% because the namespace cleanly splits into NAPI vs. non-NAPI subgroups; ## C APIs and ## Notes README sections similarly track the NAPI split rather than a namespace-wide convention.

Per-outlier corrections

number/float32/base/to-int32

Renamed the local lib/index.js require alias from float32ToInt32 to main. The var main = require('./main.js') form is shared by 14 of 17 non-assert siblings (82.4%). The exported value is unchanged; nothing else in the package references the inner alias.

number/float32/base/to-uint32

Same drift as to-int32: renamed float32ToUint32 to main in lib/index.js. Brings the file into line with the 82.4% majority. No behavior change.

number/float32/base/to-float16

Populated the empty <section class="related"> block in README.md with a See Also link to the parallel @stdlib/number/float64/base/to-float16 and added the matching <related-links> reference. The ## See Also section is present in 14 of 18 namespace packages (77.8%); the convention is a link to the float64 counterpart, which exists for this package.

number/float32/base/ulp-difference

Same drift as to-float16: populated the empty <section class="related"> with a See Also link to @stdlib/number/float64/base/ulp-difference and filled the existing <related-links> placeholder. Brings the README in line with the 77.8% namespace majority.

Validation

Each candidate cleared three independent reviews:

  • Semantic review (Agent 1): confirmed each outlier reflects unintentional drift rather than a genuine semantic difference. Rejected to-float16/lib/index.js (the var builtin alias is required by the polyfill dispatch) and significand See Also (no parallel float64/base/significand exists, so the conventional sibling link is unavailable).
  • Cross-reference review (Agent 2): verified that no test, example, benchmark, .d.ts file, or sibling package documentation depends on the deviating behavior. The index.js aliases are local to the file body; the README additions are documentation-only.
  • Structural review (Agent 3): confirmed the majority patterns are genuine namespace conventions (not plurality noise) and that the proposed templates match canonical siblings (signbit, identity, from-word, to-word).

Deliberately excluded:

  • to-float16/lib/index.jsvar builtin = require('./main.js') is intentional; main.js exports either Math.f16round or null and index.js dispatches to a polyfill.
  • significand/README.md See Also — no parallel float64/base/significand package exists; choosing alternative links is editorial, not mechanical.
  • assert/ outliers — number/float32/base/assert is a sub-namespace package and intentionally lacks benchmark/, lib/main.js, docs/repl.txt, etc.
  • All NAPI-related structural features (66.7% conformance, below the 75% threshold).

Related Issues

No.

Questions

No.

Other

The full drift report (per-feature majority patterns, conformance percentages, per-package outlier list, dropped corrections with reasons, and the random selection criteria) is preserved alongside this PR for audit. The routine deliberately leaves this PR in draft state — a maintainer should audit before promoting to ready.

Checklist

AI Assistance

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was produced by an automated cross-package drift-detection routine driven by Claude Code (Opus 4.7). The routine extracted structural features programmatically, derived majority patterns at a 75% conformance threshold, and validated each outlier through three independent LLM review agents (one Sonnet, two Opus) before applying any change. All file edits were applied mechanically from the validated drift findings; no behavioral logic was generated. A human maintainer is expected to audit before promoting this PR out of draft.



Generated by Claude Code

claude added 4 commits April 27, 2026 16:43
Renamed local require alias in `lib/index.js` to `main` to match the
`var main = require('./main.js')` convention shared by 14/17 sibling
packages (82.4%). The export is unchanged.
Renamed local require alias in `lib/index.js` to `main` to match the
`var main = require('./main.js')` convention shared by 14/17 sibling
packages (82.4%). The export is unchanged.
Populated the empty `<section class="related">` with a link to the
parallel double-precision sibling `@stdlib/number/float64/base/to-float16`
to match the convention shared by 14/18 namespace packages (77.8%).
Added the corresponding `<related-links>` reference block.
Populated the empty `<section class="related">` with a link to the
parallel double-precision sibling `@stdlib/number/float64/base/ulp-difference`
to match the convention shared by 14/18 namespace packages (77.8%).
Filled in the existing `<related-links>` reference block.
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
number/float32/base/to-float16 $\color{red}226/228$
$\color{green}+99.12%$
$\color{red}18/20$
$\color{green}+90.00%$
$\color{green}3/3$
$\color{green}+100.00%$
$\color{red}226/228$
$\color{green}+99.12%$
number/float32/base/to-int32 $\color{green}123/123$
$\color{green}+100.00%$
$\color{green}3/3$
$\color{green}+100.00%$
$\color{green}1/1$
$\color{green}+100.00%$
$\color{green}123/123$
$\color{green}+100.00%$
number/float32/base/to-uint32 $\color{green}123/123$
$\color{green}+100.00%$
$\color{green}3/3$
$\color{green}+100.00%$
$\color{green}1/1$
$\color{green}+100.00%$
$\color{green}123/123$
$\color{green}+100.00%$
number/float32/base/ulp-difference $\color{green}160/160$
$\color{green}+100.00%$
$\color{green}9/9$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}160/160$
$\color{green}+100.00%$

The above coverage report was generated for the changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants