Skip to content

feat(vault): show Healthy label when health factor exceeds 50#1784

Open
jonybur wants to merge 3 commits into
mainfrom
feat/vault-health-factor-healthy-label
Open

feat(vault): show Healthy label when health factor exceeds 50#1784
jonybur wants to merge 3 commits into
mainfrom
feat/vault-health-factor-healthy-label

Conversation

@jonybur
Copy link
Copy Markdown
Contributor

@jonybur jonybur commented May 27, 2026

Screenshot 2026-05-27 at 13 54 04

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

🔐 Commit Signature Verification

All 3 commit(s) passed verification

Commit Author Signature Key Type Key Check
bea9e3c8f44b Jonathan Bursztyn sk-ssh-ed25519
010726e13aad Jonathan Bursztyn sk-ssh-ed25519
0fad8996c134 Jonathan Bursztyn sk-ssh-ed25519

Summary

  • Commits verified: 3
  • Signature check: ✅ All passed
  • Key type enforcement: ✅ All sk-ssh-ed25519

Required key type: sk-ssh-ed25519 (FIDO2 hardware key)

Last verified: 2026-05-28 16:35 UTC

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR adds a compact Healthy label for very high Aave health factors. The main changes are:

  • Adds a HEALTH_FACTOR_HEALTHY_THRESHOLD constant set to 50.
  • Updates formatHealthFactor() to return Healthy above that threshold.
  • Adds the new overview.healthFactorHealthy copy string.

Confidence Score: 4/5

This is close, but the formatter scope should be fixed before merging.

  • The new label is implemented in a shared formatter used by action preview deltas.

  • Borrow, repay, and withdraw previews can hide important numeric before/after changes.

  • No security-sensitive code paths changed.

  • services/vault/src/applications/aave/utils/healthFactorDisplay.ts should avoid changing every formatter caller unless all those displays are meant to become non-numeric.

Important Files Changed

Filename Overview
services/vault/src/applications/aave/utils/healthFactorDisplay.ts Central health factor formatting now emits a non-numeric Healthy label for all callers above the threshold.
services/vault/src/copy.ts Adds the static Healthy copy used by the new formatter branch.

Reviews (1): Last reviewed commit: "feat(vault): show Healthy label when hea..." | Re-trigger Greptile

Comment thread services/vault/src/applications/aave/utils/healthFactorDisplay.ts Outdated
Comment thread services/vault/src/applications/aave/utils/healthFactorDisplay.ts Outdated
Comment thread services/vault/src/applications/aave/utils/healthFactorDisplay.ts Outdated
jrwbabylonlab
jrwbabylonlab previously approved these changes May 27, 2026
jrwbabylonlab
jrwbabylonlab previously approved these changes May 27, 2026
Copy link
Copy Markdown
Contributor

@gbarkhatov gbarkhatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — the substantive Greptile findings (action delta regression, repay preview asymmetry, unbounded consistency) were correctly resolved in the revision cycle by moving the label out of formatHealthFactor into the Overview call site.

Two follow-ups worth folding in (left inline):

  1. Add a test that pins formatHealthFactor to numeric output for high HF, so the invariant currently documented only in a comment can't silently regress.
  2. Point STATUS_LABELS.safe in healthFactorGauge.ts at the new COPY.overview.healthFactorHealthy key — same word, same screen, two sources today.

* intentionally do not, to preserve the magnitude of the change. */
export const HEALTH_FACTOR_HEALTHY_THRESHOLD = 50;

export function formatHealthFactor(healthFactor: number | null): string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The invariant from the revision cycle — label substitution lives at the call site, never inside this formatter — is now documented above (L28-30), but nothing in CI guards it. A future tidy-up that pushes the > HEALTH_FACTOR_HEALTHY_THRESHOLD check back into formatHealthFactor would silently regress all three Greptile findings (action deltas would show Healthy → Healthy, repay preview would flip back to the Healthy vs - asymmetry, etc.).

A single test pins it:

// services/vault/src/applications/aave/utils/__tests__/healthFactorDisplay.test.ts
it("returns the raw number for high HF (delta callers depend on this)", () => {
  expect(formatHealthFactor(100)).toBe("100.00");
  expect(formatHealthFactor(50)).toBe("50.00");
});

No test file exists for this module today, so this would also seed the right home for future formatter tests.

overview: {
heading: "Overview",
healthFactorLabel: "Health factor",
healthFactorHealthy: "Healthy",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces the canonical key for the "Healthy" string — but STATUS_LABELS.safe in services/vault/src/components/shared/utils/healthFactorGauge.ts:10 still has "Healthy" inlined, and the gauge renders directly above this label in OverviewSection (same user, same screen). Not this PR's bug — it pre-dates — but this is the moment a canonical key exists, so worth pointing the gauge at it too. Otherwise a future copy change (e.g. "Healthy" → "Strong") silently de-syncs the two surfaces.

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.

3 participants