Skip to content

Commit d771af7

Browse files
authored
Merge pull request #467 from factorial-io/next
Version 0.2.0
2 parents 1124bb3 + 0fd4e4f commit d771af7

File tree

368 files changed

+40025
-3965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+40025
-3965
lines changed

.beads/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SQLite databases
2+
*.db
3+
*.db-journal
4+
*.db-wal
5+
*.db-shm
6+
7+
# Daemon runtime files
8+
daemon.lock
9+
daemon.log
10+
daemon.pid
11+
bd.sock
12+
13+
# Legacy database files
14+
db.sqlite
15+
bd.db
16+
17+
# Keep JSONL exports and config (source of truth for git)
18+
!*.jsonl
19+
!metadata.json
20+
!config.json
21+
22+
minibeads.lock
23+
command_history.log

.beads/config-minibeads.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Minibeads-specific configuration options
2+
# This file contains options that are NOT compatible with upstream bd
3+
4+
# Use hash-based issue IDs instead of sequential numbers
5+
# When true, issues are named like: prefix-a1b2c3 (based on content hash)
6+
# When false, issues are named like: prefix-1, prefix-2, ... (sequential)
7+
# Default: false
8+
mb-hash-ids: true

.beads/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
issue-prefix: scotty

.beads/issues/scotty-01528.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Write integration tests for domain assignments
3+
status: closed
4+
priority: 2
5+
issue_type: task
6+
labels:
7+
- authorization
8+
- enhancement
9+
- testing
10+
created_at: 2025-11-08T17:23:53.043535+00:00
11+
updated_at: 2025-11-24T20:17:25.558374+00:00
12+
closed_at: 2025-11-09T00:11:30.175622+00:00
13+
---
14+
15+
# Description
16+
17+
Create scotty/tests/authorization_domain_test.rs.
18+
19+
Test scenarios:
20+
- Load config with domain assignments
21+
- Mock OAuth users with various email domains
22+
- Verify permission resolution (exact match, domain match, no match)
23+
- Test API endpoints (create/list domain assignments)
24+
- Test validation errors for invalid domain patterns
25+
26+
Part of domain-based authorization implementation (scotty-5840d)

.beads/issues/scotty-047bf.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Frontend container log viewer UI
3+
status: closed
4+
priority: 2
5+
issue_type: feature
6+
depends_on:
7+
scotty-541fa: parent-child
8+
created_at: 2025-10-24T22:58:21.905260+00:00
9+
updated_at: 2025-11-24T20:17:25.571039+00:00
10+
closed_at: 2025-10-24T23:06:56.395577+00:00
11+
---
12+
13+
# Description
14+
15+
Add UI to view container logs in the web frontend. Backend log streaming API is complete with WebSocket support, but frontend has no log viewer component.
16+
17+
# Design
18+
19+
- Create log viewer component similar to unified-output.svelte
20+
- Add WebSocket handlers for LogLineReceived/LogStreamStarted/LogStreamEnded messages
21+
- Add log viewer page or modal accessible from app detail page
22+
- Support follow mode, timestamps, line limits
23+
- Reuse webSocketStore.ts infrastructure
24+
25+
# Acceptance Criteria
26+
27+
- Can view historical logs for any service
28+
- Follow mode for real-time streaming
29+
- Toggle timestamps on/off
30+
- Auto-scroll control
31+
- Copy logs to clipboard
32+
- Integration from app detail page

.beads/issues/scotty-06fec.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Create metrics module with ScottyMetrics struct
3+
status: closed
4+
priority: 1
5+
issue_type: task
6+
depends_on:
7+
scotty-6feea: parent-child
8+
scotty-e2060: blocks
9+
created_at: 2025-10-24T23:28:15.721881+00:00
10+
updated_at: 2025-11-24T20:17:25.578481+00:00
11+
closed_at: 2025-10-24T23:50:03.687196+00:00
12+
---
13+
14+
# Description
15+
16+
Create scotty/src/metrics/mod.rs with ScottyMetrics struct containing all metric instruments (counters, gauges, histograms) for unified output system monitoring.
17+
18+
# Design
19+
20+
Create metrics module with:
21+
- ScottyMetrics struct with all instruments
22+
- init_metrics() function to set up OTLP exporter
23+
- Metrics for: log streams, shell sessions, WebSocket, tasks, system health
24+
- Uses opentelemetry::metrics API (Counter, Gauge, Histogram)
25+
26+
# Acceptance Criteria
27+
28+
- metrics/mod.rs created and compiles
29+
- ScottyMetrics struct has all planned metrics
30+
- init_metrics() successfully initializes MeterProvider
31+
- Metrics can be recorded without panics

.beads/issues/scotty-09a99.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: Wrap large configuration structures in Arc
3+
status: open
4+
priority: 1
5+
issue_type: task
6+
labels:
7+
- performance
8+
- refactoring
9+
created_at: 2025-10-26T20:21:10.606337+00:00
10+
updated_at: 2025-11-24T20:17:25.587875+00:00
11+
---
12+
13+
# Description
14+
15+
Settings struct contains large nested HashMaps (blueprints, registries) that get cloned unnecessarily. Wrapping them in Arc would reduce clone overhead.
16+
17+
# Design
18+
19+
Location: scotty-core/src/settings/apps.rs
20+
21+
Settings contains large, rarely modified structures that are cloned when Settings is cloned.
22+
23+
Proposed solution:
24+
```rust
25+
#[derive(Clone)]
26+
pub struct Apps {
27+
pub root_folder: String,
28+
pub blueprints: Arc<HashMap<String, AppBlueprint>>, // Large, rarely modified
29+
// ...
30+
}
31+
```
32+
33+
Impact: Reduce Settings clone overhead
34+
Effort: 1-2 hours

.beads/issues/scotty-104e0.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Add timeout to Docker command execution
3+
status: open
4+
priority: 1
5+
issue_type: task
6+
labels:
7+
- docker
8+
- stability
9+
created_at: 2025-10-26T20:21:10.406194+00:00
10+
updated_at: 2025-11-24T20:17:25.552589+00:00
11+
---
12+
13+
# Description
14+
15+
Docker commands currently have no timeout and could hang indefinitely if Docker daemon becomes unresponsive.
16+
17+
# Design
18+
19+
Location: scotty/src/docker/docker_compose.rs:88
20+
21+
Current code:
22+
```rust
23+
let output = cmd.output()?; // No timeout
24+
```
25+
26+
Proposed solution:
27+
```rust
28+
use tokio::time::timeout;
29+
30+
let output = timeout(
31+
Duration::from_secs(300), // 5 minute timeout
32+
tokio::process::Command::new("docker-compose")
33+
.args(command)
34+
.output()
35+
).await??;
36+
```
37+
38+
Impact: Prevents indefinite hangs on Docker failures
39+
Effort: 1-2 hours

.beads/issues/scotty-14b43.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Add TaskManager metrics for task tracking
3+
status: closed
4+
priority: 2
5+
issue_type: task
6+
depends_on:
7+
scotty-06fec: blocks
8+
created_at: 2025-10-25T00:37:07.454119+00:00
9+
updated_at: 2025-11-24T20:17:25.572273+00:00
10+
closed_at: 2025-10-25T13:29:19.632177+00:00
11+
---
12+
13+
# Description
14+
15+
Instrument TaskManager to track number of tasks, their states (running/finished/failed), durations, and success rates.
16+
17+
# Design
18+
19+
Add TaskManager metrics to ScottyMetrics struct:
20+
- tasks_total (Counter) - Total tasks created
21+
- tasks_by_state (Gauge) - Current tasks grouped by state labels:
22+
* state="running"
23+
* state="finished"
24+
* state="failed"
25+
- task_duration_seconds (Histogram) - Task execution time
26+
- task_failures_total (Counter) - Failed tasks counter
27+
28+
Implementation approach:
29+
1. Add metrics to scotty/src/metrics/instruments.rs
30+
2. Instrument scotty/src/tasks/manager.rs:
31+
- add_task(): increment tasks_total, update state gauge
32+
- set_task_finished(): update state gauges, record duration histogram
33+
- Optional: background sampler every 30s to sync gauges with HashMap state
34+
35+
Data sources:
36+
- TaskManager.processes HashMap size = total active tasks
37+
- TaskDetails.state: Running | Finished | Failed
38+
- TaskDetails.start_time + finish_time for duration calculation
39+
- TaskDetails.last_exit_code for success/failure tracking
40+
41+
# Acceptance Criteria
42+
43+
- Task metrics exported to OTLP
44+
- Metrics accurately reflect task states
45+
- Duration tracking works correctly
46+
- Failed vs successful tasks distinguishable
47+
- Dashboard panels created for task monitoring
48+
- No performance degradation

.beads/issues/scotty-15571.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: Reduce cloning overhead by wrapping AppData in Arc
3+
status: open
4+
priority: 1
5+
issue_type: task
6+
labels:
7+
- performance
8+
- refactoring
9+
created_at: 2025-10-26T20:21:10.340270+00:00
10+
updated_at: 2025-11-24T20:17:25.583693+00:00
11+
---
12+
13+
# Description
14+
15+
AppData is cloned on every access from SharedAppList. Wrapping AppData in Arc would make cloning cheap (just reference count increment) instead of copying all nested structures.
16+
17+
# Design
18+
19+
Location: scotty-core/src/apps/shared_app_list.rs:56-58
20+
21+
Current code clones entire AppData structure on every get_app() call. AppData contains multiple nested structures (containers, services, settings) making clones expensive.
22+
23+
Proposed solution:
24+
```rust
25+
pub type SharedAppData = Arc<AppData>;
26+
27+
pub async fn get_app(&self, app_name: &str) -> Option<SharedAppData> {
28+
let t = self.apps.read().await;
29+
t.get(app_name).map(Arc::clone) // Only clones Arc, not data
30+
}
31+
```
32+
33+
Impact: Major performance improvement for app data access paths
34+
Effort: 2-4 hours

0 commit comments

Comments
 (0)