compare exit-code threshold (0.5) is an undocumented, untested magic number
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- cli
Research direction
Start in packages/ghost/src/cli.ts and inspect both pairwise and --temporal exit paths, then review compare --help and the existing gate.test.ts and sync.test.ts coverage. Done means the shared 0.5 heuristic is named and documented, help text points serious CI users to --gate, and a test pins the cutoff behavior.
Written by the indexing model from the issue text.
Description
Summary
The pass/fail exit code for plain ghost compare uses a hardcoded distance > 0.5 cutoff, inlined twice in packages/ghost/src/cli.ts (the pairwise and --temporal paths). The value is undocumented, untested, and was introduced as a bare literal in the founding commit (618f275) with no rationale in the message or code.
Evidence
- Inline literal at
cli.ts(pairwise exit + temporal exit), no named constant, no comment. - No test pins the cutoff —
gate.test.ts/sync.test.tsonly use0.5as input data, not as a gate assertion. Changing the cutoff breaks zero tests. - The only place
0.5is given meaning isdocs/ideas/guided-migration.md(">0.5 = different design languages"), but that's an ideas doc and is not referenced by the code. The alignment is coincidental, not wired.
Why it matters
Users meet bare compare first and assume it's the drift gate. The real governance path is compare --gate (baseline-relative, per-dimension, acked via .ghost-sync.json). The arbitrary-looking 0.5 erodes trust in the number and obscures --gate.
Proposed fix (non-breaking)
- Promote
0.5to a named, commented constant incli.tsdescribing it as a heuristic and pointing to--gatefor real gating. - Add one line to
compare --helpsteering serious CI users to--gate. - (Optional, separate) consider a
--threshold <n>flag only if there's real demand.
Related
The WEIGHTS constants in embedding/compare.ts have the same "taste captured once, undocumented" smell (1f8decb).
- Dominant language
- TypeScript
- Stars
- 31
- Forks
- 8
- Avg merge
- 18h 15m
- Merged PRs (30d)
- 21
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from block/ghost
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Dependency Dashboard Open
Difficulty 5/5 Over a week Newbie friendliness 15/100
Similar issues
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
joinmarket-webui/jam#1496 · 1 comment ·
-
Tech
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
opencrvs/opencrvs-core#13865 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
linagora/twake-calendar-frontend#1377 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
EclipseFdn/open-vsx.org#13385 · 1 comment ·