Commit a812cf6
authored
refactor(logs,landscape): unified log targets, injection-safe profile writes (#56)
Implements plans/refactor/05-logs-landscape-hardening.md:
- One stream/collect implementation instead of six: frozen target
dataclasses (StageTarget, ServerTarget, ReplicaTarget) select the
StreamOperation; WorkspaceLogManager.open/stream/collect take a
LogTarget. The six legacy methods (stream_server, stream_replica,
collect_server, collect_replica, open_*_stream) and the positional
stream(stage, step) form remain as deprecated shims that warn and
delegate (tested via pytest.warns)
- save_profile no longer builds a shell heredoc from user content:
YAML is transported base64-encoded (printf '%s' '<b64>' | base64 -d),
so content containing PROFILE_EOF, , backticks, or quotes is
inert; get/delete_profile filenames are single-quoted. Adversarial
round-trip tests cover terminator/substitution/quote/CRLF/unicode
payloads
- LogStream takes the APIHttpClient and uses its new public stream()
passthrough and stream_timeout property (configured connect timeout,
unbounded read) instead of reaching into _get_client() with a
hardcoded Timeout(5.0); SSE terminator event names are a module
constant
- LogEntry.kind is a LogKind enum (I/E) with str fallback for unknown
values (left_to_right union)
No breaking changes: all legacy method names keep working with a
DeprecationWarning.1 parent f401ab3 commit a812cf6
7 files changed
Lines changed: 446 additions & 129 deletions
File tree
- src/codesphere
- resources/workspace
- landscape
- logs
- tests/resources/workspace
- landscape
- logs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
41 | 60 | | |
42 | 61 | | |
43 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | | - | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | | - | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
3 | 10 | | |
4 | 11 | | |
5 | 12 | | |
| 13 | + | |
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
9 | 21 | | |
10 | 22 | | |
0 commit comments