Repository navigation
Split the backend, one chat session for both chats, one declined field, unused CSS removed, fonts preloaded - #86
Merged
Conversation
… declined field - main.py now only builds the app: the edge-secret check, cache headers, CORS and the routers. Routes live in routes/ (chat, contact, booking, content), request and reply shapes in schemas.py, configuration in settings.py, the parts a chat reply is built from in replies.py and SMTP in mailer.py. Functions used across modules lose their leading underscore. - Tests patch names where they are looked up (settings, rate_limit, mailer, routes.chat). - declined: the site reads the server's `declined` field alone. The search outcome no longer stands in for it, so a declined answer reads the same in the home chat, on a post page and in the choice of drawing. - tests/test_contract.py reads the frontend's declarations and compares the reply fields, search outcomes and starter topics with the server's models; the backend workflow runs on changes to those frontend files too. - Docs and comments point at the new files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014dGcvVc19RwzWGMn9NWo9s Signed-off-by: Claude <noreply@anthropic.com>
- chat/useAgentSession.ts: what the home chat and the chat under a post share about talking to the agent: one request at a time, the Turnstile token, the once-per-conversation offer to talk directly, and closing when the day's answers are spent. Both engines send through it; each keeps only what it draws around the answer. - foldHandoffs: one way to fold the offer when the conversation moves on. - chat/sources.ts: one rule for the sources row, used by both chats. The post chat now names Yanir's notes first and localises profile titles, as the home chat already did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014dGcvVc19RwzWGMn9NWo9s Signed-off-by: Claude <noreply@anthropic.com>
- 59 class names that no source file mentions and that no page showed in a
recorded run (every page at four sizes, every chat path, every dialog and
hover) lose their selectors; rules left empty go with them (about 1,190
lines of site.css). Classes built in code (`t${i}`, `k-${id}`) are kept.
- Four declarations repeated with the same value by a later rule with the
same selector go; the later rule wins either way.
- No two rules were identical, so none was removed for that reason.
- 61 of 64 full-page screenshots are pixel-identical before and after; the
three that differ differ only in a video's loading spinner.
- The unused QuickMessageOption type goes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dGcvVc19RwzWGMn9NWo9s
Signed-off-by: Claude <noreply@anthropic.com>
The Hebrew and Latin subsets of Assistant and Karantina were found only after the CSS loaded, so pages painted in the fallback font and then reflowed: up to 0.4 of layout shift on long posts at 1024px. A small plugin adds a preload link for those four files to index.html, which the prerender copies to every route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014dGcvVc19RwzWGMn9NWo9s Signed-off-by: Claude <noreply@anthropic.com>
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.
Requested by Yanir · project thread
What changed
Structure only, plus one fix for load-time movement. Otherwise the site should look and behave exactly as it does on
main.Backend split (FastAPI's layout for an application larger than one file)
main.py(1,392 lines) now only builds the app: the edge-secret check, cache headers, CORS and the routers (124 lines).settings.py: all configuration read from the environment.schemas.py: every request and reply model.routes/:chat.py,contact.py,booking.pyandcontent.py, oneAPIRoutereach.replies.py: the parts a chat reply is built from (cards, sources, handoff, trace, output checks).mailer.py: SMTP.One
declinedfielddeclinedalone. The search outcomeunmatchedno longer stands in for it in the home chat or in the choice of drawing.tests/test_contract.pyreads the frontend's TypeScript and compares three things with the Pydantic models: the reply's fields, the search outcomes and the starter topics.One chat session for both chats
chat/useAgentSession.tsholds what the home chat and the chat under a post share: one request at a time, the Turnstile token, the once-per-conversation handoff offer, and closing when the day's answers are spent.foldHandoffsfolds the offer the same way in both chats.chat/sources.tsgives one rule for the sources row. The post chat now names Yanir's notes first, as the home chat already did.CSS
site.css.t${i},k-${id}) are kept.mainwith Own share card and a share line for every post, article and project page #84 and Grown chat panel: the systems and the reasons carry their proof #85: none of the removed names is used by the new code.Fonts preloaded
<link rel="preload">for the four Assistant and Karantina files toindex.html, which the prerender copies to every route.Docs
ChatResponse.used) and is removed.Why
Each module has one job, the frontend and backend contract is checked by a test, both chats share one engine, the CSS holds only what the site uses, and text no longer jumps when the fonts arrive.
How to verify
cd backend && pytest -q: 376 passed.main(Site-wide verification fixes: sources on every reply, starter retrieval, layout, README #82–Grown chat panel: the systems and the reasons carry their proof #85): 70 routes × 8 viewports.topichandoff_offered: true, and the offer foldsChecklist
git commit -s)pytest -qpasses frombackend/npm run typecheck,npm run lint,npm run format:checkandnpm run buildpass fromfrontend/bash .github/scripts/check_hygiene.shpasses from the repository root🤖 Generated with Claude Code
https://claude.ai/code/session_014dGcvVc19RwzWGMn9NWo9s