Commit Graph
11 Commits
Author SHA1 Message Date
Partouf 558a73ac1d remove unused isCompilationWorker 2025-08-07 16:49:14 +02:00
Partouf 130af6de12 Merge remote-tracking branch 'origin/main' into feat/compilation-workers 2025-08-07 15:46:20 +02:00
Matt Godbolt 8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Patrick Quist 4e8fc37a88 Merge branch 'main' into feat/compilation-workers 2025-06-29 15:43:29 +02:00
Mats Jun Larsen d147341663 Serve all static asset files over the CDN (#7795) 2025-06-28 14:01:36 +02:00
partoufandClaude 05b0af5c74 Add compilation worker mode infrastructure
This adds a new worker mode for compilation tasks similar to the existing execution worker architecture:

- Add SQS-based compilation queue infrastructure for regular and CMake compilations
- Implement RemoteCompilationEnvironment for client-side queue interaction
- Add worker startup logic in main.ts to detect and initialize compilation workers
- Create proper message types and serialization for compilation requests
- Implement WebSocket-based result delivery using existing EventsWsSender
- Add configuration properties for compilation worker mode
- Include structured logging and basic metrics for worker operations
- Update documentation with worker mode configuration details

The implementation supports:
- Dual queue system (regular compilation + CMake compilation)
- Configurable number of worker threads per queue type
- Language-aware compiler discovery and execution
- Comprehensive error handling and logging
- Backward compatible with existing compilation API

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 20:05:05 +01:00
Mats Jun Larsen a6e9541c73 Deduplicate csp/cached functions from middleware (#7813) 2025-06-16 09:54:11 -05:00
Matt GodboltandClaude d27d59fc1e Add DynamoDB support for Google URL shortener (#7724)
## Summary
- Add DynamoDB support to Google URL shortener to check in preference to goo.gl itself (which will be going away)
- Update ShortLinkResolver to accept AWS properties and use DynamoDB table `goo-gl-links`
- First check DynamoDB for fragment lookup before falling back to Google URL shortener (for now)
- Refactor resolve method to use async/await instead of raw promises for better readability
- Add awsProps to ServerDependencies and pass through component hierarchy
- Configure googleLinksDynamoTable property in AWS config files (defaults to empty)

## Implementation Details
- When `googleLinksDynamoTable` property is configured, `ShortLinkResolver` creates a DynamoDB client
- DynamoDB table uses `fragment` as the key and stores `expanded_url`
- Maintains backwards compatibility by falling back to Google URL (for now) shortener if DynamoDB is not configured or lookup fails
- Google URL shortener fallback will be removed in August 2025 when the service shuts down

## Test plan
- [x] All existing tests pass
- [x] TypeScript compilation succeeds
- [x] Linting passes
- [x] Updated tests to accommodate new awsProps parameter
- [x] Verify fallback to Google URL shortener when DynamoDB not
configured
- [x] Manual testing

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-26 16:24:04 -05:00
Matt GodboltandClaude 8106ccdad9 Fix static URL double slash issue in CDN asset paths (#7709)
## Summary
Fix production CDN loading issues where URLs like
`https://static.ce-cdn.net//vendor.v57...css` (double slash) were being
generated when the `staticUrl` config has a trailing slash.

## Root Cause
PR #7681 refactored static asset handling and replaced
`urljoin(staticRoot, path)` with `${staticRoot}/${path}` string
interpolation, losing URL normalization that `urljoin` provides.

## Changes
- Replace string interpolation with `urljoin()` in
`createDefaultPugRequireHandler()`
- Add comprehensive tests covering all trailing slash scenarios
- Maintain full backward compatibility with existing configurations

## Test plan
- [x] All existing tests pass
- [x] Added 4 new test cases for static URL handling with various slash
scenarios
- [x] Verified TypeScript compilation and linting
- [x] Tested production CDN scenario where
`staticUrl=https://static.ce-cdn.net/`

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-21 17:27:06 -05:00
Matt Godbolt a5903c0867 Fix issues introduced in #7681 (#7707)
- healthcheck got accidentally unwired
- CSP was accidentially "done" (was a TODO)
2025-05-21 16:20:51 -05:00
Matt Godbolt f94ff8332a Refactor: Split app.ts into smaller modules (#7681)
## Summary
This PR significantly improves maintainability by breaking up the 880+ line monolithic app.ts file into smaller, focused modules with proper testing. The code is now organized into dedicated modules under the lib/app/ directory, making the codebase more maintainable and testable.

## Key changes
- Extract functionality into modules under lib/app/ directory:
  - Command-line handling (cli.ts)
  - Configuration loading (config.ts)
  - Web server setup and middleware (server.ts)
  - Core application initialization (main.ts)
  - URL handlers, routing, rendering, and controllers
- Add comprehensive unit tests for all new modules
- Make compilationQueue non-optional in the compilation environment
- Improve separation of concerns with dedicated interfaces
- Ensure backward compatibility with existing functionality
- Maintain cross-platform compatibility (Windows/Linux)

## Benefits
- Improved code organization and modularity
- Enhanced testability with proper unit tests
- Better separation of concerns
- Reduced complexity in individual files
- Easier maintenance and future development

This refactoring is a significant step toward a more maintainable codebase while preserving all existing functionality.
2025-05-20 17:53:24 -05:00