Before #7797, elements such as “Toggle full version output” in the
compiler version popup or the share buttons (“Short Link” etc.) would
change the cursor to a pointer on hover (like normal links do), but this
was lost when they were switched to use `link-primary`.
This PR restores the previous behaviour.
This adds some unit tests for the front end.
- configures "frontend tests" as a unit tests in `static/tests`,
removing the old cypress-requiring "unit" tests
- hack enough of a DOM to get things working
- port motd and id tests
- *adds* a golden layout checks (see #7807)
- Updates READMEs etc
---------
Co-authored-by: Claude <noreply@anthropic.com>
Root cause: Source mapping happens AFTER beforeSend/ignoreErrors processing, so
frame.filename contains minified bundle paths, not readable source paths.
Changes:
- Add 'Canceled' to ignoreErrors array for clipboard cancellation errors
- Remove frame-based clipboard filtering (doesn't work with minified code)
- Add comprehensive comments explaining source mapping timing issue
- Keep hit testing filter using error message content (works with minified code)
- Document that frame-based filtering is unreliable for Monaco errors
This should finally stop the 20k+ COMPILER-EXPLORER-CGQ clipboard cancellation errors.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Adds Sentry debugging to capture actual runtime filter data including:
- Error value and type received by filter
- Frame filenames array
- Boolean results of hasClipboardFrame and isCancellationError checks
- Whether filter should have triggered
This will help identify why the filter isn't working despite appearing correct.
Will be removed once issue is identified.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Summary
Fixed the clipboard cancellation filter that was deployed but not
working due to `SentryCapture` context modification.
## Root Cause
The filter was checking for exact equality:
```typescript
event.exception.values[0].value === 'Canceled'
```
But `SentryCapture()` modifies error messages by adding context:
- Original: `"Canceled"`
- Modified: `"Canceled\nSentryCapture Context: Unhandled Promise
Rejection"`
## Solution
Changed to use `startsWith('Canceled')` which:
- ✅ Catches original error: `"Canceled"`
- ✅ Catches modified error: `"Canceled\nSentryCapture Context: ..."`
- ✅ More precise than `includes()` - reduces false positives
- ✅ Still combined with specific stack trace check for safety
## Test Plan
- [x] TypeScript type checking passes
- [x] Pre-commit hooks pass
- [ ] Deploy and verify clipboard cancellation errors are filtered
This should finally stop the 20k+ COMPILER-EXPLORER-CGQ occurrences.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Fixed two Monaco Editor error filters that weren't working due to
misunderstanding the Sentry event structure:
• **COMPILER-EXPLORER-CGQ (Clipboard cancellation)**: Filter was
checking for `'Canceled: Canceled'` but actual error value is just
`'Canceled'`
• **COMPILER-EXPLORER-AXA (Hit testing)**: Filter was checking
`frames[0].function` but due to Sentry wrapping, the function name
appears in the error message instead
## Root Cause
The key insight was examining the actual JSON from Sentry UI rather than
making assumptions:
- Sentry UI displays "type: value" format but JSON has separate `type`
and `value` fields
- `frames[0]` is often Sentry's wrapper (`sentryWrapped`), not the
original error source
- Function names may appear in error messages rather than frame metadata
## Changes
1. **Fixed clipboard filter**: Changed error value check from
`'Canceled: Canceled'` to `'Canceled'`
2. **Fixed hit testing filter**: Changed from checking
`frames[0].function` to checking error message content
3. **Added debugging comments**: Comprehensive notes for future Sentry
filter debugging
## Test Plan
- [x] TypeScript type checking passes
- [x] Minimal test suite passes
- [x] Pre-commit hooks pass
- [ ] Deploy and verify errors are filtered in production
Both issues have 10k+ occurrences so this should significantly reduce
Sentry noise.
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
- Adds `beforeSend` filter to suppress Monaco Editor clipboard
cancellation errors from Sentry
- Specifically targets "Canceled: Canceled" errors from
`monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js`
- Fixes Sentry issue COMPILER-EXPLORER-CGQ which has 20,139+ occurrences
but 0 user impact
## Problem
The Monaco Editor clipboard service generates cancellation errors when
clipboard operations are interrupted (e.g., user navigates away during
copy operation). These represent expected behavior rather than
actionable bugs, but were creating noise in Sentry with thousands of
error reports.
## Solution
Following the pattern established in PR #7830, this adds a `beforeSend`
filter that:
1. Checks if the error message is "Canceled: Canceled"
2. Verifies the stack trace contains the Monaco clipboard service file
3. Filters out the error if both conditions are met
## Test Plan
- [x] TypeScript compilation passes (`npm run ts-check`)
- [x] Linting passes (`npm run lint`)
- [x] Minimal test suite passes (`npm run test-min`)
- [x] Pre-commit hooks executed successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
## Summary
- Fixes unhandled promise rejections being logged as "Non-Error capture"
in Sentry issue COMPILER-EXPLORER-BT9
- Converts all promise rejections to use proper Error objects instead of
plain objects/strings/undefined
- Adds defensive handling in Sentry's unhandled rejection listener
## Root Cause
The Sentry issue was caused by services rejecting promises with
non-Error objects:
- `CompilerService.handleRequestError()` rejected with `{request,
error}` plain objects
- Various other services rejected with strings or undefined values
- These triggered the global unhandled rejection handler, which logged
them as "Non-Error capture"
## Changes Made
1. **CompilerService**: Modified `handleRequestError()` to reject with
Error objects while preserving request context
2. **Sentry**: Enhanced unhandled rejection handler to defensively
convert non-Error reasons to Error objects
3. **MultifileService**: Changed string rejections to Error objects
4. **SharingService**: Added descriptive Error objects for link failures
5. **TreePane**: Used Error objects for user cancellation scenarios
6. **CfgView**: Used Error objects for canvas blob creation failures
## Test Plan
- [x] TypeScript compilation passes
- [x] All tests pass (npm run test-min)
- [x] Linter passes
- [x] Pre-commit hooks validated
## Impact
- Reduces Sentry noise from "Non-Error capture" events
- Provides better stack traces for debugging
- Maintains backwards compatibility (consuming code handles both Error
objects and other types)
- More robust error handling throughout the application
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
- Replace broken regex filter with proper `beforeSend` handler for
Monaco Editor errors
- Fixes noise from Monaco Editor hit testing bug in Firefox (190K+
occurrences)
- Uses structured stack frame checking instead of string parsing
## Root Cause
COMPILER-EXPLORER-AXA was caused by a known Monaco Editor bug in Firefox
where hit testing fails with null reference errors during mouse
operations. The existing regex filter `/i is null
_doHitTestWithCaretPositionFromPoint/` was ineffective because Sentry's
`ignoreErrors` only matches error messages, not stack traces.
## Solution
Added a `beforeSend` callback that:
- Checks if the top stack frame function is
`_doHitTestWithCaretPositionFromPoint`
- Filters out any error thrown directly from this Monaco Editor function
- Uses Sentry's structured stack frames for reliable detection
## References
- Fixes Sentry issue: COMPILER-EXPLORER-AXA (190K+ occurrences)
- Related Monaco Editor bug:
https://github.com/microsoft/monaco-editor/issues/4527
## Test plan
- [x] TypeScript checks pass
- [x] Test suite passes
- [x] Pre-commit hooks pass
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
## Summary
This PR significantly improves type safety for GoldenLayout
configurations, continuing work from issue #4490 "The War of The Types".
This is an **incremental improvement** that establishes a solid
foundation for future work.
## ✅ What We've Accomplished
### Core Type Infrastructure
- **Created comprehensive type system** in
`static/components.interfaces.ts`
- **Added `ComponentConfig<K>`** with proper generic constraints for
type-safe component configurations
- **Added `GoldenLayoutConfig`** to replace unsafe `any[]` content with
strongly-typed `ItemConfig[]`
- **Created `ComponentStateMap`** mapping component names to their
expected state types
- **Added proper TypeScript component name constants** with `as const`
for literal type inference
### Component Configuration Type Safety
- **All component factory functions** now return strongly-typed
configurations
- **Clean type syntax**: `ComponentConfig<'compiler'>` using the
exported constants
- **Eliminated unsafe casts** in component creation and drag source
setup
- **Fixed hub method signatures** that incorrectly expected
`ContentItem` instead of `ItemConfig`
### Bug Fixes and Code Quality
- **Fixed Jeremy's TODO**: Improved `fixBugsInConfig` function typing
- **Discovered and fixed hub type bug**:
`addAtRoot`/`addInEditorStackIfPossible` now accept correct types
- **Removed legacy conversion functions** that were no longer needed
- **Replaced verbose TODO comments** with GitHub issue references for
better organization
### Documentation and Planning
- **Created GitHub issues**
[#7807](https://github.com/compiler-explorer/compiler-explorer/issues/7807)
and
[#7808](https://github.com/compiler-explorer/compiler-explorer/issues/7808)
for remaining work
- **Documented type safety approach** with clear explanations of design
decisions
- **Added comprehensive implementation notes** for future contributors
## 🚧 What's Next (GitHub Issues)
- **Issue #7807**: [Type-safe
serialization/deserialization](https://github.com/compiler-explorer/compiler-explorer/issues/7807)
- localStorage persistence and URL sharing
- SerializedLayoutState implementation
- Version migration support
- **Issue #7808**: [Configuration validation and remaining type
gaps](https://github.com/compiler-explorer/compiler-explorer/issues/7808)
- Enable `fromGoldenLayoutConfig` validation
- Fix upstream GoldenLayout TypeScript definitions
- State type normalization (addresses #4490)
## 📊 Impact
### Type Safety Improvements
- **No more `any` casts** in component configuration creation
- **Compile-time validation** of component names and state types
- **Better IDE support** with autocomplete and type checking
- **Runtime safety** through proper TypeScript interfaces
### Code Quality
- **~100 lines of verbose TODO comments** replaced with concise GitHub
issue references
- **Technical debt reduction** through elimination of unsafe casting
patterns
- **Improved maintainability** with centralized type definitions
- **Better error messages** when component configurations are incorrect
### Files Modified
- `static/components.interfaces.ts` - Core type definitions
- `static/components.ts` - Component factory functions and utilities
- `static/main.ts` - Layout initialization and configuration handling
- `static/hub.ts` - Fixed method signatures
- `static/panes/*.ts` - Updated component creation patterns
## ✅ Testing & Validation
- **All existing tests pass** - no runtime regressions
- **TypeScript compilation succeeds** with strict type checking
- **Linting passes** with no new warnings
- **Pre-commit hooks validated** all changes
- **Manual testing confirmed** layout functionality works correctly
## 🎯 Ready to Merge
This PR represents a **significant incremental improvement** that:
- ✅ **Provides immediate value** through better type safety
- ✅ **Maintains full backward compatibility**
- ✅ **Establishes solid foundation** for future improvements
- ✅ **Centralizes remaining work** in well-documented GitHub issues
- ✅ **Ready for production use** with no runtime changes
The remaining work is clearly tracked in the linked GitHub issues and
can be tackled incrementally in future PRs.
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
- Removes `rootDirs` so all imports will be relative in the frontend
- Updates (and unifies) imports to be `../types/...` etc instead of
relying on "types" being in the rootDir for the frontend.
- Fixes one type that was being picked up from `lib` in the frontend.
- Adds a precommit hook to check in future
Paves the way to writing _unit_ tests for the frontend for the subset of
the frontend code we can import from `node` (which might be a lot of
it!)
#7766 changed the Monaco language identifier for Rust, but missed a spot
in `formatter-registry.ts`, so now Monaco can’t autoformat (right click
→ “Format Document”) Rust code any more.
Fixes#7792
Bootstrap styles `a:has([href])` as a link so the attribute had been
used in the past for things that aren't actually links, yet we want the
style for. It's better to just use `.link-primary` so it doesn't affect
the contents as discovered in #7792
Updated all packages with npm update -S. Removed deprecated
@types/url-join
Fixed TypeScript error caused by package updates:
- The `at()` method is ES2022, but frontend code targets ES5 for
compatibility
- Changed `this.compilerPickers.at(-1)` to
`this.compilerPickers[this.compilerPickers.length - 1]`
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Fixes COMPILER-EXPLORER-3W3: Prevents "Can't remove child item. Unknown
content item" errors (4830 occurrences) when attempting to close
containers that have already been destroyed or removed from the layout
hierarchy.
- Uses modern TypeScript optional chaining to check container validity
before close operations
- Prevents race conditions between compiler close events and
GoldenLayout's destruction process
- Addresses issue where deferred `container.close()` calls were
executing on already-destroyed containers
## Root Cause
The error occurred when:
1. A compiler close event triggers `onCompilerClose()` which defers
`container.close()`
2. Meanwhile, GoldenLayout destroys the container through its own
process
3. The deferred close attempt executes on an already-destroyed
container, causing the GoldenLayout error
## Test plan
- [ ] Open multiple compiler panes with associated tool/output panes
- [ ] Quickly close compilers while panes are still loading/updating
- [ ] Verify no "Can't remove child item" errors appear in console
- [ ] Verify panes still close properly in normal scenarios
🤖 Generated with [Claude Code](https://claude.ai/code)
## Summary
Fixes two related null reference errors in the GCC dump view's TomSelect
dropdown handling that occur during user interactions.
## Root Cause Analysis
**COMPILER-EXPLORER-96P** (1067 occurrences):
- Error: `TypeError: undefined is not an object (evaluating
't.filename_suffix')`
- Location: `gccdump-view.ts:318` in `onPassSelect()`
- Trigger: User deletes a selection via TomSelect → `deleteSelection()`
→ `removeItem()` → `trigger('change')` → `onPassSelect()` called with
passId that no longer exists in `this.selectize.options`
**COMPILER-EXPLORER-E44** (34 occurrences):
- Error: `TypeError: Cannot read properties of undefined (reading '0')`
- Location: `gccdump-view.ts:237` in dropdown open handler
- Trigger: `find()` returns undefined when searching for pass by
filename_suffix, but code uses non-null assertion `activeOption![0]`
Both errors occur due to timing issues when dropdown options are being
updated while user interactions are happening.
## Changes
1. **Added null check in `onPassSelect()`**: Safely handle case where
`this.selectize.options[passId]` returns undefined
2. **Removed unsafe non-null assertion**: Replace `activeOption![0]`
with proper null check and early return
3. **Added CLAUDE.md guidance**: Include preference for modern
TypeScript features like optional chaining
## Impact
- Prevents crashes with 1100+ reported occurrences combined
- Maintains existing user experience - dropdowns continue to work
normally
- No behavioral changes for valid interactions
Fixes COMPILER-EXPLORER-96P
Fixes COMPILER-EXPLORER-E44
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Fixes issue #7684 where dropdown menus displayed two arrows instead of
one, particularly visible in light theme.
## Root Cause
The double arrows were caused by conflicts between:
1. **TomSelect's Bootstrap 5 theme** - provides automatic dropdown
arrows via `background-image`
2. **Custom legacy CSS** - was adding duplicate arrows using `::after`
pseudo-elements
3. **Bootstrap 4 leftovers** - manual `<b class="caret">` elements in
templates
## Changes
- **Removed conflicting custom TomSelect arrow CSS** from
`explorer.scss`
- **Removed leftover `#[b.caret]` element** from font-size dropdown
template
- **Fixed theme background properties** - changed `background` to
`background-color` to preserve TomSelect's arrow images
- **Added reusable SCSS function** `dropdown-arrow-svg()` for generating
themed dropdown arrows
- **Updated dark themes** to override arrow colors using TomSelect's
exact CSS selector for precision
## Test Plan
- [x] Verify all dropdown menus show only one arrow in default/light
theme
- [x] Test dropdown arrows are visible and correctly colored in all
themes:
- [x] Default theme: dark gray arrow
- [x] Pink theme: dark gray arrow
- [x] Dark theme: light gray arrow
- [x] One-dark theme: medium gray arrow
- [x] Confirm dropdown functionality works correctly across all themes
- [x] Check that font-size dropdown works properly without manual caret
element
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Fixes COMPILER-EXPLORER-BY7: TypeError accessing 'blocks' property of
undefined layout when clicking zoom-out button before any CFG has been
generated.
- Uses modern TypeScript optional chaining for null-safe access
- Prevents crashes when users click zoom-out before compiling code
## Test plan
- [ ] Load CFG view pane
- [ ] Click zoom-out button before generating any CFG (should not crash)
- [ ] Generate a CFG and verify zoom-out still works as expected
🤖 Generated with [Claude Code](https://claude.ai/code)
## Summary
- Fixes syntax highlighting issue where Rust hex literals with
underscores after hex letters (like `0x01_02_0a_0b`) would lose
highlighting after the underscore
- Created custom Rust language mode (`rustp`) that patches Monaco's
built-in tokenizer
- Filed upstream issue with Monaco Editor:
https://github.com/microsoft/monaco-editor/issues/4917
## Test plan
- [x] Verified fix works locally with test cases like `0x01_02_0a_0b`,
`0xFF_AA_BB_CC`, etc.
- [x] Confirmed all existing tests pass
- [x] Checked that TypeScript compilation and linting pass
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Fixes `TypeError: Cannot read properties of undefined (reading
'content')` in `findConfig()` when URL parsing fails and no saved state
is available.
## Root Cause
This error occurs when:
1. `url.deserialiseState()` throws an exception due to
malformed/corrupted URLs
2. No saved state exists in localStorage
(`sessionThenLocalStorage.get('gl', null)` returns `null`)
3. Code attempts to access `config.content` when `config` is still
`undefined`
The error happens legitimately from truncated URLs, corrupted bookmarks,
or URL shortener issues.
## Changes
- Changed `if (!config.content || config.content.length === 0)` to use
optional chaining: `if (!config?.content || config.content?.length ===
0)`
- This gracefully handles the null/undefined case and falls back to
default config as intended
## Impact
- Maintains existing user experience (fallback to default config when
URL parsing fails)
- Prevents crash with 1430+ reported occurrences
- No behavioral changes for valid URLs
Fixes COMPILER-EXPLORER-DE3
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
- Fix TypeError when diff pane receives execution results before
compiler is registered
- Add null check to prevent crash and gracefully handle race condition
## Description
This PR fixes issue #7761 where a `TypeError: Cannot set properties of
null (setting 'compiler')` occurs in the diff pane.
### The Problem
A race condition can occur where:
1. An executor pane resends its results (e.g., during layout
initialization)
2. The diff pane receives the `executeResult` event
3. The diff pane tries to update its state, but `this.compiler` is still
null
4. The code crashes trying to set `this.compiler.compiler = compiler`
### The Solution
Add a null check in the `update` method of `DiffStateObject`. If
`this.compiler` is null, we simply ignore the update and return false.
This is safe because:
- When `onCompiler` is eventually called, it will properly initialize
the compiler
- `onCompiler` calls `onDiffSelect()` which calls
`requestResendResult()`
- This will re-request the compilation/execution results
- By then, the compiler will be properly initialized and the update will
succeed
### Testing
- TypeScript checks pass
- Linting passes
- The fix prevents the crash while maintaining correct behavior
Fixes#7761🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixes a subtle breakage from the bootstrap migration: The motd close
button works for update/motds but not community ads. This PR cleans up
the duplicate code and subsequent deviation.
Fixes issues with missing components (e.g. from beta, 'explain')
The issue was that the exceptions are thrown in `initLayout`, not in the
constructor.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR adds support for the Mojo programming language.
Explicitly tested viewing the generated assembly, LLVM IR, and running
the generated executable.