Skip to content

polyad() is missing from master and published 1.6.0 — the temporary disable (issue #254) was never reverted #281

Description

@dattarajdhatbale

polyad_bug_report.md

BUG REPORT: polyad() — Shipped Feature Silently Disabled and Never Restored

Repository: bgrins/TinyColor
Affects: master branch and published tinycolor2@1.6.0 (npm)
Category: Regression / broken public API (feature present in source, unreachable at runtime)
Severity: Low-to-moderate user impact, high "process failure" significance
Fix size: 3 lines of code + removal of one test skip flag

SUMMARY

tinycolor(color).polyad(n) is documented internally and fully implemented, but is not callable on the current master branch or in the published 1.6.0 npm release. The public-facing method was commented out in a single commit as an explicitly temporary measure, gated on a publishing checklist issue. That issue has since been completed and closed — 1.6.0 has shipped — but the temporary disable was never reverted, and the test suite quietly skips the only test that would have caught this.

This bug was found through differential testing: comparing the behavior implied by the repository's own test specification against the actual runtime behavior of the published package. The test file expects polyad to exist and behave in nine specific ways; the shipped library throws a TypeError for all of them.

STEPS TO REPRODUCE

const tinycolor = require("tinycolor2"); // v1.6.0, or current master
tinycolor("red").polyad(3);
Result: TypeError: tinycolor(...).polyad is not a function

EXPECTED BEHAVIOR

The repository's own test.js already contains the full specification for this feature, but the corresponding test block is marked ignore: true, so it never runs in CI:

polyad() — throws
polyad(-1) — throws
polyad("invalid") — throws
polyad(1) — ff0000
polyad("1") — ff0000
polyad(2) — ff0000, 00ffff
polyad(3) — ff0000, 00ff00, 0000ff
polyad(4) — ff0000, 80ff00, 00ffff, 7f00ff
polyad(5) — ff0000, ccff00, 00ff66, 0066ff, cc00ff

ROOT CAUSE AND TIMELINE

Origin. The polyad(n) concept — a generalization of triad()/tetrad() to any number n of evenly-spaced colors — was introduced via PR #126, "Polyad colors." triad and tetrad were refactored to delegate to an internal polyad(color, number) helper, which still exists in the codebase today and is still used by both.

Disabled. In commit 3eb52ff ("disable polyad until ESM publish has stuck"), the public prototype method polyad was commented out, and its test entry in test.js was marked ignore: true. The commit references issue #254 as the condition for re-enabling it.

The gating issue was resolved. Issue #254, "Task: Publish 1.6.0 to npm," is a release checklist — moving CDN assets into the npm directory, resolving the "tinycolor is not a function" regression reported in issue #249, and removing an ESM warning from the README. All three items are checked off, the issue is closed, and tinycolor2@1.6.0 is live on npm. The stated precondition for re-enabling polyad has been met.

The disable was never reverted. On current master, the public method is still commented out with the same "Disabled until issue #254" note, even though #254 no longer applies. The internal helper and the triad/tetrad wrappers around it are unaffected and continue to work correctly — only the direct, documented entry point is broken.

Because the test is skipped rather than deleted, there is no CI signal indicating the feature is missing — it fails silently for any consumer who calls it directly.

PROPOSED FIX (VERIFIED)

In mod.js (and the equivalent ESM/CJS builds), uncomment the public method:

Before:
// Disabled until #254
// polyad: function (number) {
// return this._applyCombination(polyad, [number]);
// },

After:
polyad: function (number) {
return this._applyCombination(polyad, [number]);
},

In test.js: remove ignore: true from the polyad test block.

Verification performed: Applied the above to current master and ran the full test spec. All 11 checks pass, including all 9 previously-skipped polyad assertions, and triad()/tetrad() remain unaffected. The internal helper's existing validation (isNaN(number) || number <= 0 throws) already satisfies the test's assertThrows expectations, so no additional validation logic is needed.

IMPACT

Any developer who has read the codebase, changelog, or the original PR and reasonably expects polyad(n) to be a public method will hit a runtime TypeError with no indication in current docs that it's disabled.

The fix is fully backward-compatible: it only restores an already-implemented, already-tested method and does not touch triad/tetrad or any other public API.

Reported by: Dattaraj Dhatbale && Swayam Wankhade
GitHub: dattarajdhatbale && swayamwankhade788-cloud
Date: August 2, 2026

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions