Skip to content

refactor: move process-wide statics to their owners - #1165

Open
lexoliu wants to merge 1 commit into
mainfrom
refactor/1158-statics
Open

lexoliu wants to merge 1 commit into
mainfrom
refactor/1158-statics

Conversation

@lexoliu

@lexoliu lexoliu commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Sixteen static items held state outside tests. Each now lives with the value that already owns it and is passed to its users: the quota and secret regexes in QuotaPatterns and SecretPatterns on the daemon state and the TUI app; the syntax set, theme and tunnel regex in the chat stream's assets, built once when the TUI starts; the repo-search client and the per-repository land locks in SharedServices on the daemon state, so every session still shares one lock per repository; the chat revision counter in a clock that a replacement stream shares, so revisions stay unique for the layout cache; the jank threshold read once at startup. The crash handler keeps its two statics, since a sigaction handler gets no context pointer.

The highlighter still compiles the theme's selectors once, not per line. Clippy is clean with -D warnings and 801 tests across quota, secrets, the TUI, repo search, PRs, terminal commands, bash and the daemon pass.

Closes #1158

Sixteen statics held state outside tests. The quota and secret regexes now
live in QuotaPatterns and SecretPatterns on the daemon state and the TUI app;
the syntax set, theme and tunnel regex in the chat stream's assets, built once
at TUI start; the repo-search client and the per-repository land locks in
SharedServices on the daemon state, passed to every session's commands; the
chat revision counter in a clock successor streams share; the jank threshold
is read once at startup. The crash handler keeps its two statics, which a
sigaction handler can only reach that way.

Closes #1158
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.

Global state: move statics to their owners

1 participant