Repository navigation
feat: add agent-named stories to the right rail - #76
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Session 4 of the rails plan. Adds the Stories panel to the right rail. A separate daily routine names and keeps the stories (ADR 16).
What changed
storyandstory_articletables (additive migrationd1e2f3a4b5c6), models inapp/catalog/models.py, domain moduleapp/catalog/stories.py.save_storymakes sure an article sits in at most one open story.GET /api/v1/stories?limit=5returns open stories with 3+ articles from 2+ publishers, ordered bylast_article_atdesc. Thin route incatalog/routes.py. Generated client regenerated.story_candidates(days=14),save_story(slug, name, blurb, urls),close_story(slug).story_candidatesreusesstory_groupswith a newSTORY_DIST = 0.40. Open stories' articles act as anchors, so a cluster that reaches a story names it innear..claude/skills/stories/SKILL.md. Routine prompt added to deploy/README as a new "Stories" section (CRON_TZ=Europe/Zurich 17 6 * * *).components/Rails/panels/Stories.tsxis the only panel inRIGHT. It's an accordion with one row open at a time and the first open by default; the open body renders right under its row. Rows show the name, an orange dot when the story grew today,ScoreBars, and the meta "N · Sep 19 – Oct 7". The open body has the blurb, a timeline of up to 6 articles (date,MiniRail, publisher, title) and "Show all N". Open and close animate height, and the animation is turned off underprefers-reduced-motion. Opening a row firesstory_open {slug}; article links usearticleClickHandlers.backend/scripts/seed_stories.pyseeds stories into a local db, from a JSON file or as demo stories from the newest articles. It refuses to run in production.Where I departed from the plan
STORY_ARTICLES = 30is used as a payload cap.article_countis still the true total.RailPanelDefwas to stay untouched, soRailsProvidernow drops the stories panel until/storiesreturns at least one story. The rail then hides through the existing empty-side path. This is a small, stories-specific filter inRailsProvider.tsx, not inpanels.tsx.first_at/last_atcome from the story's articles (published_at, falling back to created_at).STORY_DISTis untuned. The plan says to start at 0.40 and tune on real data. This environment had no db dump and could not download the embedding model, so 0.40 is untuned. ADR 16 says so; the routine's reports will show whether clusters are too broad.Verified, and how
Backend tests (
pytest) against a local Postgres 16 + pgvector with migrations at head: 564 passed. The 1 failure istest_read_endpoints_are_public[/search?q=agents], which also fails on master here because huggingface.co is blocked in this sandbox (the model download). New tests are inapp/catalog/tests/test_stories.py:grew_today, the routesave_storyupsert and every validation errorstory_candidatesclustering andnearThe read-token refusal is covered by adding the three tools to
WRITE_TOOLSintest_curation_tools.py.Lint and types:
ruff check,ruff format --check,mypy backend/app backend/scripts,ty checkare all clean. Biome is clean on the files I changed. Biome reports a format issue only intests/rails.spec.ts, which came from master as-is, so I left it.alembic checkshows no drift for the new tables.Build:
bun run buildpasses.Playwright:
tests/stories.spec.tsmocks/api/v1/storiesand checks five things:It ran with
stories.spec.ts, master'srails.spec.tsandarticles.spec.ts: 10 passed. These ran with--no-depsbecause the auth setup needs mailcatcher, and none of these specs need sign-in.Seeded three stories locally with
seed_stories.py, checkedGET /api/v1/stories/, and screenshotted the rail at 1440px: first row open, then moved to the second row.Rebased on master after feat: show who wrote the wire in the left rail #74 (who-wrote). Resolved conflicts in
models.pyandpanels.tsxby keeping both sides, then regenerated the client.Nothing was called against production. No MCP write tool was used.
After merge
MCP_WRITE_TOKENasAGENTIQUE_MCP_TOKEN) and the scheduleCRON_TZ=Europe/Zurich 17 6 * * *.STORY_DIST(0.40) clusters, and tune it if clusters are too broad or too thin.🤖 Generated with Claude Code
https://claude.ai/code/session_018V3zAh2gYWTYRqemGWcvUA
Generated by Claude Code