Skip to content

fix(tkc): Stabilization R1 — Recipe Integrity, Vault Intelligence & Image Refresh - #79

Merged
kryptek2000 merged 1 commit into
mainfrom
fix/tkc-stabilization-r1
Nov 29, 2026
Merged

kryptek2000 merged 1 commit into
mainfrom
fix/tkc-stabilization-r1

Conversation

@kryptek2000

Copy link
Copy Markdown
Owner

Summary

Stabilization R1 fixes three owner-observed defects and the R1-F1 cooking-time discrepancy:

  • generated-recipe ingredient content is no longer silently truncated;
  • Vault Intelligence no longer invents category, timing, tags, or nutrition from weak evidence;
  • a successful image save refreshes the recipe immediately instead of falsely reporting a Vault conflict;
  • the owner's actual six-step smoked-chicken sequence produces no invented precise cook time.

The implementation and regression tests are complete. This PR contains the verified changes only.


R1-A — Generated Recipe Content Integrity

Failure reproduced: a 98-character smoked-chicken ingredient name was silently cut to exactly 80 characters by normalizeGeneratedRecipeDraft.

Correction:

  • Ingredient name and preparation now have documented 240-character bounds.
  • Over-limit values are rejected explicitly; they are never sliced.
  • Non-string preparation values are rejected.
  • The Create for Me save UI shows the specific validation error.
  • No migration rewrites an already-saved truncated recipe.

Regression coverage:

  • 98-character ingredient/preparation preserved through normalization.
  • Explicit 80-character boundary assertion (the old truncated prefix is not the result).
  • Over-limit rejection, including the explicit UI error.
  • Draft → preview/editor → Markdown save → reload fidelity.

R1-B — Vault Intelligence Data Integrity

Failures reproduced on the baseline:

  • Smoked chicken → Baking & Breads because the instructions mention a baking sheet.
  • Four hours of refrigeration + active smoking + resting → 8 hr 20 mins cook time.
  • Ingredient-count prep inference → 6 mins (the owner's 7-line list produced 14 minutes).
  • Barbecue recipe → high-confidence #baking #bread.
  • Low-coverage nutrition (1 whole chicken, 1/2 tsp black pepper, 1 tsp salt) → 3 kcal displayed as “3 kcal / serving”.

Correction:

  • Category/cuisine/tags classify from title and ingredient names, not instruction prose.
  • Seasonings & Rubs requires a title marker.
  • Passive refrigeration/chilling/resting/brining/marinating is separated from active cooking.
  • Ranges are treated as imprecise; no bound is promoted to a high-confidence cook time.
  • Ingredient-count prep inference and speculative timing branches are removed.
  • Existing authored timing values are never re-proposed.
  • Servings require an explicit yield.
  • Nutrition is offered only for a complete trusted assessment, with an explicit serving count, and only above a plausible per-serving floor.
  • calories is per-serving; nutrition is clearly total-batch.
  • Category/cuisine/tags/nutrition/difficulty are low-confidence, manual-only suggestions.
  • Single-recipe defaults select only missing, high-confidence fields.
  • Bulk recovery applies only high-confidence instructions_explicit/body_parsed fields; speculative values are excluded.
  • Missing personal rating is no longer treated as missing metadata.

Owner sequence verified:

  1. Refrigerate uncovered for 4 hours.
  2. Smoke for approximately 45–60 minutes.
  3. Broil for 1–3 minutes.
  4. Rest for 5 minutes.

Because the active durations are ranges, cookTime is omitted. Passive-only controls produce no cook time. A precise-active control (45 min + 2 min) produces 47 mins and explicitly excludes 4 hr 5 mins passive time. Bulk recovery for the actual recipe has no cook-time field to persist.

A complete explicit-serving recipe reports 166 kcal per serving and 664 kcal total batch across 4 servings.


R1-C — Image Save Immediate Refresh

Failure reproduced: the save flow advanced the collection revision before the success handler compared it, producing a false conflict (start=1, current=2) and suppressing the in-memory image update.

Correction:

  • Capture the pre-save revision, post-commit revision before the save's own invalidation, and post-invalidation revision.
  • Treat the save's own +1 as expected; publish immediately to the Vault list and selected recipe.
  • Preserve genuine concurrent-write and Vault-switch protections.
  • Do not advance the revision a second time in the handler.

Corrected sequence: start=1, committed=1, postMark=2, current=2 → publish.


Verification

Check Result
Focused affected suite (23 files) 273/273 PASS
Real-App on-disk integration 12/12 PASS
TypeScript tsc --noEmit PASS
Production build PASS
git diff --check PASS

The focused suite covers generated-recipe schema/save/editor, metadata recovery, nutrition estimator safety, Vault Intelligence defaults and bulk recovery, image save/revision/persistence, protected previews, no-auto-generation, and Vault session authority.

Verification is deterministic and scripted. It proves the application contracts, regression behavior, and safety gates. It does not constitute live-model culinary acceptance, a live paid image-provider run, or owner acceptance of the rendered UI.


Scope and safety

  • 18 files: 13 modified, 5 new.
  • No personal Recipe Vault access or modification.
  • No provider credential changes.
  • No paid inference.
  • No native installation, deployment, or merge.
  • Existing already-truncated saved recipes are not rewritten.
  • Recovered nutrition remains manual/low-confidence under the existing automated-application disable.

Not merged.


function parseTimeString(value: string | undefined): number | null {
if (typeof value !== "string" || !value.trim()) return null;
const hours = value.match(/(\d+(?:\.\d+)?)\s*(?:hours?|hrs?)\b/i);
function parseTimeString(value: string | undefined): number | null {
if (typeof value !== "string" || !value.trim()) return null;
const hours = value.match(/(\d+(?:\.\d+)?)\s*(?:hours?|hrs?)\b/i);
const minutes = value.match(/(\d+)\s*(?:minutes?|mins?|min)\b/i);
@kryptek2000
kryptek2000 merged commit e15d2dd into main Nov 29, 2026
13 of 14 checks passed
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.

2 participants