dcramer / dcramer/peated

Classifier models Willett exact-cask photo creates as standalone bottle instead of bottling

Open
#460 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
103
Forks
18
Avg merge
1h 19m
Merged PRs (30d)
555

Description

Summary

Photo add-bottle classification can create non-SMWS single-barrel / exact-cask whiskies as standalone bottles instead of creating a stable parent bottle plus a child bottling/release.

Observed example:

  • Willett Family Estate Bottled Single Barrel Bourbon
  • Barrel No. 4769
  • 5 years old
  • 64.2% ABV / 128.4 proof

In a clean DB, the classifier preserved the important label facts but returned create_bottle with identityScope: "exact_cask" instead of a bottling-oriented result such as create_bottle_and_release.

Why This Matters

The resulting data is factually useful, but likely not the intended Peated model for recurring single-barrel programs. For Willett Family Estate, Family Estate Bottled Single Barrel Bourbon looks like the reusable parent identity, while Barrel No. 4769, age, ABV, cask-strength, and single-cask traits are bottling/release identity.

This means the current eval can pass while the persisted catalog shape is still wrong.

Current Behavior

The checked-in Willett fixture expects the standalone bottle shape:

  • action: "create_bottle"
  • identityScope: "exact_cask"
  • proposedRelease: null
  • proposed bottle name includes Family Estate, Single Barrel, and 4769

Relevant fixture:

  • packages/bottle-classifier/src/eval-fixtures/decision-cases/new_bottles/image-backed-photo-creates-willett-family-estate-barrel-4769.json

The eval therefore proves "do not match the wrong existing row and preserve 4769", but it does not prove "model this as parent plus bottling."

RCA / Hypothesis

The release is not being dropped by the add-bottle create plumbing.

Server create plumbing supports create_bottle_and_release:

  • apps/server/src/lib/classifierDecisionCreateInputs.ts maps create_bottle_and_release to both bottle input and release input.
  • apps/server/src/lib/bottleReferenceResolution.ts persists both the bottle and release for create_bottle_and_release.
  • apps/server/src/orpc/routes/tastings/photo-identification-create.ts accepts create-bottle, create-release, and create-bottle-and-release decisions.

The likely root cause is classifier semantics:

  • packages/bottle-classifier/src/classifierTypes.ts rejects identityScope: "exact_cask" with create_release, create_bottle_and_release, or repair_parent_and_create_release.
  • packages/bottle-classifier/src/instructions.ts says "Exact-cask identity does not create child releases/bottlings."
  • packages/bottle-classifier/src/reviewPolicy.ts has a post-model rewrite that downgrades create_bottle_and_release to create_bottle when exact-cask scope is inferred, merging release traits back into the bottle.
  • packages/bottle-classifier/src/classifier.eval.test.ts treats exact-cask normalization as requiring no child release identity.

Hypothesis: the exact-cask rule was originally intended to prevent SMWS-style exact cask identities from being split into weak parents and child releases, but it now applies too broadly to non-SMWS recurring single-barrel programs like Willett Family Estate.

Expected Direction

For Willett Family Estate barrel 4769, we likely want:

  • action: "create_bottle_and_release" in a clean DB, or create_release if a clean parent exists.
  • Parent bottle:
    • brand: Willett
    • name: Family Estate Bottled Single Barrel Bourbon or equivalent stable family name
    • category: bourbon
  • Release / bottling:
    • edition: Barrel No. 4769
    • statedAge: 5
    • abv: 64.2
    • singleCask: true
    • caskStrength: true

We may need to split the concepts:

  • exact-cask as a precision/evidence property
  • standalone exact-cask bottle as a storage decision

SMWS exact cask rows may remain standalone bottles, while non-SMWS exact barrels can become releases when a stable parent family is supported.

Suggested Acceptance Criteria

  • Update classifier policy/schema so non-SMWS exact-cask identity is allowed to create or match a child release when a stable parent family is supported.
  • Preserve the current SMWS behavior unless intentionally changed.
  • Update the Willett barrel 4769 fixture to assert bottling-oriented storage shape instead of standalone exact-cask bottle shape.
  • Add or update a regression case proving a clean DB creates parent plus bottling for Willett Family Estate barrel 4769.
  • Ensure photo-identification create still signs a create token and persists both bottle and release for the corrected decision.

Useful Search Terms

  • Exact-cask identity cannot create a child release beneath the bottle
  • Exact-cask identity does not create child releases/bottlings
  • image-backed-photo-creates-willett-family-estate-barrel-4769
  • maybeSplitMisScopedExactCaskBottleCreation

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Willett fixture at packages/bottle-classifier/src/eval-fixtures/decision-cases/new_bottles/image-backed-photo-creates-willett-family-estate-barrel-4769.json and the exact-cask rules in classifierTypes.ts, instructions.ts, and reviewPolicy.ts. Run the related classifier eval, then inspect classifierDecisionCreateInputs.ts, bottleReferenceResolution.ts, and photo-identification-create.ts to verify the existing persistence path. Done means non-SMWS Willett barrel 4769 produces a parent plus release, preserves the current SMWS behavior, and has regression coverage for the decision and creation flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.