feat(espn): reprint with default-on self-healing learn loop (store v6→v9)#1430
feat(espn): reprint with default-on self-healing learn loop (store v6→v9)#1430mvanhorn wants to merge 4 commits into
Conversation
…->v9) Reprint of media-and-entertainment/espn under the current Printing Press (feat/self-improving-learn-loop, 4.27.1 + ctx-propagation template backport). Provenance: regen-merge, not from-scratch — the ~30 live learnings, 5 patch files, and hand-evolved domain code are preserved. What's new - Default-on self-healing derive loop: a failed flag that is corrected on a later invocation is auto-captured as a flag_alias candidate even when Cobra records no did-you-mean suggestion (inference by edit distance, ties skipped). - Store schema v6 -> v9. New migration test (migration_v6_v9_reprint_test.go) opens a populated v6 fixture (learnings + playbooks) and asserts every row survives the upgrade and learn_candidates/learn_events are created. Reconciliation notes - Framework taken fresh (v9 store, new MCP SDK surface, helpers, client). - ESPN domain preserved: search rerank appliers, boxscore/compare/h2h/odds/ scores/streak/rivals/today/sos/dashboard/watch, and the events/news/teams domain store methods (now isolated in internal/store/espn_domain.go). - pr#850 review fixes preserved (ctx propagation upstreamed to the template; ErrApplierSkip re-injected). - sync/export/import restored and migrated to the new client/store API — the current generator classifies espn as read-through and drops them, but sync is load-bearing for the offline events store that rivals/streak/search read. Live-verified against site.api.espn.com: cold-miss recall, scoreboard --date (exit 2) -> --dates (exit 0), and `learnings candidates` surfaces the --date -> --dates flag_alias. Full `go test ./...`, `go vet`, govulncheck clean. Do not merge yet — canonical SKILL/README install sections carry pre-existing drift that the library's post-merge sweep-canonical tool refreshes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4eADiHsstb6svS3iqsK4f
|
Tracking: #1425. Draft pending (1) the generator-side ctx-backport PR in cli-printing-press, and (2) post-merge |
|
@greptileai review Auto-nudge from |
|
@greptile-apps please review — this exceeds the default 100-file limit because it's a full CLI reprint (framework taken fresh from the current generator). The review-worthy surface is the hand-reconciled/novel code: |
Greptile SummaryThis re-review covers the single fix commit (
Confidence Score: 5/5The change is a two-line cosmetic correction to hardcoded metadata values; no logic paths are affected and the counts now accurately reflect the registered tool surface. The only diff since the previous passing review is updating two integer literals from stale values (7 and 11) to 15 in the No files require special attention. Important Files Changed
|
- handleContext: archetype project-management -> content and replace the PM-template playbook tips with ESPN-specific guidance. The generator's profiler misclassified espn's domain, leaking project-management context into the agent-first `context` tool. (Generator profiler misclassification is a separate retro.) - pragmaColumns: add the validIdentifierRE guard before interpolating the table name into PRAGMA table_info, matching the guard pattern used elsewhere in the store package. Inputs are app-controlled today; this closes the guard-bypass path a future caller could hit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4eADiHsstb6svS3iqsK4f
|
Both Greptile findings addressed in
|
|
@greptile-apps please re-review at 3d44a5b — both prior findings are fixed (handleContext domain content, pragmaColumns guard). The 131-file count is a full CLI reprint; the hand-written surface to review is internal/store/espn_domain.go, internal/store/migration_v6_v9_reprint_test.go, internal/mcp/tools.go, internal/cli/{sync,export,import}.go, and internal/cli/root.go wiring. |
Greptile SummaryThis PR introduces a self-healing derive loop for the ESPN CLI reprint, migrating the SQLite store from schema v6 to v9 by adding
Confidence Score: 3/5Not safe to merge: the missing AddCommand registrations make every novel ESPN domain command unreachable at runtime. Score 3 reflects one blocking P1 defect (all domain commands absent from root) that would make the binary silently broken for all ESPN-specific subcommands, alongside two P2 concerns (uncapped edit distance, version downgrade). The store migration, journal, derive logic, and candidate store are all well-implemented. library/media-and-entertainment/espn/internal/cli/root.go requires immediate attention — the AddCommand block (lines 266–303) must include all domain command constructors before this PR can ship. Important Files Changed
|
…rence (Greptile)
Blocking P1: taking root.go fresh dropped the AddCommand registrations for
all 16 hand-authored ESPN domain commands (scores, today, boxscore, watch,
dashboard, rivals, streak, odds, compare, h2h, sos, trending, recap, search,
sql, standings) — they built but were unreachable ("unknown command"). Restored
the full registration block; verified every published command and subcommand is
now reachable (only the vestigial no-auth `auth` command remains intentionally
dropped).
P2s:
- version.go: preserve the public-library release version 2026.6.2 (from
.printing-press-release.json) instead of the fresh 1.0.0 skeleton, so
--version does not appear to downgrade the published CLI.
- derive.go: cap inferCorrectedFlagFromNewSuccessFlag at half the shorter
flag name's length (floor 1) so an unrelated new success flag (e.g. --sport
when --date failed) is not promoted as a spurious flag_alias. Added a
negative test.
go build/vet/test ./... green; full command-tree parity re-verified against the
published binary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q4eADiHsstb6svS3iqsK4f
|
All three findings fixed in
@greptile-apps please re-review at |
… handlers The handleAbout and handleContext handlers hardcoded stale tool_count values (7 and 11) that no longer matched the 15 typed tools registered in RegisterTools. Set both to 15. (Dynamic derivation is a generator-side improvement tracked separately.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4eADiHsstb6svS3iqsK4f
|
@greptileai review Auto-nudge from |
|
@greptile-apps re-review at 2c67ba1 — the only new change since the 5/5 pass is the cosmetic |
Reprint: ESPN with default-on self-healing learn loop (store v6 → v9)
Reprint of
media-and-entertainment/espnunder the current Printing Press (feat/self-improving-learn-loop, 4.27.1 + a ctx-propagation template backport). Provenance:regen-merge, not from-scratch — the ~30 live learnings, 5.printing-press-patches, and hand-evolved domain code are preserved.Feature parity verified against
origin/main: all 58 flags and every command carry over (the vestigialauthcommand is intentionally dropped — ESPN is a no-auth API).sync/export/importrestored and migrated. Net-new on top: the self-healing derive loop andagent-context/which/schedule.What's new
flag_aliascandidate even when Cobra records no did-you-mean suggestion (inference from the new success-entry flag by edit distance; ambiguous ties skipped).internal/store/migration_v6_v9_reprint_test.goopens a populated v6 fixture (learnings + playbooks,user_version=6) and asserts every row survives the upgrade to v9 and thatlearn_candidates/learn_eventsare created.Reconciliation (hand-evolved tree)
events/news/teamsdomain store methods isolated into a newinternal/store/espn_domain.go(regen-durable).ErrApplierSkipre-injected.sync/export/importrestored and migrated to the new client/store API.syncis load-bearing — it populates theeventsstore thatrivals/streak/searchread offline. (The current generator's read-through drop-classification is a separate generator issue worth a retro.)Live proof (site.api.espn.com)
The World Cup incident heals end-to-end:
recall "why did argentina win yesterday world cup"→ cold miss (found:false)scoreboard soccer fifa.world --date 20221218→ exit 2 (unknown flag: --date)scoreboard soccer fifa.world --dates 20221218→ exit 0 (live 2022 WC Final)learnings candidates:{ "class": "flag_alias", "command_path": "scoreboard", "failed_flag": "--date", "corrected_flag": "--dates", "example": "scoreboard --compact --dates" }go build ./...,go vet ./...,go test ./..., andgovulncheck ./...all pass.Reviewer notes
cli-printing-presslearn templates (learnings.go.tmpl/teach.go.tmpl). This PR's generated code already contains the fix and is correct standalone; landing the template change keeps the press and library in sync so a future regen doesn't reintroduce the drift.sweep-canonicalretrofit per its convention.🤖 Generated with Claude Code