Skip to content

Task 9 — Add Beacon Editor Debug Window (inspect snapshot, validate JSON, simulate evaluation)#10

Open
KostasBan wants to merge 1 commit into
developmentfrom
codex/add-beacon-editor-debug-window
Open

Task 9 — Add Beacon Editor Debug Window (inspect snapshot, validate JSON, simulate evaluation)#10
KostasBan wants to merge 1 commit into
developmentfrom
codex/add-beacon-editor-debug-window

Conversation

@KostasBan

Copy link
Copy Markdown
Owner

Motivation

  • Provide high-signal, Editor-only tooling to inspect Beacon runtime state (snapshot/context), validate raw JSON configs, and simulate flag/value evaluation without changing runtime logic.
  • Make it safe to open in Edit Mode while enabling full inspection and refresh operations in Play Mode only.

Description

  • Added an Editor assembly and asmdef at Packages/com.kbanakakis.beacon/Editor/com.kbanakakis.beacon.Editor.asmdef to contain editor-only code referencing the runtime package.
  • Implemented BeaconDebugWindow in Packages/com.kbanakakis.beacon/Editor/BeaconDebugWindow.cs with a Tools/Beacon/Debug Window menu entry, Play Mode guarding, and UI panels for client selection, manual RefreshAsync, snapshot display, context display, JSON validation (uses BasicConfigValidator), flag evaluation (IsEnabled), and typed value reads (GetBool/GetInt/GetFloat/GetString).
  • Added auto-find logic to locate a scene MonoBehaviour exposing a BeaconClient and IContextProvider via reflection with try/catch guarding to avoid editor exceptions, and included Unity .meta files for the new Editor assets.

Testing

  • Ran a JSON parse check for the new asmdef using python to confirm Packages/com.kbanakakis.beacon/Editor/com.kbanakakis.beacon.Editor.asmdef is valid JSON, and it passed.
  • No Unity Editor compile or play-mode integration tests were run in this automated check set.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 893deca96a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +111 to +115
if (!Application.isPlaying)
{
EditorGUILayout.HelpBox("Enter Play Mode to inspect runtime client.", MessageType.Info);
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep JSON validation available in Edit Mode

OnGUI returns immediately when !Application.isPlaying, which prevents DrawJsonValidationPanel() from ever rendering outside Play Mode even though ValidateJson does not depend on a live BeaconClient. In practice this blocks the offline config-check workflow (pasting raw JSON before running the game), so the new validator is unavailable in a common use case.

Useful? React with 👍 / 👎.

Comment on lines +375 to +377
if (memberValue is IContextProvider contextProvider)
{
context = contextProvider.GetContext();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Catch context-provider exceptions during auto-resolve

TryResolveClientAndContextFromSource catches reflection access errors, but contextProvider.GetContext() is called outside that protection. If a selected/auto-found IContextProvider throws (e.g., while runtime state is not ready), the exception will propagate during window repaint or Auto-find and make the debug window fail instead of gracefully skipping that source.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant