@crvouga/atlas 0.16.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +52 -8
  3. package/dist/core/src/cli.d.ts +1 -1
  4. package/dist/core/src/cli.js +1 -1
  5. package/dist/reports/src/attachment-files.d.ts +3 -1
  6. package/dist/reports/src/attachment-files.js +14 -4
  7. package/dist/reports/src/evidence-types.d.ts +22 -0
  8. package/dist/reports/src/garbage.d.ts +39 -0
  9. package/dist/reports/src/garbage.js +82 -0
  10. package/dist/reports/src/layer-merge.js +5 -0
  11. package/dist/reports/src/layer-types.d.ts +1 -1
  12. package/dist/reports/src/publish-checks.js +11 -3
  13. package/dist/reports/src/recording-receipt.d.ts +48 -0
  14. package/dist/reports/src/recording-receipt.js +103 -0
  15. package/dist/reports/src/report-cli.d.ts +1 -1
  16. package/dist/reports/src/report-cli.js +20 -2
  17. package/dist/reports/src/report-index.d.ts +6 -0
  18. package/dist/reports/src/report-index.js +14 -0
  19. package/dist/reports/src/report-status.d.ts +2 -0
  20. package/dist/reports/src/report-status.js +17 -1
  21. package/dist/reports/src/reports-explorer-route.d.ts +8 -0
  22. package/dist/reports/src/reports-route.d.ts +8 -0
  23. package/dist/schema/src/api.d.ts +65 -0
  24. package/dist/schema/src/api.js +7 -2
  25. package/dist/schema/src/cli-results.d.ts +107 -2
  26. package/dist/schema/src/cli-results.js +11 -3
  27. package/dist/schema/src/index.d.ts +1 -0
  28. package/dist/schema/src/index.js +1 -0
  29. package/dist/schema/src/layer.d.ts +165 -0
  30. package/dist/schema/src/layer.js +72 -1
  31. package/dist/schema/src/server-config.d.ts +7 -49
  32. package/dist/schema/src/server-config.js +8 -21
  33. package/dist/schema/src/user-state.d.ts +115 -0
  34. package/dist/schema/src/user-state.js +54 -0
  35. package/dist/server/src/app.d.ts +16 -2
  36. package/dist/server/src/app.js +62 -0
  37. package/dist/server/src/config.d.ts +16 -21
  38. package/dist/server/src/config.js +48 -57
  39. package/dist/server/src/dev.d.ts +1 -1
  40. package/dist/server/src/dev.js +20 -7
  41. package/dist/server/src/index.d.ts +5 -1
  42. package/dist/server/src/index.js +5 -1
  43. package/dist/server/src/main.d.ts +23 -7
  44. package/dist/server/src/main.js +72 -26
  45. package/dist/server/src/openapi.js +24 -5
  46. package/dist/server/src/projects.js +89 -14
  47. package/dist/server/src/settings.d.ts +23 -7
  48. package/dist/server/src/settings.js +50 -60
  49. package/dist/server/src/storage.d.ts +68 -0
  50. package/dist/server/src/storage.js +125 -0
  51. package/dist/server/src/user-state.d.ts +31 -0
  52. package/dist/server/src/user-state.js +74 -0
  53. package/docs/agents.md +1 -1
  54. package/docs/deploying.md +38 -39
  55. package/docs/reference/cli.md +17 -7
  56. package/docs/reference/http-api.md +30 -2
  57. package/docs/reference/reports.md +165 -2
  58. package/docs/reference/schema.md +161 -16
  59. package/docs/reference/server.md +263 -41
  60. package/docs/report-backends.md +0 -144
  61. package/docs/report-contract.md +1 -1
  62. package/docs/rich-evidence.md +29 -0
  63. package/docs/runners.md +1 -1
  64. package/docs/server.md +141 -36
  65. package/docs/statecharts.md +1 -1
  66. package/docs/ui.md +1 -1
  67. package/docs/workspaces.md +5 -2
  68. package/llms-full.txt +265 -234
  69. package/llms.txt +1 -1
  70. package/package.json +2 -2
  71. package/packages/reports/STORAGE.md +1 -1
  72. package/packages/schema/schemas/check-detail.schema.json +20 -0
  73. package/packages/schema/schemas/effective-delta.schema.json +61 -0
  74. package/packages/schema/schemas/effective-evidence.schema.json +61 -0
  75. package/packages/schema/schemas/evidence-page.schema.json +45 -0
  76. package/packages/schema/schemas/gc-policy.schema.json +36 -0
  77. package/packages/schema/schemas/gc-run-result.schema.json +106 -0
  78. package/packages/schema/schemas/gc-snapshot.schema.json +122 -0
  79. package/packages/schema/schemas/layer-rows.schema.json +16 -0
  80. package/packages/schema/schemas/layer.schema.json +153 -0
  81. package/packages/schema/schemas/publish-checks.schema.json +24 -0
  82. package/packages/schema/schemas/publish-result.schema.json +161 -1
  83. package/packages/schema/schemas/report-status.schema.json +104 -0
  84. package/packages/schema/schemas/server-config.schema.json +0 -41
  85. package/packages/schema/schemas/server-editable-settings.schema.json +0 -41
  86. package/packages/schema/schemas/server-settings-snapshot.schema.json +0 -82
  87. package/packages/schema/schemas/user-state.schema.json +140 -0
  88. package/packages/server/README.md +11 -6
  89. package/packages/server/openapi.json +843 -128
  90. package/packages/visualizer/src/admin/SettingsPage.tsx +183 -88
  91. package/packages/visualizer/src/evidence/marks.tsx +16 -0
@@ -3,47 +3,6 @@
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "type": "object",
5
5
  "properties": {
6
- "data": {
7
- "default": "./atlas-data",
8
- "description": "The folder that is the default backend and the default write target: layers, specs and runs live here",
9
- "type": "string"
10
- },
11
- "backends": {
12
- "default": [],
13
- "description": "Further backends, read together with the data folder: S3, another server, a device lab",
14
- "type": "array",
15
- "items": {
16
- "type": "object",
17
- "properties": {
18
- "id": {
19
- "type": "string",
20
- "pattern": "^[a-z0-9-]+$",
21
- "description": "Lowercase letters, digits and hyphens. Names where a result came from"
22
- },
23
- "label": {
24
- "type": "string"
25
- },
26
- "url": {
27
- "type": "string",
28
- "minLength": 1,
29
- "description": "A folder, s3://bucket/prefix, r2://, gs://, or another Atlas server (https://…)"
30
- },
31
- "write": {
32
- "description": "Uploads go here instead of the data folder. At most one backend is the write target",
33
- "type": "boolean"
34
- }
35
- },
36
- "required": [
37
- "id",
38
- "url"
39
- ],
40
- "additionalProperties": false
41
- }
42
- },
43
- "write": {
44
- "description": "The id of the backend uploads go to. Default: the data folder",
45
- "type": "string"
46
- },
47
6
  "outlineBranch": {
48
7
  "description": "Which branch's specs the report is laid over. Default main, then master, then the newest",
49
8
  "type": "string"
@@ -10,47 +10,6 @@
10
10
  "settings": {
11
11
  "type": "object",
12
12
  "properties": {
13
- "data": {
14
- "default": "./atlas-data",
15
- "description": "The folder that is the default backend and the default write target: layers, specs and runs live here",
16
- "type": "string"
17
- },
18
- "backends": {
19
- "default": [],
20
- "description": "Further backends, read together with the data folder: S3, another server, a device lab",
21
- "type": "array",
22
- "items": {
23
- "type": "object",
24
- "properties": {
25
- "id": {
26
- "type": "string",
27
- "pattern": "^[a-z0-9-]+$",
28
- "description": "Lowercase letters, digits and hyphens. Names where a result came from"
29
- },
30
- "label": {
31
- "type": "string"
32
- },
33
- "url": {
34
- "type": "string",
35
- "minLength": 1,
36
- "description": "A folder, s3://bucket/prefix, r2://, gs://, or another Atlas server (https://…)"
37
- },
38
- "write": {
39
- "description": "Uploads go here instead of the data folder. At most one backend is the write target",
40
- "type": "boolean"
41
- }
42
- },
43
- "required": [
44
- "id",
45
- "url"
46
- ],
47
- "additionalProperties": false
48
- }
49
- },
50
- "write": {
51
- "description": "The id of the backend uploads go to. Default: the data folder",
52
- "type": "string"
53
- },
54
13
  "outlineBranch": {
55
14
  "description": "Which branch's specs the report is laid over. Default main, then master, then the newest",
56
15
  "type": "string"
@@ -140,47 +99,6 @@
140
99
  "active": {
141
100
  "type": "object",
142
101
  "properties": {
143
- "data": {
144
- "default": "./atlas-data",
145
- "description": "The folder that is the default backend and the default write target: layers, specs and runs live here",
146
- "type": "string"
147
- },
148
- "backends": {
149
- "default": [],
150
- "description": "Further backends, read together with the data folder: S3, another server, a device lab",
151
- "type": "array",
152
- "items": {
153
- "type": "object",
154
- "properties": {
155
- "id": {
156
- "type": "string",
157
- "pattern": "^[a-z0-9-]+$",
158
- "description": "Lowercase letters, digits and hyphens. Names where a result came from"
159
- },
160
- "label": {
161
- "type": "string"
162
- },
163
- "url": {
164
- "type": "string",
165
- "minLength": 1,
166
- "description": "A folder, s3://bucket/prefix, r2://, gs://, or another Atlas server (https://…)"
167
- },
168
- "write": {
169
- "description": "Uploads go here instead of the data folder. At most one backend is the write target",
170
- "type": "boolean"
171
- }
172
- },
173
- "required": [
174
- "id",
175
- "url"
176
- ],
177
- "additionalProperties": false
178
- }
179
- },
180
- "write": {
181
- "description": "The id of the backend uploads go to. Default: the data folder",
182
- "type": "string"
183
- },
184
102
  "outlineBranch": {
185
103
  "description": "Which branch's specs the report is laid over. Default main, then master, then the newest",
186
104
  "type": "string"
@@ -0,0 +1,140 @@
1
+ {
2
+ "$id": "https://github.com/crvouga/atlas/schemas/user-state.schema.json",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "schemaVersion": {
7
+ "type": "number",
8
+ "const": 1
9
+ },
10
+ "gc": {
11
+ "description": "The garbage collection policy. Absent until someone saves one: then nothing is deleted",
12
+ "type": "object",
13
+ "properties": {
14
+ "enabled": {
15
+ "type": "boolean",
16
+ "description": "Delete eligible layers on a schedule. `false` keeps the policy but deletes nothing"
17
+ },
18
+ "maxAgeDays": {
19
+ "type": "integer",
20
+ "minimum": 1,
21
+ "maximum": 3650,
22
+ "description": "A superseded layer is eligible once it was recorded more than this many days ago"
23
+ },
24
+ "keepLatest": {
25
+ "default": 20,
26
+ "description": "Always keep this many of the newest layers, however old, so recent history stays",
27
+ "type": "integer",
28
+ "minimum": 0,
29
+ "maximum": 1000000
30
+ },
31
+ "intervalHours": {
32
+ "default": 24,
33
+ "description": "How often the server applies the policy",
34
+ "type": "number",
35
+ "minimum": 1,
36
+ "maximum": 720
37
+ }
38
+ },
39
+ "required": [
40
+ "enabled",
41
+ "maxAgeDays"
42
+ ],
43
+ "additionalProperties": false
44
+ },
45
+ "settings": {
46
+ "description": "Report and live-run settings saved from the settings page, applied at the next start",
47
+ "type": "object",
48
+ "properties": {
49
+ "outlineBranch": {
50
+ "description": "Which branch's specs the report is laid over. Default main, then master, then the newest",
51
+ "type": "string"
52
+ },
53
+ "include": {
54
+ "default": {},
55
+ "type": "object",
56
+ "properties": {
57
+ "branches": {
58
+ "description": "Only layers recorded on these branches take part",
59
+ "type": "array",
60
+ "items": {
61
+ "type": "string"
62
+ }
63
+ },
64
+ "ignoreModified": {
65
+ "description": "Leave out layers from modified checkouts and unknown origins",
66
+ "type": "boolean"
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ },
71
+ "refreshSeconds": {
72
+ "default": 10,
73
+ "description": "How often the backends are looked at for layers written by something other than this server",
74
+ "type": "number",
75
+ "minimum": 1
76
+ },
77
+ "limits": {
78
+ "default": {
79
+ "maxObjectMiB": 256,
80
+ "maxJsonMiB": 32,
81
+ "maxStreams": 500
82
+ },
83
+ "type": "object",
84
+ "properties": {
85
+ "maxObjectMiB": {
86
+ "default": 256,
87
+ "description": "The largest object an upload may be",
88
+ "type": "number",
89
+ "exclusiveMinimum": 0
90
+ },
91
+ "maxJsonMiB": {
92
+ "default": 32,
93
+ "description": "The largest JSON body (a manifest, a checks request)",
94
+ "type": "number",
95
+ "exclusiveMinimum": 0
96
+ },
97
+ "maxStreams": {
98
+ "default": 500,
99
+ "description": "Viewers that may be connected for live updates at once",
100
+ "type": "integer",
101
+ "exclusiveMinimum": 0,
102
+ "maximum": 9007199254740991
103
+ }
104
+ },
105
+ "additionalProperties": false
106
+ },
107
+ "heartbeatSeconds": {
108
+ "default": 15,
109
+ "description": "How often a live connection is touched, so proxies keep it open",
110
+ "type": "number",
111
+ "minimum": 1
112
+ },
113
+ "runTimeoutSeconds": {
114
+ "default": 30,
115
+ "description": "Interrupt a live run after this many seconds without a producer heartbeat",
116
+ "type": "number",
117
+ "minimum": 10,
118
+ "maximum": 3600
119
+ },
120
+ "runStallSeconds": {
121
+ "default": 900,
122
+ "description": "Interrupt after this many seconds without test progress; 0 disables progress expiry",
123
+ "type": "number",
124
+ "minimum": 0,
125
+ "maximum": 86400
126
+ },
127
+ "log": {
128
+ "default": true,
129
+ "description": "One JSON line per request",
130
+ "type": "boolean"
131
+ }
132
+ },
133
+ "additionalProperties": false
134
+ }
135
+ },
136
+ "required": [
137
+ "schemaVersion"
138
+ ],
139
+ "additionalProperties": {}
140
+ }
@@ -4,17 +4,21 @@ The Atlas server: one process per project that takes in results from every envir
4
4
  everyone the combined report, live. A Bun API that serves the Vite-built viewer from the same host (and, under
5
5
  `atlas dev`, the viewer's dev server proxies `/api` to it, so development is one host too).
6
6
 
7
- Use it from the command line: `atlas serve`, `atlas dev` ([the guide](../../docs/server.md)). Use it from code when
8
- you want the server inside something else:
7
+ Use it from the command line: `atlas serve`, `atlas dev` ([the guide](../../docs/server.md)). The command-line server keeps
8
+ **all reports and all user state (the garbage collection policy, saved settings) in S3-compatible storage and nowhere
9
+ else**, set by the required `ATLAS_S3_ENDPOINT`, `ATLAS_S3_BUCKET`, `ATLAS_S3_REGION`, `ATLAS_S3_ACCESS_KEY_ID` and
10
+ `ATLAS_S3_SECRET_ACCESS_KEY` variables (see [`.env.example`](https://github.com/crvouga/atlas/blob/main/.env.example)); it exits with status 2, listing every
11
+ variable and what is wrong, if they are missing or invalid. Use it from code when you want the server inside something else,
12
+ and bring your own `ObjectStore` (a bucket, or a memory store in tests):
9
13
 
10
14
  ```ts
11
15
  import { createAtlasServer } from '@crvouga/atlas/server';
12
16
  import { listen } from '@crvouga/atlas/server';
13
- import { directoryStore } from '@crvouga/atlas/reports/directory-store';
17
+ import { s3Store } from '@crvouga/atlas/reports/s3-store';
14
18
 
15
19
  const server = createAtlasServer({
16
- backends: [{ id: 'data', store: directoryStore('./atlas-data') }],
17
- write: 'data', // where uploads go
20
+ backends: [{ id: 's3', store: s3Store({ bucket: 'my-atlas-reports', region: 'eu-west-1' }) }],
21
+ write: 's3', // where uploads go
18
22
  tokens: [{ name: 'ci', role: 'publish', token: process.env.ATLAS_PUBLISH_TOKEN! }],
19
23
  site: './atlas-site' // the built viewer; without it only the API is served
20
24
  });
@@ -33,7 +37,8 @@ to viewers, `server.close()` stops both.
33
37
  | `store-api`, `validate` | The upload protocol and what it refuses (content-addressed layers, dependency order, immutability). |
34
38
  | `events` | `EventHub`: server-sent events to every viewer, with a heartbeat and a backlog limit. |
35
39
  | `auth` | Roles (`read`, `publish`, `admin`), Bearer tokens, constant-time comparison. |
36
- | `config` | `loadServerConfig`: the file, then the environment, then the flags; every mistake said in words. |
40
+ | `config`, `storage` | `loadServerConfig`: the saved settings, the file, then the environment, then the flags; every mistake said in words. `resolveS3Config`: the required `ATLAS_S3_*` variables, all problems reported together. |
41
+ | `user-state`, `settings` | The user state JSON in S3 (`server/state.json`): the garbage collection policy and saved settings. |
37
42
  | `main`, `dev` | `atlas serve` and `atlas dev`. |
38
43
 
39
44
  The server describes itself: `GET /api/openapi.json` is an OpenAPI 3.1 document of every route (also `@crvouga/atlas/openapi.json`),