Skip to content

Insert New Metrics at Their Default Position - #120

Merged
mstallone merged 2 commits into
mainfrom
feat/metric-default-order
Sep 5, 2026
Merged

Insert New Metrics at Their Default Position#120
mstallone merged 2 commits into
mainfrom
feat/metric-default-order

Conversation

@mstallone

Copy link
Copy Markdown
Owner

TL;DR

New metrics now land in the provider's default Customize slot instead of at the bottom. Existing installs one-time re-slot Cursor Grok Bot above Extra Usage and Grok Rate Limit Resets above usage history.

What was happening

  • When a new metric shipped, LayoutOrdering appended it to the saved metricOrderByProvider list, so it appeared at the bottom of Customize (and the dashboard) even when its declaration order put it in the middle.
  • Cursor Grok Bot and Grok Rate Limit Resets already shipped that way, so existing layouts still show them last.

What this changes

  • Insert newly introduced live metrics at their declaration-order slot, keeping the relative order of rows the user already has.
  • Add a v5 settings migration that relocates those two already-appended rows to the same slots. Frozen order lists stay with the migration so a later descriptor shuffle cannot rewrite it.
  • Document that new default metrics appear in the provider's default position, and that Grok's Rate Limit Resets sit above usage history like Codex.

Heads-up

  • The v5 step only rewrites a saved metricOrderByProvider. Fresh installs already declare the right order.
  • If someone had already dragged Grok Bot or Rate Limit Resets somewhere else, the one-time relocation still puts them at the declaration slot.

Tests

  • swift test --filter LayoutOrderingTests --filter SettingsMigratorTests

New rows were appended at the bottom of Customize. Place them in the
provider's default position, and one-time re-slot Cursor Grok Bot and
Grok Rate Limit Resets that already landed at the end.
@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.
Repo admins can enable using credits for code reviews in their settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The ordering change is well-contained, the migration is versioned/idempotent, and the PR adds targeted tests covering both insertion and the v5 re-slot behavior.

Pull request overview

This PR updates Runway’s layout ordering/migration logic so newly shipped metrics appear in their provider’s declaration-order position (instead of being appended to the bottom), and adds a one-time schema migration to re-slot two already-shipped metrics for existing installs.

Changes:

  • Update LayoutOrdering normalization to insert newly introduced metric IDs into saved orders at their canonical (declaration) slots.
  • Add a v5 settings migration to relocate cursor.grokBot and grok.rateLimitResets into their intended positions for existing layouts, using frozen “v5 canonical” order lists.
  • Add/adjust tests and documentation to cover the new ordering + migration behavior.
File summaries
File Description
Tests/RunwayTests/SettingsMigratorTests.swift Updates v4 assertions to use SettingsSchema.current and adds a v5 migration test validating the two row relocations.
Tests/RunwayTests/LayoutOrderingTests.swift Adds unit coverage for inserting, relocating, and the new “insert instead of append” normalization behavior.
Sources/Runway/Stores/LayoutBootstrap.swift Changes metric-order normalization to insert new live metrics at declaration-order slots; adds helper functions for insertion/relocation.
Sources/Runway/Stores/DefaultLayout.swift Updates comments/expanded defaults documentation to reflect Grok + Cursor row placement intent.
Sources/Runway/App/SettingsMigrator.swift Bumps schema to v5 and adds the migration step + frozen canonical orders for Cursor and Grok.
docs/dashboard.md Documents that new default metrics appear in the provider’s default position and clarifies Grok Rate Limit Resets placement.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mstallone
mstallone requested a lite review from Copilot September 5, 2026 02:44
@mstallone
mstallone merged commit 7384e5d into main Sep 5, 2026
3 checks passed
@mstallone
mstallone deleted the feat/metric-default-order branch September 5, 2026 02:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new v5 migration throws on JSON decode/encode failures, which can block the entire settings migration cascade for users with corrupted layout data.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +81 to 100
SettingsMigration(version: 5) { defaults in
let key = "runway.layout.v1.metricOrderByProvider"
guard let data = defaults.data(forKey: key) else { return }
var order = try JSONDecoder().decode([String: [String]].self, from: data)
if let cursor = order["cursor"] {
order["cursor"] = LayoutOrdering.relocating(
["cursor.grokBot"],
in: cursor,
canonical: v5CursorMetricOrder
)
}
if let grok = order["grok"] {
order["grok"] = LayoutOrdering.relocating(
["grok.rateLimitResets"],
in: grok,
canonical: v5GrokMetricOrder
)
}
defaults.set(try JSONEncoder().encode(order), forKey: key)
}
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.

2 participants