Skip to content

docs(polymorph-report): align threshold and no-shared notes with the code - #357

Open
DeryFerd wants to merge 1 commit into
qybaihe:mainfrom
DeryFerd:docs/polymorph-report-contract-notes
Open

DeryFerd wants to merge 1 commit into
qybaihe:mainfrom
DeryFerd:docs/polymorph-report-contract-notes

Conversation

@DeryFerd

@DeryFerd DeryFerd commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Two comments in src/engine/polymorph-report.ts disagreed with the code. The options doc advertised a 0.35 default for differentThreshold while comparePolymorphArtifacts used 0.25, and the Kendall-tau doc said a no-shared result is 1 while the implementation returns 0 when fewer than two names are shared.

Callers use expect: "different" to decide whether two hardened builds actually differ. A threshold that is 0.1 lower than documented changes that decision for drift scores between 0.25 and 0.35, and a disjoint export set reads as no reordering rather than as incomparable.

What changed

  • The options comment now says 0.25, matching the code.
  • The Kendall-tau comment now says 0 when fewer than two names are shared and no longer claims 1 for the disjoint case.

Scope

Comments only. No runtime code, thresholds or returned metrics changed. The existing tests for identical, reversed, partially inverted and empty inputs remain the contract.

Verification

  • npx vitest run tests/polymorph-report.test.ts passes, 8 tests.

…code

The JSDoc advertised a 0.35 different-threshold default while the implementation uses 0.25, and described a no-shared Kendall-tau result as 1 while the code returns 0. Document the actual behaviour so callers calibrate expect=different correctly.
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.

1 participant