Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
5b2e92f
feat: Initialize TinyColor Go Port project structure and planning doc…
rajeet-04 Jul 31, 2026
0907a71
fix: Update team ownership section with lead usernames
rajeet-04 Jul 31, 2026
78423e3
feat: add Phase 1 compatibility foundation
rajeet-04 Jul 31, 2026
1e15da6
docs: plan Phase 2 parser parity
rajeet-04 Jul 31, 2026
2df5fa8
feat: complete Phase 2 parser parity
rajeet-04 Jul 31, 2026
82b1208
feat: complete Phase 2 parser parity
rajeet-04 Jul 31, 2026
0c2a7e3
fix: resolve Makefile merge conflict
rajeet-04 Jul 31, 2026
813146c
feat: add conversion facade
rajeet-04 Jul 31, 2026
133f1f2
fix: preserve false compatibility results
rajeet-04 Jul 31, 2026
979f25c
feat: add conversion compatibility dispatch
rajeet-04 Jul 31, 2026
2556641
test: add conversion parity corpus
rajeet-04 Jul 31, 2026
38a7483
docs: record Phase 3 parity evidence
rajeet-04 Jul 31, 2026
f1f8a56
docs: design Phase 4 operations
rajeet-04 Jul 31, 2026
a87d1f9
docs: plan Phase 4 operations
rajeet-04 Jul 31, 2026
0899892
test(04-01): add failing modifier and mix regressions
rajeet-04 Jul 31, 2026
a514597
feat(04-01): implement modifiers and mix
rajeet-04 Jul 31, 2026
d71ea12
test(04-02): add modifier adapter failures
rajeet-04 Jul 31, 2026
b1d0798
feat(04-02): dispatch modifiers and mix
rajeet-04 Jul 31, 2026
b322d2c
test(04-02): add modifier and mix differential corpus
rajeet-04 Jul 31, 2026
d2f22c6
fix(04-02): preserve mix original metadata
rajeet-04 Jul 31, 2026
8609f21
test(04-03): add failing readability regressions
rajeet-04 Jul 31, 2026
821ed05
feat(04-03): implement readability operations
rajeet-04 Jul 31, 2026
0c72f8c
test(04-04): add readability adapter failures
rajeet-04 Jul 31, 2026
817ad71
feat(04-04): dispatch readability operations
rajeet-04 Jul 31, 2026
469b9f4
test(04-04): add readability differential corpus
rajeet-04 Jul 31, 2026
651a576
test(04-05): add failing palette regressions
rajeet-04 Jul 31, 2026
5708bfb
feat(04-05): implement ordered palettes
rajeet-04 Jul 31, 2026
8776335
test(04-06): add palette adapter failures
rajeet-04 Jul 31, 2026
c328fa4
feat(04-06): dispatch palette operations
rajeet-04 Jul 31, 2026
7cd0e84
fix(04-06): preserve analogous original metadata
rajeet-04 Jul 31, 2026
796044f
test(04-06): complete palette differential corpus
rajeet-04 Jul 31, 2026
5601b29
docs: record Phase 4 parity evidence
rajeet-04 Jul 31, 2026
ff137ce
docs: restore Phase 1-2 summaries
rajeet-04 Jul 31, 2026
34dc41f
docs: normalize GSD project metadata
rajeet-04 Jul 31, 2026
9e8155b
fix(04): preserve JavaScript amount coercion
rajeet-04 Jul 31, 2026
9d7e74e
fix(04): preserve empty readable fallback semantics
rajeet-04 Jul 31, 2026
8d2cdf3
fix(04): match brighten half-tie rounding
rajeet-04 Jul 31, 2026
5e14c31
fix(04): preserve WCAG option type errors
rajeet-04 Jul 31, 2026
c022dfe
docs(04): remove research trailing whitespace
rajeet-04 Jul 31, 2026
26c3e17
docs(04): record parity regression evidence
rajeet-04 Jul 31, 2026
4060b05
docs: resolve debug phase4-parity-gaps
rajeet-04 Jul 31, 2026
7f3eda1
docs(05): define delivery evidence design
rajeet-04 Jul 31, 2026
4f6f4a2
docs(05): capture delivery decisions
rajeet-04 Jul 31, 2026
7758b43
docs(05): research delivery evidence
rajeet-04 Jul 31, 2026
0451f70
docs(05): add validation strategy
rajeet-04 Jul 31, 2026
244ca14
docs(05): plan delivery evidence
rajeet-04 Jul 31, 2026
df1f9b8
feat(05-01): add human CLI commands
rajeet-04 Jul 31, 2026
02f9ced
build(05-01): add reproducible verification gate
rajeet-04 Jul 31, 2026
a4ad85e
fix(05-01): make verification gate portable
rajeet-04 Jul 31, 2026
bc91502
ci(05-01): verify port and source suite
rajeet-04 Jul 31, 2026
7128a04
docs(05-01): summarize CLI build and CI
rajeet-04 Jul 31, 2026
57e1114
fix(05-01): close delivery review gaps
rajeet-04 Jul 31, 2026
0f746f4
docs(05-01): record final review fixes
rajeet-04 Jul 31, 2026
7e4bfb9
fix(05-01): pin oracle checkout bytes
rajeet-04 Jul 31, 2026
d8ba485
fix(05-01): scope Deno CI to source suite
rajeet-04 Jul 31, 2026
0a9db8b
fix(04): match saturation conversion rounding
rajeet-04 Jul 31, 2026
005f863
docs(debug): resolve fuzz saturation rounding
rajeet-04 Jul 31, 2026
6b4506a
wip: delivery evidence paused at task 1/3
rajeet-04 Aug 1, 2026
0e54f1a
fix(05-02): match exact fuzz parity
rajeet-04 Aug 1, 2026
ad69b3e
test(05-02): record 60-second fuzz session
rajeet-04 Aug 1, 2026
145c1b5
wip: delivery evidence paused at task 3/3
rajeet-04 Aug 1, 2026
2532926
docs(05): record green handoff CI
rajeet-04 Aug 1, 2026
5fe0f65
chore: classify upstream JavaScript fixtures
rajeet-04 Aug 1, 2026
03683ec
perf(05-02): publish shared benchmark evidence
rajeet-04 Aug 1, 2026
9e7e422
docs(05-02): summarize fuzz and benchmark evidence
rajeet-04 Aug 1, 2026
82a9532
docs(05-03): write submission guide and decisions
rajeet-04 Aug 1, 2026
7c2da11
docs(05-03): publish final compatibility evidence
rajeet-04 Aug 1, 2026
1c218b6
docs(05-03): verify local delivery evidence
rajeet-04 Aug 1, 2026
1b8cb44
docs(05): close delivery evidence phase
rajeet-04 Aug 1, 2026
e208bd1
fix(compat): preserve formats and percent inputs
rajeet-04 Aug 1, 2026
a29a152
fix(tinycolor): match percentage output and equality
rajeet-04 Aug 1, 2026
d5faef2
fix(tinycolor): brighten rounded RGB snapshots
rajeet-04 Aug 1, 2026
a98ecbd
docs(debug): record full-range parity fixes
rajeet-04 Aug 1, 2026
57df184
fix(compat): forward fromRatio options
rajeet-04 Aug 1, 2026
0b685e2
fix(parser): match compressed reverse names
rajeet-04 Aug 1, 2026
e918b46
fix(tinycolor): match JavaScript numeric precision
rajeet-04 Aug 1, 2026
5cbb668
docs(decisions): record analogous safety divergence
rajeet-04 Aug 1, 2026
97a9173
docs: design original-suite Go bridge
rajeet-04 Aug 1, 2026
4216268
docs: plan original-suite Go bridge
rajeet-04 Aug 1, 2026
84e5a93
feat(compat): add one-request bridge mode
rajeet-04 Aug 1, 2026
d1dbd49
feat(compat): expose original-suite operations
rajeet-04 Aug 1, 2026
c5d281b
test(original): add Go-backed TinyColor facade
rajeet-04 Aug 1, 2026
deb181c
test(original): gate Go-backed source suite
rajeet-04 Aug 1, 2026
8a49f08
docs: publish original-suite Go evidence
rajeet-04 Aug 1, 2026
48a74ae
fix: Update team ownership section with lead usernames
xthxr Jul 31, 2026
bdf4e32
feat: add Phase 1 compatibility foundation
xthxr Jul 31, 2026
328a54c
docs: plan Phase 2 parser parity
xthxr Jul 31, 2026
8188db6
feat: complete Phase 2 parser parity
xthxr Jul 31, 2026
85f9350
feat: add conversion facade
mrashis06 Jul 31, 2026
ba3d348
fix: preserve false compatibility results
mrashis06 Jul 31, 2026
28a9568
feat: add conversion compatibility dispatch
mrashis06 Jul 31, 2026
09d1b54
test: add conversion parity corpus
mrashis06 Jul 31, 2026
5eb75bc
docs: record Phase 3 parity evidence
rajeet-04 Jul 31, 2026
8744a6b
docs: design Phase 4 operations
DeepaliSingh10 Jul 31, 2026
7b4f8e0
docs: plan Phase 4 operations
DeepaliSingh10 Jul 31, 2026
e19161c
test(04-01): add failing modifier and mix regressions
rajeet-04 Jul 31, 2026
282d73c
feat(04-01): implement modifiers and mix
rajeet-04 Jul 31, 2026
38deb79
test(04-02): add modifier adapter failures
rajeet-04 Jul 31, 2026
e587aef
feat(04-02): dispatch modifiers and mix
xthxr Jul 31, 2026
dce6537
test(04-02): add modifier and mix differential corpus
xthxr Jul 31, 2026
6bfb9ca
fix(04-02): preserve mix original metadata
mrashis06 Jul 31, 2026
a63fc93
test(04-03): add failing readability regressions
rajeet-04 Jul 31, 2026
4bb3834
feat(04-03): implement readability operations
xthxr Jul 31, 2026
92a55da
test(04-04): add readability adapter failures
mrashis06 Jul 31, 2026
c9af2c5
feat(04-04): dispatch readability operations
xthxr Jul 31, 2026
1ea6b79
test(04-04): add readability differential corpus
rajeet-04 Jul 31, 2026
d834de6
test(04-05): add failing palette regressions
rajeet-04 Jul 31, 2026
5e4860d
feat(04-05): implement ordered palettes
mrashis06 Jul 31, 2026
e0920bd
test(04-06): add palette adapter failures
mrashis06 Jul 31, 2026
ae9e00f
feat(04-06): dispatch palette operations
mrashis06 Jul 31, 2026
191d779
fix(04-06): preserve analogous original metadata
mrashis06 Jul 31, 2026
0df188b
test(04-06): complete palette differential corpus
rajeet-04 Jul 31, 2026
294da04
docs: record Phase 4 parity evidence
rajeet-04 Jul 31, 2026
7b183d9
docs: restore Phase 1-2 summaries
DeepaliSingh10 Jul 31, 2026
d25d206
docs: normalize GSD project metadata
DeepaliSingh10 Jul 31, 2026
b2348d9
fix(04): preserve JavaScript amount coercion
xthxr Jul 31, 2026
0527127
fix(04): preserve empty readable fallback semantics
rajeet-04 Jul 31, 2026
d7d60b9
fix(04): match brighten half-tie rounding
rajeet-04 Jul 31, 2026
bf78e20
fix(04): preserve WCAG option type errors
mrashis06 Jul 31, 2026
cc33c57
docs(04): remove research trailing whitespace
DeepaliSingh10 Jul 31, 2026
f7b0e34
docs(04): record parity regression evidence
DeepaliSingh10 Jul 31, 2026
6f61181
docs: resolve debug phase4-parity-gaps
DeepaliSingh10 Jul 31, 2026
1c6cbac
docs(05): define delivery evidence design
DeepaliSingh10 Jul 31, 2026
53a986b
docs(05): capture delivery decisions
DeepaliSingh10 Jul 31, 2026
5738575
docs(05): research delivery evidence
DeepaliSingh10 Jul 31, 2026
8743584
docs(05): add validation strategy
DeepaliSingh10 Jul 31, 2026
14d2579
docs(05): plan delivery evidence
DeepaliSingh10 Jul 31, 2026
d2ab28d
feat(05-01): add human CLI commands
mrashis06 Jul 31, 2026
025d11d
build(05-01): add reproducible verification gate
mrashis06 Jul 31, 2026
f7ab93b
fix(05-01): make verification gate portable
rajeet-04 Jul 31, 2026
f55a465
ci(05-01): verify port and source suite
rajeet-04 Jul 31, 2026
416634b
docs(05-01): summarize CLI build and CI
DeepaliSingh10 Jul 31, 2026
1a91e1e
fix(05-01): close delivery review gaps
rajeet-04 Jul 31, 2026
abd6293
docs(05-01): record final review fixes
DeepaliSingh10 Jul 31, 2026
d5a2c81
fix(05-01): pin oracle checkout bytes
mrashis06 Jul 31, 2026
35199e7
fix(05-01): scope Deno CI to source suite
mrashis06 Jul 31, 2026
bb32f71
fix(04): match saturation conversion rounding
mrashis06 Jul 31, 2026
7203117
docs(debug): resolve fuzz saturation rounding
DeepaliSingh10 Jul 31, 2026
78a6b69
wip: delivery evidence paused at task 1/3
rajeet-04 Aug 1, 2026
547a098
fix(05-02): match exact fuzz parity
rajeet-04 Aug 1, 2026
a871860
test(05-02): record 60-second fuzz session
rajeet-04 Aug 1, 2026
2815609
wip: delivery evidence paused at task 3/3
rajeet-04 Aug 1, 2026
ebabb67
docs(05): record green handoff CI
DeepaliSingh10 Aug 1, 2026
d57acc4
chore: classify upstream JavaScript fixtures
rajeet-04 Aug 1, 2026
666264e
perf(05-02): publish shared benchmark evidence
rajeet-04 Aug 1, 2026
02c625b
docs(05-02): summarize fuzz and benchmark evidence
DeepaliSingh10 Aug 1, 2026
eff6981
docs(05-03): write submission guide and decisions
DeepaliSingh10 Aug 1, 2026
b5dbb5d
docs(05-03): publish final compatibility evidence
DeepaliSingh10 Aug 1, 2026
6692093
docs(05-03): verify local delivery evidence
DeepaliSingh10 Aug 1, 2026
7f0e925
docs(05): close delivery evidence phase
DeepaliSingh10 Aug 1, 2026
1f22aa2
fix(compat): preserve formats and percent inputs
mrashis06 Aug 1, 2026
ca0acd5
fix(tinycolor): match percentage output and equality
rajeet-04 Aug 1, 2026
e672f60
fix(tinycolor): brighten rounded RGB snapshots
rajeet-04 Aug 1, 2026
db5bfb4
docs(debug): record full-range parity fixes
rajeet-04 Aug 1, 2026
162ea15
fix(compat): forward fromRatio options
rajeet-04 Aug 1, 2026
052d2a2
fix(parser): match compressed reverse names
rajeet-04 Aug 1, 2026
3a8c4a7
fix(tinycolor): match JavaScript numeric precision
mrashis06 Aug 1, 2026
1212276
docs(decisions): record analogous safety divergence
DeepaliSingh10 Aug 1, 2026
db28f01
docs: design original-suite Go bridge
DeepaliSingh10 Aug 1, 2026
b857089
docs: plan original-suite Go bridge
DeepaliSingh10 Aug 1, 2026
07a8f09
feat(compat): add one-request bridge mode
xthxr Aug 1, 2026
961127d
feat(compat): expose original-suite operations
xthxr Aug 1, 2026
d2de678
test(original): add Go-backed TinyColor facade
xthxr Aug 1, 2026
50ee306
test(original): gate Go-backed source suite
mrashis06 Aug 1, 2026
4ab236d
docs: publish original-suite Go evidence
DeepaliSingh10 Aug 1, 2026
bd94dd5
Merge branch 'rajeet' of https://github.com/rajeet-04/TinyColor into …
rajeet-04 Aug 3, 2026
6885b30
docs: add GitHub Codespaces setup
rajeet-04 Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "TinyColor Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.26-bookworm",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "22"
},
"ghcr.io/devcontainers-extra/features/deno:1": {}
},
"postCreateCommand": "make build",
"customizations": {
"vscode": {
"extensions": [
"golang.Go"
]
}
}
}
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mod.js text eol=crlf
test.js text eol=crlf
tinycolor.js text eol=crlf
bench/*.jsonl text eol=lf

# Keep upstream oracle and published JavaScript copies in the repository for
# differential testing, but exclude them from the implementation language chart.
mod.js linguist-vendored
test.js linguist-vendored
tinycolor.js linguist-vendored
npm/** linguist-vendored
dist/** linguist-generated
42 changes: 0 additions & 42 deletions .github/workflows/deno.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: TinyColor Go port

on:
push:
pull_request:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.26'
- uses: actions/setup-node@v4
with:
node-version: '24'
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- run: make verify
- run: deno test test.js
- run: make build
- uses: actions/upload-artifact@v4
with:
name: tinycolor-linux-amd64
path: bin/tinycolor
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ node_modules
.vscode
cov_profile
cov_profile.lcov
.cache/
bin/
25 changes: 25 additions & 0 deletions .planning/PROJECT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# TinyColor Go Port

## What This Is

Create a fresh Go port of the local `bgrins/TinyColor` checkout with behavioral
parity demonstrated through unchanged-source differential testing.

## Core Value

Observable behavior from the pinned TinyColor checkout is the specification;
the Go port is accepted only when exact differential evidence agrees.

## Requirements

- The upstream JavaScript source is untouched.
- Go handles every behavior covered by the defined compatibility corpus.
- A reproducible command reports compatibility results and mismatch details.
- A documented Go API and CLI are usable from a clean checkout.
- CI, benchmarks, attribution, and known differences are present.

## Constraints

- Target source: local `mod.js` / `test.js`; MIT attribution retained.
- Target language: Go 1.26+; standard library first.
- Node and Deno are available as local oracle runtimes.
22 changes: 22 additions & 0 deletions .planning/REQUIREMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Requirements

## Functional

- **PAR-01:** Parse all string formats and object forms accepted by local TinyColor.
- **PAR-02:** Preserve validation, format, original-input, clamping, wrapping, and alpha behavior.
- **FMT-01:** Reproduce color conversion and every documented output representation.
- **OPS-01:** Reproduce mutation, utilities, readability, and palette operations.
- **EQV-01:** Compare Go and local JavaScript behavior through a reusable differential harness.
- **DEL-01:** Provide Go API, CLI, CI, benchmarks, documentation, and attribution.

## Quality

- **QLT-01:** Do not edit the JavaScript source or source tests to achieve parity.
- **QLT-02:** Record every mismatch with complete reproducer and owner.
- **QLT-03:** Keep checks reproducible from a clean checkout.

## Out of scope

New CSS color syntaxes, a web UI, package publication, and compatibility with a
different TinyColor version.

96 changes: 96 additions & 0 deletions .planning/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Roadmap: TinyColor.js to Go

## Overview

Build a separate, evidence-backed Go port while preserving this checkout as an
immutable JavaScript behavioral oracle. Work moves from an executable oracle,
through parsing and observable output, to operations and delivery proof.

## Phases

- [x] **Phase 1: Foundation and Oracle** - Establish the Go module and a reproducible Node-to-Go differential baseline.
- [x] **Phase 2: Parsing and Color State** - Match accepted inputs and normalized TinyColor state.
- [x] **Phase 3: Conversion and Representation** - Match conversion, output, and analysis behavior.
- [x] **Phase 4: Operations and Palettes** - Match manipulation, readability, and color-combination behavior.
- [x] **Phase 5: Delivery Evidence** - Ship the CLI, CI, benchmarks, and submission documentation.

## Phase Details

### Phase 1: Foundation and Oracle
**Goal**: A contributor can run the same JSONL request against local `mod.js` and the Go runner, obtain a structured comparison report, and see the upstream files remain untouched.
**Depends on**: Nothing (first phase)
**Requirements**: [EQV-01, QLT-01, QLT-03]
**Success Criteria**:
1. `src/` builds as an independent module without changing JavaScript source files.
2. Node and Go runners accept and emit the documented JSONL request/response protocol.
3. A differential command reports case count, mismatch count, and complete mismatch records.
**Plans**: 1 plan (complete 2026-08-01)

Plans:
- [x] 01-01: Create the Go module, JSONL runners, smoke corpus, and baseline report.

### Phase 2: Parsing and Color State
**Goal**: Go accepts the same supported TinyColor inputs and retains the same validity, format, alpha, and normalized color state.
**Depends on**: Phase 1
**Requirements**: [PAR-01, PAR-02, QLT-02]
**Success Criteria**:
1. Hex, RGB(A), HSL(A), HSV(A), CSS names, transparent, and object inputs produce matching state.
2. Permissive syntax, boundary values, invalid input, and alpha normalization match the oracle corpus.
3. Every discovered parser mismatch has a deterministic regression record.
**Plans**: 2 plans (complete 2026-08-01)

Plans:
- [x] 02-01: Replace Phase 1 fixed inputs with normalized color/model and HEX/RGB/name parsing.
- [x] 02-02: Add HSL/HSV/object parsing and parser differential corpus.

### Phase 3: Conversion and Representation
**Goal**: Go exposes TinyColor-equivalent conversion, string formatting, format fallback, and color analysis.
**Depends on**: Phase 2
**Requirements**: [FMT-01, QLT-02]
**Success Criteria**:
1. RGB, percentage RGB, HSL, HSV, hex, hex8, name, filter, and generic string outputs match exactly.
2. Brightness, luminance, equality, cloning, and random behavior have documented parity cases.
3. No undocumented floating-point tolerance masks an observable mismatch.
**Plans**: 2 plans (complete 2026-08-01)

Plans:
- [x] 03-01-PLAN.md — Implement B's source-equivalent conversion, representation, and analysis facade.
- [x] 03-02-PLAN.md — Add C's JSONL dispatch, differential corpus, and compatibility evidence.

### Phase 4: Operations and Palettes
**Goal**: Go matches TinyColor's stateful modifiers, static utilities, readability checks, and palette ordering.
**Depends on**: Phase 3
**Requirements**: [OPS-01, QLT-02]
**Success Criteria**:
1. Modifiers preserve default, zero, clamping, wrapping, alpha, and mutation behavior.
2. Readability and most-readable operations match WCAG option defaults.
3. Every palette operation returns source-equivalent colors in source order.
**Plans**: 6 plans (complete 2026-08-01)

Plans:
- [x] 04-01 through 04-06: Typed operations, WCAG readability, palettes, compatibility dispatch, and differential evidence.

### Phase 5: Delivery Evidence
**Goal**: A judge can clone the project, verify parity evidence, use a Go CLI, and understand the migration and its limitations.
**Depends on**: Phase 4
**Requirements**: [DEL-01, QLT-03]
**Success Criteria**:
1. CI runs format, vet, Go tests, and the differential smoke report.
2. The CLI supports parse, convert, lighten, palette, and contrast, including JSON output.
3. Benchmarks, documentation, license attribution, team work, and known differences are complete.
**Plans**: 3 plans (complete 2026-08-01)

Plans:
- [x] 05-01: Add the human CLI, reproducible build/verification gate, Docker artifact, and CI.
- [x] 05-02: Publish differential fuzz and shared-workload benchmark evidence.
- [x] 05-03: Publish judge-facing documentation and verify local/public delivery evidence.

## Progress

| Phase | Plans Complete | Status | Completed |
|---|---|---|---|
| 1. Foundation and Oracle | 1/1 | Complete | 2026-08-01 |
| 2. Parsing and Color State | 2/2 | Complete | 2026-08-01 |
| 3. Conversion and Representation | 2/2 | Complete | 2026-08-01 |
| 4. Operations and Palettes | 6/6 | Complete | 2026-08-01 |
| 5. Delivery Evidence | 3/3 | Complete | 2026-08-01 |
44 changes: 44 additions & 0 deletions .planning/STATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Project State

**Updated:** 2026-08-01

## Current Position

- Phase 5 of 5: Delivery Evidence — complete.
- All three Phase 5 plans and all milestone implementation plans are complete.
- Remaining human submission action: record, upload, and link the five-minute demo video.

## Verified Evidence

- Public repository: https://github.com/rajeet-04/TinyColor
- Unauthenticated `ls-remote` returned branch `rajeet` at
`1c218b669d192e37b7019b08395cf348410dde79`.
- GitHub Actions run 30686980719 passed `make verify`, Deno, build, and artifact
upload for that exact commit:
https://github.com/rajeet-04/TinyColor/actions/runs/30686980719
- Immutable JavaScript oracle hashes: 3/3 verified.
- Exact corpora: smoke 9/9, HEX/RGB 26/26, parser 23/23, conversion 35/35,
operations 71/71; 164/164 total and zero mismatches.
- Go tests/vet and 15 Node tests pass.
- Immutable Deno source suite: 45 passed, 0 failed, 1 ignored.
- Byte-identical original suite against native Go: 45 passed, 0 failed, 1 ignored.
- Differential fuzz evidence: 60.012 seconds, seed 20260801, 1,091,630 cases,
zero divergences.
- Shared benchmark: 20 cold starts and 1,000 persistent requests per runtime,
with startup p99, latency p99, throughput, and peak RSS recorded.
- Go `unsafe` source occurrences: 0.

## Recent Decisions

- Use the pinned V8-derived 8-bit luminance transfer table for exact `Math.pow` parity.
- Apply TinyColor's sub-one RGB rounding once at the `FromCompat` boundary.
- Keep fuzz comparisons exact and normalize benchmark workload newlines before hashing.
- Never claim external evidence until public access and exact-commit CI are observed.
- Use a test-only synchronous facade to run unchanged source assertions against
the native Go binary without duplicating TinyColor algorithms.

## Session Continuity

Last session: 2026-08-01
Stopped at: Phase 5 complete; demo video remains a human submission action.
Resume file: none
15 changes: 15 additions & 0 deletions .planning/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"project": "tinycolor-go-port",
"source_oracle": "mod.js",
"source_tests": "test.js",
"target_language": "go",
"commit_docs": true,
"research_enabled": true,
"plan_checker_enabled": true,
"nyquist_validation_enabled": true,
"workflow": {
"nyquist_validation": true,
"ui_phase": false,
"ui_safety_gate": false
}
}
61 changes: 61 additions & 0 deletions .planning/debug/fuzz-readability-precision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
status: resolved
trigger: "Investigate and fix next deterministic Phase 5 fuzz parity mismatch: readability for {r:127,g:64,b:15,a:0} against '#80007f' returns 1.188086751976723 in JavaScript and 1.1880867519767233 in Go."
created: 2026-08-01T00:00:00+05:30
updated: 2026-08-01T06:00:00+05:30
---

## Current Focus

hypothesis: resolved: exact V8-derived results are required for the finite 8-bit luminance domain
test: exact readability regression, 71-case operations corpus, and broad seeded fuzz harness
expecting: exact parity with no tolerance or output rounding
next_action: record and validate the required 60-second seed-20260801 fuzz log

## Symptoms

expected: JavaScript and Go exact JSON response match for readability; JavaScript returns 1.188086751976723.
actual: Go returns 1.1880867519767233; broad seed-1 one-second fuzz run has 388 divergences and fuzz-32 is first.
errors: exact floating-point JSON mismatch for operation readability
reproduction: exact request is in .superpowers/sdd/05-02-PLAN/task-1-report.md; run through both adapters and typed Readability with input {r:127,g:64,b:15,a:0}, args.other '#80007f'.
started: uncovered after the fuzz saturation root-cause fix.

## Eliminated

## Evidence

- timestamp: 2026-08-01T00:01:00+05:30
checked: repository status and protected fuzz files
found: fuzz/README.md is modified and fuzz/harness.mjs plus fuzz/harness.test.mjs are untracked pre-existing work
implication: preserve those files without editing, staging, reverting, or narrowing them
- timestamp: 2026-08-01T00:01:00+05:30
checked: debug knowledge base
found: only prior saturation rounding case exists and its keywords/root cause do not match readability precision
implication: no known-pattern candidate applies
- timestamp: 2026-08-01T00:01:00+05:30
checked: complete JavaScript getLuminance/readability and Go Color.Luminance/Readability implementations plus callers
found: both round normalized RGB before luminance and use the same WCAG constants; Go caches the two luminances once while JavaScript recomputes them for Max and Min; IsReadable and MostReadable both call shared Readability
implication: parsing and exact arithmetic intermediates must be measured before changing the shared method
- timestamp: 2026-08-01T00:02:00+05:30
checked: exact requests through both adapters
found: normalized RGB inspections are identical; first luminance is identical at 0.08213307169664993, but #80007f luminance is 0.06121500300950977 in JavaScript and 0.061215003009509765 in Go
implication: parsing, alpha, and final ratio ordering are ruled out; the first divergence is inside shared Color.Luminance for integer RGB 128,0,127
- timestamp: 2026-08-01T00:03:00+05:30
checked: new exact typed regression and exact operations JSONL row before production changes
found: typed test fails with 1.1880867519767233 and corpus has exactly one mismatch at readability-object-precision
implication: RED is confirmed and independently covers both public Go API and adapter parity
- timestamp: 2026-08-01T00:04:00+05:30
checked: channel-level gamma expansion raw float bits for #80007f
found: channel 128 has identical normalized/base input but V8 Math.pow yields bits 3fcba1511e3e632d while Go math.Pow yields 3fcba1511e3e632c; channel 127 matches at 3fcb2a60a1263b0a
implication: the root cause is Go math.Pow not reproducing the JavaScript oracle's power rounding, not weighted luminance summation
- timestamp: 2026-08-01T00:04:00+05:30
checked: all nonlinear integer channels 11 through 255
found: 93 of 245 channel powers differ, with signed deltas in both directions and two cases differing by two ULPs
implication: unconditional Nextafter or decimal/output rounding would be incorrect; the fix must reproduce the bounded transfer function or V8 algorithm

## Resolution

root_cause: V8 Math.pow and Go math.Pow produce different final float64 bits for 93 of TinyColor's 245 nonlinear 8-bit channel values.
fix: Color.Luminance now uses a finite V8-derived 256-entry transfer table. The follow-on palette divergences were fixed at their shared constructor boundary by applying TinyColor's sub-one channel rounding and bound01 normalization.
verification: The exact regression passed; all 71 operations cases matched; the full local verify equivalent passed; seed 1 ran for 1.008 seconds across 14,778 cases with zero divergences.
files_changed: [src/tinycolor/luminance.go, src/tinycolor/color.go, src/tinycolor/operations_test.go, src/cmd/pow-debug/main.go]
Loading