Skip to content

feat(entry-check): pre-entry check page with saved trade plans and editable scoring rules - #13

Merged
omerElezra merged 4 commits into
feat/trade-context-enrichmentfrom
feat/entry-check
Jul 20, 2026
Merged

feat(entry-check): pre-entry check page with saved trade plans and editable scoring rules#13
omerElezra merged 4 commits into
feat/trade-context-enrichmentfrom
feat/entry-check

Conversation

@omerElezra

Copy link
Copy Markdown
Owner

Summary

New Entry Check page (/entry-check) — a deliberate pre-entry gate against anticipation/FOMO entries that get stopped out fast:

  • Live or retrospective check: symbol + optional possible entry price + optional possible entry time. Empty time = "now"; a past time = practice mode, including a "what happened after" table (5/10/20 trading days + which of stop/target was hit first).
  • Measured context as-of the check time (lib/domain/pre-entry.ts): reuses the enrichment section calculators — stock MAs/distances/returns/relative volume/ATR, SPY+QQQ bias, VIX regime. No invented data; gaps land in dataQuality.
  • Transparent, user-editable scoring (lib/domain/scoring.ts + scoring_rules table): each rule is an AND of typed predicates over a curated fact catalog, edited in the UI; the score always shows which rules fired and which were skipped. 7 seeded defaults incl. Entered without confirmation (−2).
  • Saved trade plans (trade_plans, migration 010): full snapshot with frozen score breakdown; status planned/entered/skipped/expired; clicking a plan loads every parameter into the form and Save updates the same row (plans are single entities, no duplicates); lazy return-since-plan chip fetches the current price on click.
  • AI coach prompt: one click copies a complete, structured prompt (context + manual read + score + outcome + notes, answer-in-Hebrew instruction) for any AI model; clipboard-blocked environments get a fallback modal.
  • Journal unification: "Entry reason" merged into the shared Entry confirmation question (discipline dimension); same presets, sections and controls across journal and entry-check; Hebrew hover explanations on every question, chip, section and KPI metric; Hebrew-aware (dir="auto") notes.
  • DB contract tests (lib/db-contract.test.ts): migrations ↔ query layer can no longer drift silently (columns, redundancy, UNIQUE-vs-onConflict, seed ≡ DEFAULT_RULES).
  • Dead code removal (knip + manual verification): orphaned /api/v1/metrics/performance endpoint + lib/domain/performance.ts, unused kpi-row, unused deps, internal-only exports.

Stacked on #12 (feat/trade-context-enrichment) — retarget to main after #12 merges.

Test plan

  • 81 vitest tests pass (pre-entry, scoring, entry-prompt, DB contract, existing enrichment) in the Colima container
  • tsc --noEmit clean
  • Migration 010 applied to Supabase; 7 seeded rules verified
  • Browser E2E: live + retrospective checks, auto-fill badges, live score reaction, rule CRUD, plan save/edit-in-place/status cycle/delete, AI prompt content, RTL notes, journal-form regression

🤖 Generated with Claude Code

oelezra and others added 4 commits July 20, 2026 16:53
…itable scoring rules

New /entry-check page that forces a deliberate pre-entry decision:
- computePreEntryContext reuses the enrichment section calculators as-of any
  timestamp (empty = live "now" check, past = retrospective practice incl.
  a "what happened after" 5/10/20d forward outcome with stop/target first-hit)
- transparent rule-based score: user-editable scoring_rules (AND of typed
  predicates over a curated fact catalog, no black box), 7 seeded defaults,
  fired/skipped breakdown always shown; unified Entry confirmation question
  (confirmation vs anticipation/FOMO) shared with the journal
- trade_plans table (migration 010): full check saved with frozen score
  breakdown, status planned/entered/skipped/expired, editable in place via
  full-form loading (each plan is a single row, PATCH recomputes the score)
- copy-paste AI coach prompt built from the full context/checklist/score/
  outcome, with clipboard fallback modal; lazy return-since-plan chip
- shared journal form controls + Hebrew hover-help extracted for reuse

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ver help

- trade journal form now uses the extracted form-controls/journal-presets;
  "Entry reason" unified with entry-check into the Entry confirmation
  question (discipline dimension only — setups stay in Technical setup,
  incl. new MA Support Bounce / Fibonacci Retracement / Bouncing on MA150);
  sections renamed to match entry-check (Setup & Plan, Chart Details)
- Hebrew hover explanations on every question, option chip and section, on
  the Trade Context card metrics and on the dashboard/analytics KPI cards
- notes and custom-value inputs auto-detect Hebrew (dir="auto")

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Parses scripts/migrations/*.sql and fails when code and schema drift:
columns read/written must exist, migrated-but-untouched columns are flagged
as redundant unless whitelisted, upsert conflict keys need a matching UNIQUE
constraint, the scoring_rules seed must parse, pass validateRule and stay
identical to DEFAULT_RULES, and migration numbering must be gapless.
CLAUDE.md documents the repo-root-mounted test command and requires running
the suite for any DB-touching change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verified with knip + manual grep:
- delete the orphaned /api/v1/metrics/performance endpoint and
  lib/domain/performance.ts (no client callers — FastAPI-port leftover),
  their types (PerformanceReport, HoldingTimeStats), the unused kpi-row
  component, the unused autoInterval helper and the unused SSR supabase
  client; drop unused @radix-ui/react-separator and react-tooltip deps
- unexport symbols only used inside their own module

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trade-ops-journal Ready Ready Preview, Comment Jul 20, 2026 1:57pm

@omerElezra
omerElezra merged commit 5875c47 into feat/trade-context-enrichment Jul 20, 2026
2 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