Skip to content

feat(tui): add cloud settings screen and docs#607

Open
mgaldamez wants to merge 3 commits into
Gentleman-Programming:mainfrom
mgaldamez:feat/tui-cloud-config-01-nav-docs
Open

feat(tui): add cloud settings screen and docs#607
mgaldamez wants to merge 3 commits into
Gentleman-Programming:mainfrom
mgaldamez:feat/tui-cloud-config-01-nav-docs

Conversation

@mgaldamez

@mgaldamez mgaldamez commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Adds the Cloud sync settings entry to the TUI dashboard with a sub-menu (Configure server / View status / Enroll projects / Back), and updates the troubleshooting docs to document the intentional cloud.json.token fallback.

Spec

  • REQ-NAV-01 (dashboard entry + Cloud Settings navigation)
  • REQ-DOCS-01 (token fallback documentation)

What's included

  • 8ed5031 feat(tui): add cloud settings screen and dashboard entry
  • 1e48b10 docs(cloud): document cloud.json.token fallback policy

Test evidence

  • go test ./... passes
  • Coverage on changed files: 99.5% in internal/tui
  • go vet ./... clean

Merge order

This is PR 1 of 6 in the tui-cloud-config feature delivery. Suggested order:

  1. PR 1 (this) — nav + docs feat(tui): add cloud settings screen and docs #607
  2. PR 2 — config form + ping + save feat(tui): add cloud config form, ping command, and save flow #608
  3. PR 3 — status view feat(tui): add cloud status view #609
  4. PR 4 — enrollment toggles feat(tui): add project enrollment toggles #610
  5. PR 5 — test fixes test(tui): close coverage gaps and harden env-var tests #611
  6. PR 6 — CLI parity feat(tui): add CLI parity fields to cloud status view #612

All 6 PRs target main. After merging PR N, GitHub's "Update branch" button on PR N+1 will refresh the diff to show only that PR's changes.

Issue link

Part of #577

Summary by CodeRabbit

  • New Features

    • Added a dedicated Cloud sync settings screen to the dashboard.
    • Added menu navigation with keyboard controls, including Back, Escape, and Quit options.
    • Improved dashboard menu presentation and navigation guidance.
  • Documentation

    • Clarified cloud authentication token precedence and fallback behavior, including background autosync scenarios.

Copilot AI review requested due to automatic review settings July 14, 2026 03:31
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a TUI Cloud sync settings screen with dashboard navigation, submenu controls, shared menu rendering, tests, and documentation for cloud token precedence and fallback behavior.

Changes

Cloud sync settings

Layer / File(s) Summary
Screen state and navigation
internal/tui/model.go, internal/tui/update.go, internal/tui/*_test.go, docs/engram-cloud/troubleshooting.md
Adds ScreenCloudSettings, dashboard and submenu navigation, exit handling, uniqueness tests, navigation coverage, and token fallback documentation.
Screen rendering and routing
internal/tui/view.go, internal/tui/view_test.go
Routes and renders the cloud settings screen, introduces shared menu rendering, and extends screen view coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • Gentleman-Programming/engram#577 — Adds the planned TUI Cloud sync settings entry/submenu and documents token precedence.

Suggested labels: type:feature

Suggested reviewers: copilot, alan-thegentleman

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a TUI cloud settings screen and related documentation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

Pull request overview

Adds a new Cloud sync settings entry point to the TUI dashboard and introduces a dedicated Cloud Settings menu screen, while updating cloud troubleshooting docs to explicitly document the intentional cloud.json.token fallback behavior.

Changes:

  • Added a new ScreenCloudSettings screen with a Cloud Settings menu view and key handling, plus a shared renderMenu helper to reduce duplicated menu rendering logic.
  • Updated TUI routing and tests to cover the new screen and the dashboard navigation path into/out of Cloud Settings.
  • Updated cloud troubleshooting docs to clarify token precedence (ENGRAM_CLOUD_TOKEN over cloud.json.token) and the rationale for the fallback.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/tui/model.go Adds ScreenCloudSettings to the screen enum.
internal/tui/model_test.go Adds coverage to ensure the new screen constant is unique/consistent.
internal/tui/update.go Adds dashboard menu item, Cloud Settings submenu items, and key handling/router integration.
internal/tui/update_test.go Adds navigation/menu tests for the new Cloud Settings screen (with a couple brittle index assumptions).
internal/tui/view.go Adds Cloud Settings view and factors out a reusable renderMenu helper.
internal/tui/view_test.go Extends view-router coverage to include the new screen.
docs/engram-cloud/troubleshooting.md Documents the intentional cloud.json.token fallback and env-var precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +234 to +237
func TestCloudSettingsNavigation(t *testing.T) {
m := New(nil, "")
m.Cursor = 4 // Cloud sync settings

Comment on lines +310 to +313
m = New(nil, "")
m.Screen = ScreenCloudSettings
m.Cursor = 3 // Back
updatedModel, cmd := m.handleCloudSettingsKeys("enter")

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/tui/update_test.go`:
- Around line 310-321: Add test coverage alongside the existing cloud-settings
key handling test for an unimplemented item such as m.Cursor = 0, verifying both
“enter” and “space” return the unchanged Model and a nil command. Keep the
existing ScreenDashboard and refresh-command assertions for the Back item
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f363ddb3-6837-4c6f-9f2c-61f766abca4c

📥 Commits

Reviewing files that changed from the base of the PR and between be4b613 and 1e48b10.

📒 Files selected for processing (7)
  • docs/engram-cloud/troubleshooting.md
  • internal/tui/model.go
  • internal/tui/model_test.go
  • internal/tui/update.go
  • internal/tui/update_test.go
  • internal/tui/view.go
  • internal/tui/view_test.go

Comment on lines +310 to +321
m = New(nil, "")
m.Screen = ScreenCloudSettings
m.Cursor = 3 // Back
updatedModel, cmd := m.handleCloudSettingsKeys("enter")
updated = updatedModel.(Model)
if updated.Screen != ScreenDashboard {
t.Fatalf("enter on Back should return to dashboard, got %v", updated.Screen)
}
if cmd == nil {
t.Fatal("enter on Back should refresh stats")
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add coverage for selecting unimplemented menu items.

As per path instructions for **/*_test.go, please verify coverage of edge cases. The test covers pressing "enter" on the "Back" item (m.Cursor = 3), but lacks an assertion for pressing "enter" or "space" on the currently unimplemented items (e.g., m.Cursor = 0). Verify that selecting these items safely acts as a no-op (returning the model unchanged with a nil command) to prevent regressions in future PRs.

🧪 Proposed test addition
 	if cmd == nil {
 		t.Fatal("enter on Back should refresh stats")
 	}
+
+	m = New(nil, "")
+	m.Screen = ScreenCloudSettings
+	m.Cursor = 0 // Configure server
+	updatedModel, cmd = m.handleCloudSettingsKeys("enter")
+	updated = updatedModel.(Model)
+	if updated.Screen != ScreenCloudSettings {
+		t.Fatalf("enter on unimplemented item should not change screen, got %v", updated.Screen)
+	}
+	if cmd != nil {
+		t.Fatal("enter on unimplemented item should return nil command")
+	}
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
m = New(nil, "")
m.Screen = ScreenCloudSettings
m.Cursor = 3 // Back
updatedModel, cmd := m.handleCloudSettingsKeys("enter")
updated = updatedModel.(Model)
if updated.Screen != ScreenDashboard {
t.Fatalf("enter on Back should return to dashboard, got %v", updated.Screen)
}
if cmd == nil {
t.Fatal("enter on Back should refresh stats")
}
}
m = New(nil, "")
m.Screen = ScreenCloudSettings
m.Cursor = 3 // Back
updatedModel, cmd := m.handleCloudSettingsKeys("enter")
updated = updatedModel.(Model)
if updated.Screen != ScreenDashboard {
t.Fatalf("enter on Back should return to dashboard, got %v", updated.Screen)
}
if cmd == nil {
t.Fatal("enter on Back should refresh stats")
}
m = New(nil, "")
m.Screen = ScreenCloudSettings
m.Cursor = 0 // Configure server
updatedModel, cmd = m.handleCloudSettingsKeys("enter")
updated = updatedModel.(Model)
if updated.Screen != ScreenCloudSettings {
t.Fatalf("enter on unimplemented item should not change screen, got %v", updated.Screen)
}
if cmd != nil {
t.Fatal("enter on unimplemented item should return nil command")
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/tui/update_test.go` around lines 310 - 321, Add test coverage
alongside the existing cloud-settings key handling test for an unimplemented
item such as m.Cursor = 0, verifying both “enter” and “space” return the
unchanged Model and a nil command. Keep the existing ScreenDashboard and
refresh-command assertions for the Back item unchanged.

Source: Path instructions

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