Public: anyone can read this; the crew can change it.

Quota and usage admin sentences live in one module, read by the web pages and the terminal #5636

Parked opened this
Closed without merging

The two admin sentences about quotas and usage are now written once, in a new module src/actions/adminlimitswords.ts. No existing module owned both of them: actions/quotas.ts and actions/usage.ts each cover only one.

Notes

stopped parked by the crew

opened this

The two admin sentences about quotas and usage are now written once, in a new module src/actions/admin_limits_words.ts. No existing module owned both of them: actions/quotas.ts and actions/usage.ts each cover only one. The module exports:

  • QUOTA_INVALID: "A quota is a positive whole number, or empty for no limit."
  • USAGE_ADMIN_ONLY: "Usage is read by a forge admin."

Four files import them instead of typing the sentence out. In each one, only the line with the sentence and one import line changed:

  • src/web/pages/admin-limits.ts: the message shown when saving quotas fails.
  • src/tui/screens/quotas.ts: the invalid_quota answer.
  • src/web/pages/usage.ts: the note on the 403 "Admins only" empty state.
  • src/tui/screens/usage.ts: the header line shown to someone who is not an admin.

The wording is unchanged. grep -rn for either sentence under src/ now finds only the new module.

The new test/admin-limits-words.test.ts reads each of the four files as text. It fails if one contains the sentence again or stops importing its constant. It also pins each constant to its exact wording.

Checks run before pushing, all passing:

  • the new test, plus the existing quota, limits, usage and terminal tests, and the timing tests for the two admin pages (40 tests, unchanged);
  • bun x tsc --noEmit, with no errors;
  • bun scripts/design-lint.ts, which is clean.

I did not move the other sentences in these files, such as "Quotas saved." and "You cannot change quotas.", because the issue names only these two.

To try it: on /admin/limits as an admin, submit a quota of abc, then open the usage page as someone who is not an admin. Both show the same text as before.

🤖 Generated with Claude Code

Closes #5621

commented

The two admin sentences about quotas and usage are now written once, in a new module src/actions/admin_limits_words.ts. No existing module owned both of them: actions/quotas.ts and actions/usage.ts each cover only one. The module exports:

  • QUOTA_INVALID: "A quota is a positive whole number, or empty for no limit."
  • USAGE_ADMIN_ONLY: "Usage is read by a forge admin."

Four files import them instead of typing the sentence out. In each one, only the line with the sentence and one import line changed:

  • src/web/pages/admin-limits.ts: the message shown when saving quotas fails.
  • src/tui/screens/quotas.ts: the invalid_quota answer.
  • src/web/pages/usage.ts: the note on the 403 "Admins only" empty state.
  • src/tui/screens/usage.ts: the header line shown to someone who is not an admin.

The wording is unchanged. grep -rn for either sentence under src/ now finds only the new module.

The new test/admin-limits-words.test.ts reads each of the four files as text. It fails if one contains the sentence again or stops importing its constant. It also pins each constant to its exact wording.

Checks run before pushing, all passing:

  • the new test, plus the existing quota, limits, usage and terminal tests, and the timing tests for the two admin pages (40 tests, unchanged);
  • bun x tsc --noEmit, with no errors;
  • bun scripts/design-lint.ts, which is clean.

I did not move the other sentences in these files, such as "Quotas saved." and "You cannot change quotas.", because the issue names only these two.

To try it: on /admin/limits as an admin, submit a quota of abc, then open the usage page as someone who is not an admin. Both show the same text as before.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("GET /settings/tokens names its phases and answers within its budget") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs