Skip to content

Tidy the small copies and wrappers in the server - #44

Merged
Maharsh17 merged 1 commit into
mainfrom
tidy-server
Nov 27, 2026
Merged

Maharsh17 merged 1 commit into
mainfrom
tidy-server

Conversation

@Maharsh17

Copy link
Copy Markdown
Member

Closes #43

Each of these now lives in one place.

  • since_for, OVERLAP and a bool-safe number sit in environments/__init__.py and both log sources use them
  • a ZANY Store carries its own forget, and the environments use partial(read_store, ...) and partial(watch_store, ...), so the nine wrappers and reconcile() go
  • db._forget_keys does the delete loop for both forget paths
  • llm.record_spend counts the tokens for a reply and for a check-in
  • gate.check raises the 429 itself
  • message_json shapes a message for the history and the check-in stream. The stream now sends role, origin and thumb too, so the page reads a check-in with fromServer like any other message
  • the reply measures the snapshot once and hands it to describe
  • a failed check-in pass waits 30 seconds, without the jittered backoff
  • Settings.as_dict, EmptyAnswer.tokens and the second sentence regex go, and the learner model imports move to the top of situation.py
  • the tests share one client fixture in conftest, and events_of builds each Event from its fields

The stream test now checks the new fields. Ruff, the 96 server tests on a throwaway Postgres 18 and the 22 client tests all pass here. Nothing changes for students or researchers, and I'll check the live site after it deploys.

The two log sources share one since-window helper, one OVERLAP and one
bool-safe number reader. ZANY's stores carry their own forget, so the
one-line wrappers around them go. The forget paths, the token spend
records and the message JSON each live in one place. The token gate
raises its 429 itself. The snapshot is measured once per reply. The
check-in stream sends the same message shape as the history, so the
page reads both alike. Tests share one client fixture.
@Maharsh17
Maharsh17 merged commit 0c96959 into main Nov 27, 2026
2 checks passed
@Maharsh17
Maharsh17 deleted the tidy-server branch November 27, 2026 22:37
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.

Tidy the small copies and wrappers in the server

1 participant