@synopackageland/cli 0.8.0 → 0.9.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.
- package/CHANGELOG.md +124 -0
- package/README.md +26 -4
- package/dist/add.js +4 -17
- package/dist/authorization-sdk.d.ts +0 -1
- package/dist/authorization-sdk.js +0 -1
- package/dist/build-spk/gateway.js +2 -2
- package/dist/build-spk/notices.js +12 -8
- package/dist/capability-overlays.d.ts +15 -0
- package/dist/capability-overlays.js +18 -0
- package/dist/cli-version.d.ts +2 -0
- package/dist/cli-version.js +3 -0
- package/dist/cli.js +3 -1
- package/dist/error-registry.js +12 -4
- package/dist/info.js +2 -1
- package/dist/init.js +52 -58
- package/dist/reproducible.js +1 -1
- package/dist/runtime/delegate-contract.d.ts +15 -0
- package/dist/runtime/delegate-contract.js +2 -0
- package/dist/runtime/executor-build.d.ts +15 -1
- package/dist/runtime/executor-build.js +42 -11
- package/dist/runtime/executor-digests.json +13 -0
- package/dist/runtime/executor-inspect.d.ts +1 -0
- package/dist/runtime/executor-inspect.js +5 -2
- package/dist/runtime/executor-policy.d.ts +3 -1
- package/dist/runtime/executor-policy.js +7 -2
- package/dist/runtime/executor-source.d.ts +21 -0
- package/dist/runtime/executor-source.js +35 -0
- package/dist/runtime/executor-tasks.d.ts +5 -2
- package/dist/runtime/executor-tasks.js +6 -4
- package/dist/runtime/sdk-source.d.ts +31 -0
- package/dist/runtime/sdk-source.js +92 -0
- package/dist/standalone/api-permissions.d.ts +4 -1
- package/dist/standalone/api-permissions.js +10 -18
- package/dist/standalone/build.d.ts +1 -0
- package/dist/standalone/build.js +11 -4
- package/dist/standalone/daemon.js +2 -2
- package/dist/standalone/dsm-window.js +2 -2
- package/dist/standalone/manifest.d.ts +5 -2
- package/dist/standalone/manifest.js +9 -3
- package/dist/standalone/root-window.d.ts +1 -1
- package/dist/standalone/root-window.js +0 -1
- package/dist/standalone/sdk-check.d.ts +9 -0
- package/dist/standalone/sdk-check.js +43 -0
- package/dist/standalone/spk.js +1 -1
- package/dist/template-paths.d.ts +7 -2
- package/dist/template-paths.js +18 -6
- package/package.json +13 -3
- package/dist/templates/_executor/README.md +0 -318
- package/dist/templates/_executor/anchor.go +0 -156
- package/dist/templates/_executor/anchor_test.go +0 -161
- package/dist/templates/_executor/apppriv_review_test.go +0 -28
- package/dist/templates/_executor/auth_presence_review_test.go +0 -38
- package/dist/templates/_executor/cancel_contract_test.go +0 -236
- package/dist/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/dist/templates/_executor/cookie_review_test.go +0 -27
- package/dist/templates/_executor/copy.go +0 -64
- package/dist/templates/_executor/copy_test.go +0 -88
- package/dist/templates/_executor/digest_review_test.go +0 -120
- package/dist/templates/_executor/directories.go +0 -40
- package/dist/templates/_executor/dsm.go +0 -369
- package/dist/templates/_executor/dsm_test.go +0 -290
- package/dist/templates/_executor/executor.go +0 -735
- package/dist/templates/_executor/executor_test.go +0 -314
- package/dist/templates/_executor/go.mod +0 -5
- package/dist/templates/_executor/identity.go +0 -74
- package/dist/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/dist/templates/_executor/identity_linux.go +0 -82
- package/dist/templates/_executor/identity_security_test.go +0 -43
- package/dist/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/dist/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/dist/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/dist/templates/_executor/internal/taskscript/control.sh +0 -31
- package/dist/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/dist/templates/_executor/json_review_test.go +0 -40
- package/dist/templates/_executor/lifecycle_test.go +0 -97
- package/dist/templates/_executor/link_linux.go +0 -28
- package/dist/templates/_executor/long_running_test.go +0 -530
- package/dist/templates/_executor/main.go +0 -576
- package/dist/templates/_executor/managed.go +0 -117
- package/dist/templates/_executor/managed_test.go +0 -137
- package/dist/templates/_executor/move_linux.go +0 -490
- package/dist/templates/_executor/move_linux_test.go +0 -460
- package/dist/templates/_executor/move_validation.go +0 -46
- package/dist/templates/_executor/move_validation_test.go +0 -187
- package/dist/templates/_executor/operations.go +0 -926
- package/dist/templates/_executor/path_test.go +0 -35
- package/dist/templates/_executor/pid.go +0 -37
- package/dist/templates/_executor/pid_test.go +0 -113
- package/dist/templates/_executor/platform_linux.go +0 -187
- package/dist/templates/_executor/platform_linux_test.go +0 -191
- package/dist/templates/_executor/platform_other.go +0 -76
- package/dist/templates/_executor/process.go +0 -142
- package/dist/templates/_executor/purge_log.go +0 -18
- package/dist/templates/_executor/records.go +0 -242
- package/dist/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/dist/templates/_executor/scope_client.go +0 -37
- package/dist/templates/_executor/scope_contract.go +0 -12
- package/dist/templates/_executor/selected_scope.go +0 -146
- package/dist/templates/_executor/selected_scope_test.go +0 -186
- package/dist/templates/_executor/socket_linux_test.go +0 -46
- package/dist/templates/_executor/status_disabled_test.go +0 -33
- package/dist/templates/_executor/store.go +0 -91
- package/dist/templates/_executor/supervise.go +0 -109
- package/dist/templates/_executor/supervise_test.go +0 -130
- package/dist/templates/_executor/task_race_review_test.go +0 -47
- package/dist/templates/_executor/tasks.go +0 -320
- package/dist/templates/_executor/tasks_dsm71_test.go +0 -114
- package/dist/templates/_executor/tasks_review_test.go +0 -43
- package/dist/templates/_executor/tasks_test.go +0 -223
- package/dist/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/dist/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/dist/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/dist/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/dist/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/dist/templates/_executor/testdata/evidence/storage.json +0 -90
- package/dist/templates/_executor/testdata/evidence/validation.json +0 -55
- package/dist/templates/_executor/testdata/live_probe.py +0 -98
- package/dist/templates/_executor/upgrade_watch_test.go +0 -244
- package/dist/templates/_executor/watch.go +0 -164
- package/dist/templates/_executor/watch_test.go +0 -291
- package/dist/templates/_executor/write_review_linux_test.go +0 -87
- package/dist/templates/_shared/AGENTS.md +0 -146
- package/dist/templates/_shared/CLAUDE.md +0 -1
- package/dist/templates/_shared/third-party-notices.mjs +0 -51
- package/dist/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/dist/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/dist/templates/binary/dsm-package.yaml +0 -46
- package/dist/templates/binary/example/main.go +0 -16
- package/dist/templates/binary/gitignore +0 -2
- package/dist/templates/binary/i18n/messages/de.json +0 -4
- package/dist/templates/binary/i18n/messages/en.json +0 -4
- package/dist/templates/binary/i18n/messages/es.json +0 -4
- package/dist/templates/binary/i18n/messages/fr.json +0 -4
- package/dist/templates/binary/i18n/messages/it.json +0 -4
- package/dist/templates/binary/i18n/messages/ja.json +0 -4
- package/dist/templates/binary/i18n/messages/ko.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/dist/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/dist/templates/binary/ui/app.css +0 -4
- package/dist/templates/binary/ui/app.js +0 -32
- package/dist/templates/compose/compose.yaml +0 -8
- package/dist/templates/compose/synology-app.yaml +0 -16
- package/dist/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/dist/templates/native-authorization/i18n/de.json +0 -37
- package/dist/templates/native-authorization/i18n/en.json +0 -37
- package/dist/templates/native-authorization/i18n/es.json +0 -37
- package/dist/templates/native-authorization/i18n/fr.json +0 -37
- package/dist/templates/native-authorization/i18n/index.ts +0 -15
- package/dist/templates/native-authorization/i18n/it.json +0 -37
- package/dist/templates/native-authorization/i18n/ja.json +0 -37
- package/dist/templates/native-authorization/i18n/ko.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/dist/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/dist/templates/native-go/README.md +0 -459
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/dist/templates/native-go/backend/cmd/app/main.go +0 -95
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/dist/templates/native-go/backend/go.mod +0 -9
- package/dist/templates/native-go/backend/go.sum +0 -4
- package/dist/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/dist/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/dist/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/dist/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/dist/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/dist/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/dist/templates/native-go/backend/internal/api/errors.go +0 -47
- package/dist/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/dist/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/dist/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/dist/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/dist/templates/native-go/backend/internal/api/registry.go +0 -142
- package/dist/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/dist/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/dist/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/dist/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/dist/templates/native-go/backend/internal/api/server.go +0 -305
- package/dist/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/dist/templates/native-go/backend/internal/app/background.go +0 -249
- package/dist/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/dist/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/dist/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/dist/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/dist/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/dist/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/dist/templates/native-go/backend/internal/app/identity.go +0 -20
- package/dist/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/dist/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/dist/templates/native-go/backend/internal/app/portal.go +0 -30
- package/dist/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/dist/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/dist/templates/native-go/backend/internal/app/routes.go +0 -137
- package/dist/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/dist/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/dist/templates/native-go/backend/internal/background/access.go +0 -57
- package/dist/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/dist/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/dist/templates/native-go/backend/internal/background/runner.go +0 -185
- package/dist/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/dist/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/dist/templates/native-go/backend/internal/background/store.go +0 -825
- package/dist/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/dist/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/dist/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/dist/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/dist/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/dist/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/dist/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/dist/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/dist/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/dist/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/dist/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/dist/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/dist/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/dist/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/dist/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/dist/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/dist/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/dist/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/dist/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/dist/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/dist/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/dist/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/dist/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/dist/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/dist/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/dist/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/dist/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/dist/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/dist/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/dist/templates/native-go/backend/internal/identity/README.md +0 -59
- package/dist/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/dist/templates/native-go/backend/internal/identity/http.go +0 -291
- package/dist/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/dist/templates/native-go/backend/internal/identity/service.go +0 -159
- package/dist/templates/native-go/backend/internal/identity/store.go +0 -109
- package/dist/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/dist/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/dist/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/dist/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/dist/templates/native-go/dsm-package.yaml +0 -71
- package/dist/templates/native-go/gitignore +0 -1
- package/dist/templates/native-go/i18n/glossary.json +0 -663
- package/dist/templates/native-go/i18n/messages/de.json +0 -29
- package/dist/templates/native-go/i18n/messages/en.json +0 -29
- package/dist/templates/native-go/i18n/messages/es.json +0 -29
- package/dist/templates/native-go/i18n/messages/fr.json +0 -29
- package/dist/templates/native-go/i18n/messages/it.json +0 -29
- package/dist/templates/native-go/i18n/messages/ja.json +0 -29
- package/dist/templates/native-go/i18n/messages/ko.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/dist/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/dist/templates/native-go/ui/app.css +0 -45
- package/dist/templates/native-go/ui/app.js +0 -111
- package/dist/templates/native-go-delegate/DELEGATE.md +0 -263
- package/dist/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/dist/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/dist/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/dist/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/dist/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/dist/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/dist/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/dist/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/dist/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/dist/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/dist/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/dist/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/dist/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/dist/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/dist/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/dist/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/dist/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/dist/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/dist/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/dist/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/dist/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/dist/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/dist/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/dist/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/dist/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/dist/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/dist/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/dist/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/dist/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/dist/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/dist/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/dist/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/dist/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/dist/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/dist/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/dist/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/dist/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/dist/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/dist/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/dist/templates/native-go-delegate/test-frontend.sh +0 -12
- package/dist/templates/native-go-delegate/test.sh +0 -18
- package/dist/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/dist/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/dist/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/dist/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/dist/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/dist/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/dist/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/dist/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/dist/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/dist/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/dist/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/dist/templates/native-go-vue/README.md +0 -47
- package/dist/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/dist/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/dist/templates/native-go-vue/frontend/package.json +0 -6
- package/dist/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/dist/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/dist/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/dist/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/dist/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/dist/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/dist/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/dist/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/dist/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/dist/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/dist/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/dist/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/dist/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/dist/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/dist/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/dist/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/dist/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/dist/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/dist/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/dist/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/dist/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/dist/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/dist/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/dist/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/dist/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/dist/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/dist/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/dist/templates/native-go-vue/frontend/src/style.css +0 -27
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/dist/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/dist/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/dist/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/dist/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/dist/templates/native-go-vue/gitignore +0 -2
- package/templates/_daemon/fixture_linux_test.go +0 -15
- package/templates/_daemon/fixture_other_test.go +0 -7
- package/templates/_daemon/go.mod +0 -5
- package/templates/_daemon/main.go +0 -611
- package/templates/_daemon/main_test.go +0 -315
- package/templates/_daemon/process_linux.go +0 -55
- package/templates/_daemon/process_linux_test.go +0 -161
- package/templates/_daemon/process_other.go +0 -14
- package/templates/_daemon/testdata/child.go +0 -44
- package/templates/_executor/README.md +0 -318
- package/templates/_executor/anchor.go +0 -156
- package/templates/_executor/anchor_test.go +0 -161
- package/templates/_executor/apppriv_review_test.go +0 -28
- package/templates/_executor/auth_presence_review_test.go +0 -38
- package/templates/_executor/cancel_contract_test.go +0 -236
- package/templates/_executor/cmd/lifecycle/main.go +0 -42
- package/templates/_executor/cookie_review_test.go +0 -27
- package/templates/_executor/copy.go +0 -64
- package/templates/_executor/copy_test.go +0 -88
- package/templates/_executor/digest_review_test.go +0 -120
- package/templates/_executor/directories.go +0 -40
- package/templates/_executor/dsm.go +0 -369
- package/templates/_executor/dsm_test.go +0 -290
- package/templates/_executor/executor.go +0 -735
- package/templates/_executor/executor_test.go +0 -314
- package/templates/_executor/go.mod +0 -5
- package/templates/_executor/identity.go +0 -74
- package/templates/_executor/identity_kernel_linux_test.go +0 -60
- package/templates/_executor/identity_linux.go +0 -82
- package/templates/_executor/identity_security_test.go +0 -43
- package/templates/_executor/internal/lifecycle/lifecycle.go +0 -95
- package/templates/_executor/internal/lifecycle/lifecycle_test.go +0 -232
- package/templates/_executor/internal/taskscript/boot.sh +0 -31
- package/templates/_executor/internal/taskscript/cmd/main.go +0 -19
- package/templates/_executor/internal/taskscript/control.sh +0 -31
- package/templates/_executor/internal/taskscript/tasks.go +0 -44
- package/templates/_executor/json_review_test.go +0 -40
- package/templates/_executor/lifecycle_test.go +0 -97
- package/templates/_executor/link_linux.go +0 -28
- package/templates/_executor/long_running_test.go +0 -530
- package/templates/_executor/main.go +0 -576
- package/templates/_executor/managed.go +0 -117
- package/templates/_executor/managed_test.go +0 -137
- package/templates/_executor/move_linux.go +0 -490
- package/templates/_executor/move_linux_test.go +0 -460
- package/templates/_executor/move_validation.go +0 -46
- package/templates/_executor/move_validation_test.go +0 -187
- package/templates/_executor/operations.go +0 -926
- package/templates/_executor/path_test.go +0 -35
- package/templates/_executor/pid.go +0 -37
- package/templates/_executor/pid_test.go +0 -113
- package/templates/_executor/platform_linux.go +0 -187
- package/templates/_executor/platform_linux_test.go +0 -191
- package/templates/_executor/platform_other.go +0 -76
- package/templates/_executor/process.go +0 -142
- package/templates/_executor/purge_log.go +0 -18
- package/templates/_executor/records.go +0 -242
- package/templates/_executor/scope_cancel_contract_test.go +0 -91
- package/templates/_executor/scope_client.go +0 -37
- package/templates/_executor/scope_contract.go +0 -12
- package/templates/_executor/selected_scope.go +0 -146
- package/templates/_executor/selected_scope_test.go +0 -186
- package/templates/_executor/socket_linux_test.go +0 -46
- package/templates/_executor/status_disabled_test.go +0 -33
- package/templates/_executor/store.go +0 -91
- package/templates/_executor/supervise.go +0 -109
- package/templates/_executor/supervise_test.go +0 -130
- package/templates/_executor/task_race_review_test.go +0 -47
- package/templates/_executor/tasks.go +0 -320
- package/templates/_executor/tasks_dsm71_test.go +0 -114
- package/templates/_executor/tasks_review_test.go +0 -43
- package/templates/_executor/tasks_test.go +0 -223
- package/templates/_executor/testdata/evidence/cleanup.json +0 -24
- package/templates/_executor/testdata/evidence/final-smoke.jsonl +0 -9
- package/templates/_executor/testdata/evidence/kernel-acl.json +0 -6
- package/templates/_executor/testdata/evidence/linux-tests.log +0 -123
- package/templates/_executor/testdata/evidence/live.jsonl +0 -23
- package/templates/_executor/testdata/evidence/storage.json +0 -90
- package/templates/_executor/testdata/evidence/validation.json +0 -55
- package/templates/_executor/testdata/live_probe.py +0 -98
- package/templates/_executor/upgrade_watch_test.go +0 -244
- package/templates/_executor/watch.go +0 -164
- package/templates/_executor/watch_test.go +0 -291
- package/templates/_executor/write_review_linux_test.go +0 -87
- package/templates/_gateway/auth.go +0 -101
- package/templates/_gateway/auth_test.go +0 -216
- package/templates/_gateway/cgi.go +0 -133
- package/templates/_gateway/cgi_test.go +0 -156
- package/templates/_gateway/csrf.go +0 -73
- package/templates/_gateway/csrf_test.go +0 -155
- package/templates/_gateway/directory.go +0 -108
- package/templates/_gateway/directory_test.go +0 -202
- package/templates/_gateway/gateway.go +0 -412
- package/templates/_gateway/gateway_test.go +0 -676
- package/templates/_gateway/go.mod +0 -5
- package/templates/_gateway/groups.go +0 -66
- package/templates/_gateway/main.go +0 -45
- package/templates/_shared/AGENTS.md +0 -146
- package/templates/_shared/CLAUDE.md +0 -1
- package/templates/_shared/GO-LICENSE +0 -27
- package/templates/_shared/GO-PATENTS +0 -22
- package/templates/_shared/LICENSES/TEMPLATE.txt +0 -21
- package/templates/_shared/third-party-notices.mjs +0 -51
- package/templates/binary/LICENSES/GO-LICENSE +0 -27
- package/templates/binary/LICENSES/GO-PATENTS +0 -22
- package/templates/binary/dsm-package.yaml +0 -46
- package/templates/binary/example/main.go +0 -16
- package/templates/binary/gitignore +0 -2
- package/templates/binary/i18n/messages/de.json +0 -4
- package/templates/binary/i18n/messages/en.json +0 -4
- package/templates/binary/i18n/messages/es.json +0 -4
- package/templates/binary/i18n/messages/fr.json +0 -4
- package/templates/binary/i18n/messages/it.json +0 -4
- package/templates/binary/i18n/messages/ja.json +0 -4
- package/templates/binary/i18n/messages/ko.json +0 -4
- package/templates/binary/i18n/messages/zh-CN.json +0 -4
- package/templates/binary/i18n/messages/zh-TW.json +0 -4
- package/templates/binary/ui/app.css +0 -4
- package/templates/binary/ui/app.js +0 -32
- package/templates/compose/compose.yaml +0 -8
- package/templates/compose/synology-app.yaml +0 -16
- package/templates/native-authorization/AuthorizationGate.vue +0 -91
- package/templates/native-authorization/i18n/de.json +0 -37
- package/templates/native-authorization/i18n/en.json +0 -37
- package/templates/native-authorization/i18n/es.json +0 -37
- package/templates/native-authorization/i18n/fr.json +0 -37
- package/templates/native-authorization/i18n/index.ts +0 -15
- package/templates/native-authorization/i18n/it.json +0 -37
- package/templates/native-authorization/i18n/ja.json +0 -37
- package/templates/native-authorization/i18n/ko.json +0 -37
- package/templates/native-authorization/i18n/zh-CN.json +0 -37
- package/templates/native-authorization/i18n/zh-TW.json +0 -37
- package/templates/native-go/README.md +0 -459
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +0 -61
- package/templates/native-go/backend/cmd/app/main.go +0 -95
- package/templates/native-go/backend/cmd/background-worker/main.go +0 -38
- package/templates/native-go/backend/go.mod +0 -9
- package/templates/native-go/backend/go.sum +0 -4
- package/templates/native-go/backend/internal/api/cgi_framing_test.go +0 -32
- package/templates/native-go/backend/internal/api/cookie_review_test.go +0 -28
- package/templates/native-go/backend/internal/api/deadline_test.go +0 -114
- package/templates/native-go/backend/internal/api/dsm-session.go +0 -54
- package/templates/native-go/backend/internal/api/dsm-session_test.go +0 -51
- package/templates/native-go/backend/internal/api/entry_test.go +0 -47
- package/templates/native-go/backend/internal/api/errors.go +0 -47
- package/templates/native-go/backend/internal/api/permissions.go +0 -161
- package/templates/native-go/backend/internal/api/permissions.json +0 -5
- package/templates/native-go/backend/internal/api/permissions_test.go +0 -113
- package/templates/native-go/backend/internal/api/policy_fixture_test.go +0 -8
- package/templates/native-go/backend/internal/api/registry.go +0 -142
- package/templates/native-go/backend/internal/api/registry_test.go +0 -344
- package/templates/native-go/backend/internal/api/resource_limits_test.go +0 -87
- package/templates/native-go/backend/internal/api/sdk-permissions.json +0 -59
- package/templates/native-go/backend/internal/api/sdk_policy_test.go +0 -31
- package/templates/native-go/backend/internal/api/server.go +0 -305
- package/templates/native-go/backend/internal/api/testdata/permissions-cases.json +0 -172
- package/templates/native-go/backend/internal/app/background.go +0 -249
- package/templates/native-go/backend/internal/app/background_none.go +0 -8
- package/templates/native-go/backend/internal/app/background_owner.go +0 -38
- package/templates/native-go/backend/internal/app/background_owner_test.go +0 -163
- package/templates/native-go/backend/internal/app/background_schedule.go +0 -69
- package/templates/native-go/backend/internal/app/background_schedule_test.go +0 -62
- package/templates/native-go/backend/internal/app/background_test.go +0 -320
- package/templates/native-go/backend/internal/app/delegate_config.go +0 -57
- package/templates/native-go/backend/internal/app/delegate_config_test.go +0 -28
- package/templates/native-go/backend/internal/app/delegate_none.go +0 -5
- package/templates/native-go/backend/internal/app/identity.go +0 -20
- package/templates/native-go/backend/internal/app/identity_test.go +0 -15
- package/templates/native-go/backend/internal/app/migrations.go +0 -41
- package/templates/native-go/backend/internal/app/migrations_test.go +0 -41
- package/templates/native-go/backend/internal/app/portal.go +0 -30
- package/templates/native-go/backend/internal/app/portal_test.go +0 -55
- package/templates/native-go/backend/internal/app/root_none.go +0 -9
- package/templates/native-go/backend/internal/app/routes.go +0 -137
- package/templates/native-go/backend/internal/app/routes_test.go +0 -165
- package/templates/native-go/backend/internal/app/session_files.go +0 -9
- package/templates/native-go/backend/internal/app/session_files_test.go +0 -14
- package/templates/native-go/backend/internal/app/shared_folder.go +0 -144
- package/templates/native-go/backend/internal/app/shared_folder_test.go +0 -158
- package/templates/native-go/backend/internal/background/access.go +0 -57
- package/templates/native-go/backend/internal/background/lock_test.go +0 -131
- package/templates/native-go/backend/internal/background/owner_test.go +0 -118
- package/templates/native-go/backend/internal/background/runner.go +0 -185
- package/templates/native-go/backend/internal/background/runner_test.go +0 -209
- package/templates/native-go/backend/internal/background/schedule.go +0 -336
- package/templates/native-go/backend/internal/background/schedule_test.go +0 -368
- package/templates/native-go/backend/internal/background/store.go +0 -825
- package/templates/native-go/backend/internal/background/store_test.go +0 -365
- package/templates/native-go/backend/internal/datamigrate/migrate.go +0 -191
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +0 -177
- package/templates/native-go/backend/internal/dsm/admin.go +0 -76
- package/templates/native-go/backend/internal/dsm/admin_linux.go +0 -110
- package/templates/native-go/backend/internal/dsm/admin_linux_test.go +0 -105
- package/templates/native-go/backend/internal/dsm/admin_other.go +0 -15
- package/templates/native-go/backend/internal/dsm/admin_test.go +0 -67
- package/templates/native-go/backend/internal/dsm/apppriv.go +0 -30
- package/templates/native-go/backend/internal/dsm/auth.go +0 -94
- package/templates/native-go/backend/internal/dsm/auth_test.go +0 -159
- package/templates/native-go/backend/internal/dsm/bridge_file.go +0 -75
- package/templates/native-go/backend/internal/dsm/bridge_file_test.go +0 -57
- package/templates/native-go/backend/internal/dsm/entry.go +0 -177
- package/templates/native-go/backend/internal/dsm/entry_test.go +0 -315
- package/templates/native-go/backend/internal/dsm/native/admin-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/admin_check.c +0 -28
- package/templates/native-go/backend/internal/dsm/native/apppriv-aarch64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-armv7.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv-x86_64.elf +0 -0
- package/templates/native-go/backend/internal/dsm/native/apppriv_check.c +0 -33
- package/templates/native-go/backend/internal/dsm/native/build.sh +0 -18
- package/templates/native-go/backend/internal/dsm/native/licenses/GLIBC-NOTICES.txt +0 -400
- package/templates/native-go/backend/internal/dsm/native/licenses/LGPL-2.1.txt +0 -501
- package/templates/native-go/backend/internal/dsm/native/licenses/SOURCE.txt +0 -5
- package/templates/native-go/backend/internal/dsm/native/licenses/ZIG-MIT.txt +0 -21
- package/templates/native-go/backend/internal/dsm/native/provenance.json +0 -18
- package/templates/native-go/backend/internal/filestation/browse_test.go +0 -67
- package/templates/native-go/backend/internal/filestation/check_permission.go +0 -71
- package/templates/native-go/backend/internal/filestation/check_permission_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/client.go +0 -337
- package/templates/native-go/backend/internal/filestation/client_test.go +0 -155
- package/templates/native-go/backend/internal/filestation/doc.go +0 -4
- package/templates/native-go/backend/internal/filestation/download_dsm71_test.go +0 -82
- package/templates/native-go/backend/internal/filestation/http.go +0 -70
- package/templates/native-go/backend/internal/filestation/http_test.go +0 -188
- package/templates/native-go/backend/internal/filestation/operations_test.go +0 -206
- package/templates/native-go/backend/internal/filestation/read_file_test.go +0 -89
- package/templates/native-go/backend/internal/filestation/sdk_policy_test.go +0 -39
- package/templates/native-go/backend/internal/filestation/service.go +0 -254
- package/templates/native-go/backend/internal/filestation/service_test.go +0 -74
- package/templates/native-go/backend/internal/filestation/upload_stream.go +0 -76
- package/templates/native-go/backend/internal/filestation/upload_stream_test.go +0 -77
- package/templates/native-go/backend/internal/filestation/write.go +0 -32
- package/templates/native-go/backend/internal/filestation/write_test.go +0 -124
- package/templates/native-go/backend/internal/identity/README.md +0 -59
- package/templates/native-go/backend/internal/identity/dsm.go +0 -115
- package/templates/native-go/backend/internal/identity/http.go +0 -291
- package/templates/native-go/backend/internal/identity/identity_test.go +0 -530
- package/templates/native-go/backend/internal/identity/service.go +0 -159
- package/templates/native-go/backend/internal/identity/store.go +0 -109
- package/templates/native-go/backend/internal/jsonlimits/limits.go +0 -48
- package/templates/native-go/backend/internal/jsonlimits/limits_test.go +0 -52
- package/templates/native-go/backend/internal/portal/portal.go +0 -138
- package/templates/native-go/backend/internal/portal/portal_test.go +0 -89
- package/templates/native-go/dsm-package.yaml +0 -71
- package/templates/native-go/gitignore +0 -1
- package/templates/native-go/i18n/glossary.json +0 -663
- package/templates/native-go/i18n/messages/de.json +0 -29
- package/templates/native-go/i18n/messages/en.json +0 -29
- package/templates/native-go/i18n/messages/es.json +0 -29
- package/templates/native-go/i18n/messages/fr.json +0 -29
- package/templates/native-go/i18n/messages/it.json +0 -29
- package/templates/native-go/i18n/messages/ja.json +0 -29
- package/templates/native-go/i18n/messages/ko.json +0 -29
- package/templates/native-go/i18n/messages/zh-CN.json +0 -29
- package/templates/native-go/i18n/messages/zh-TW.json +0 -29
- package/templates/native-go/ui/app.css +0 -45
- package/templates/native-go/ui/app.js +0 -111
- package/templates/native-go-delegate/DELEGATE.md +0 -263
- package/templates/native-go-delegate/backend/cmd/background-worker/main.go +0 -48
- package/templates/native-go-delegate/backend/internal/app/delegate.go +0 -25
- package/templates/native-go-delegate/backend/internal/app/delegate_on.go +0 -5
- package/templates/native-go-delegate/backend/internal/app/delegate_routes_test.go +0 -31
- package/templates/native-go-delegate/backend/internal/background/delegate_review_test.go +0 -174
- package/templates/native-go-delegate/backend/internal/background/delegated.go +0 -277
- package/templates/native-go-delegate/backend/internal/background/delegated_moves.go +0 -270
- package/templates/native-go-delegate/backend/internal/background/delegated_test.go +0 -34
- package/templates/native-go-delegate/backend/internal/delegate/admission_recovery_test.go +0 -410
- package/templates/native-go-delegate/backend/internal/delegate/busy_review_test.go +0 -15
- package/templates/native-go-delegate/backend/internal/delegate/cancel_contract_test.go +0 -95
- package/templates/native-go-delegate/backend/internal/delegate/client.go +0 -151
- package/templates/native-go-delegate/backend/internal/delegate/client_test.go +0 -214
- package/templates/native-go-delegate/backend/internal/delegate/destination.go +0 -110
- package/templates/native-go-delegate/backend/internal/delegate/destination_state.go +0 -117
- package/templates/native-go-delegate/backend/internal/delegate/destination_state_test.go +0 -60
- package/templates/native-go-delegate/backend/internal/delegate/destination_test.go +0 -116
- package/templates/native-go-delegate/backend/internal/delegate/example.go +0 -81
- package/templates/native-go-delegate/backend/internal/delegate/example_test.go +0 -91
- package/templates/native-go-delegate/backend/internal/delegate/executor_contract_test.go +0 -511
- package/templates/native-go-delegate/backend/internal/delegate/files.go +0 -132
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes.go +0 -92
- package/templates/native-go-delegate/backend/internal/delegate/long_running_routes_test.go +0 -99
- package/templates/native-go-delegate/backend/internal/delegate/move.go +0 -348
- package/templates/native-go-delegate/backend/internal/delegate/move_test.go +0 -351
- package/templates/native-go-delegate/backend/internal/delegate/operations_list.go +0 -65
- package/templates/native-go-delegate/backend/internal/delegate/operations_list_test.go +0 -114
- package/templates/native-go-delegate/backend/internal/delegate/retry.go +0 -106
- package/templates/native-go-delegate/backend/internal/delegate/retry_test.go +0 -143
- package/templates/native-go-delegate/backend/internal/delegate/service.go +0 -364
- package/templates/native-go-delegate/backend/internal/delegate/service_test.go +0 -318
- package/templates/native-go-delegate/backend/internal/delegate/staging.go +0 -121
- package/templates/native-go-delegate/backend/internal/delegate/status_disabled_test.go +0 -51
- package/templates/native-go-delegate/backend/internal/delegate/testdata/executor_contract.txt +0 -112
- package/templates/native-go-delegate/backend/internal/delegate/transient_contract_test.go +0 -137
- package/templates/native-go-delegate/backend/internal/delegate/wait_cancel_test.go +0 -101
- package/templates/native-go-delegate/backend/internal/delegate/worker.go +0 -225
- package/templates/native-go-delegate/backend/internal/filestation/files.go +0 -43
- package/templates/native-go-delegate/backend/internal/filestation/files_test.go +0 -59
- package/templates/native-go-delegate/frontend/src/CapabilityPanels.vue +0 -37
- package/templates/native-go-delegate/frontend/src/delegate/BackgroundSavePanel.vue +0 -113
- package/templates/native-go-delegate/frontend/src/delegate/DelegatePanel.vue +0 -70
- package/templates/native-go-delegate/frontend/src/delegate/copy.ts +0 -8
- package/templates/native-go-delegate/frontend/src/delegate/i18n/waiting.json +0 -11
- package/templates/native-go-delegate/frontend/test/background-save.test.ts +0 -121
- package/templates/native-go-delegate/frontend/test/delegate.test.ts +0 -145
- package/templates/native-go-delegate/frontend/test/scope-settings.test.ts +0 -49
- package/templates/native-go-delegate/test-frontend.sh +0 -12
- package/templates/native-go-delegate/test.sh +0 -18
- package/templates/native-go-jobs/BACKGROUND.md +0 -108
- package/templates/native-go-jobs/backend/internal/app/background_on.go +0 -7
- package/templates/native-go-jobs/backend/internal/app/background_routes_test.go +0 -90
- package/templates/native-go-jobs/frontend/src/background/BackgroundPanel.vue +0 -170
- package/templates/native-go-jobs/frontend/src/background/i18n/de.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/en.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/es.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/fr.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/it.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ja.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/ko.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-CN.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n/zh-TW.json +0 -75
- package/templates/native-go-jobs/frontend/src/background/i18n.ts +0 -19
- package/templates/native-go-jobs/frontend/src/background/picker-provider.ts +0 -12
- package/templates/native-go-jobs/frontend/src/background/request-key.ts +0 -5
- package/templates/native-go-jobs/frontend/test/background.test.ts +0 -205
- package/templates/native-go-root-ops/backend/internal/app/executor.go +0 -140
- package/templates/native-go-root-ops/backend/internal/app/executor_test.go +0 -117
- package/templates/native-go-root-ops/root/whoami.sh +0 -3
- package/templates/native-go-vue/README.md +0 -47
- package/templates/native-go-vue/frontend/DESIGN.md +0 -61
- package/templates/native-go-vue/frontend/package-lock.json +0 -2530
- package/templates/native-go-vue/frontend/package.json +0 -6
- package/templates/native-go-vue/frontend/src/App.vue +0 -96
- package/templates/native-go-vue/frontend/src/CapabilityPanels.vue +0 -6
- package/templates/native-go-vue/frontend/src/context.ts +0 -78
- package/templates/native-go-vue/frontend/src/delegate/ExecutorSettings.vue +0 -70
- package/templates/native-go-vue/frontend/src/delegate/catalogs.ts +0 -11
- package/templates/native-go-vue/frontend/src/delegate/copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/copy.ts +0 -4
- package/templates/native-go-vue/frontend/src/delegate/executor-settings.test.ts +0 -23
- package/templates/native-go-vue/frontend/src/delegate/executor-setup.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/facade.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/delegate/facade.ts +0 -85
- package/templates/native-go-vue/frontend/src/delegate/i18n/de.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/en.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/es.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/fr.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/it.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ja.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/ko.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/de.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/en.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/es.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/fr.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/it.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ja.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/ko.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-CN.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/save/zh-TW.json +0 -42
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-CN.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/i18n/zh-TW.json +0 -47
- package/templates/native-go-vue/frontend/src/delegate/long-running.ts +0 -57
- package/templates/native-go-vue/frontend/src/delegate/save-copy.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/save-copy.ts +0 -24
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.test.ts +0 -12
- package/templates/native-go-vue/frontend/src/delegate/scoped-picker.ts +0 -21
- package/templates/native-go-vue/frontend/src/files/FileBrowser.vue +0 -131
- package/templates/native-go-vue/frontend/src/files/FilesPage.vue +0 -35
- package/templates/native-go-vue/frontend/src/files/files.test.ts +0 -100
- package/templates/native-go-vue/frontend/src/files/provider.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/files/transfers.test.ts +0 -27
- package/templates/native-go-vue/frontend/src/files/transfers.ts +0 -25
- package/templates/native-go-vue/frontend/src/i18n/de.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/en.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/es.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/fr.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/it.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ja.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/ko.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-CN.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n/zh-TW.json +0 -20
- package/templates/native-go-vue/frontend/src/i18n.ts +0 -13
- package/templates/native-go-vue/frontend/src/identity/DESIGN.md +0 -46
- package/templates/native-go-vue/frontend/src/identity/LoginPage.vue +0 -78
- package/templates/native-go-vue/frontend/src/identity/i18n/de.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/en.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/es.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/fr.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/it.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ja.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/ko.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-CN.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n/zh-TW.json +0 -27
- package/templates/native-go-vue/frontend/src/identity/i18n.ts +0 -14
- package/templates/native-go-vue/frontend/src/identity/login.test.ts +0 -32
- package/templates/native-go-vue/frontend/src/identity/session.test.ts +0 -33
- package/templates/native-go-vue/frontend/src/identity/session.ts +0 -74
- package/templates/native-go-vue/frontend/src/main.ts +0 -32
- package/templates/native-go-vue/frontend/src/nas/NasPicker.vue +0 -42
- package/templates/native-go-vue/frontend/src/nas/contract.ts +0 -12
- package/templates/native-go-vue/frontend/src/nas/destination.test.ts +0 -48
- package/templates/native-go-vue/frontend/src/nas/i18n/files/de.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/en.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/es.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/fr.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/it.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ja.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/ko.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-CN.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n/files/zh-TW.json +0 -41
- package/templates/native-go-vue/frontend/src/nas/i18n.ts +0 -2
- package/templates/native-go-vue/frontend/src/nas/locale.ts +0 -24
- package/templates/native-go-vue/frontend/src/nas/provider.ts +0 -50
- package/templates/native-go-vue/frontend/src/nas/use-request.ts +0 -18
- package/templates/native-go-vue/frontend/src/portal/PortalSettings.vue +0 -39
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +0 -48
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +0 -4
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +0 -17
- package/templates/native-go-vue/frontend/src/shell/pages.ts +0 -15
- package/templates/native-go-vue/frontend/src/style.css +0 -27
- package/templates/native-go-vue/frontend/test/apps.test.ts +0 -57
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +0 -27
- package/templates/native-go-vue/frontend/test/portal-settings.test.ts +0 -71
- package/templates/native-go-vue/frontend/test/shell-i18n.test.ts +0 -50
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +0 -20
- package/templates/native-go-vue/frontend/test/shell.test.ts +0 -30
- package/templates/native-go-vue/frontend/tsconfig.json +0 -1
- package/templates/native-go-vue/frontend/vite.config.ts +0 -10
- package/templates/native-go-vue/gitignore +0 -2
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/fixture_other_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/go.mod +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/main_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_linux_test.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/process_other.go +0 -0
- /package/{dist/templates/_daemon → assets/go/daemon}/testdata/child.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/auth_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/cgi_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/csrf_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/directory_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/gateway_test.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/go.mod +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/groups.go +0 -0
- /package/{dist/templates/_gateway → assets/go/gateway}/main.go +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-LICENSE +0 -0
- /package/{dist/templates/_shared → assets/licenses}/GO-PATENTS +0 -0
- /package/{dist/templates/_shared/LICENSES → assets/licenses}/TEMPLATE.txt +0 -0
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
package background
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"errors"
|
|
6
|
-
"golang.org/x/sys/unix"
|
|
7
|
-
"io"
|
|
8
|
-
"os"
|
|
9
|
-
"time"
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
const MaxSchedules = 8
|
|
13
|
-
const ManualQueueReserve = 4
|
|
14
|
-
|
|
15
|
-
// A tick delayed past this window is missed, never a catch-up submission.
|
|
16
|
-
const ScheduleWindow = 5 * time.Second
|
|
17
|
-
|
|
18
|
-
var ErrScheduleFull = errors.New("background schedule limit reached")
|
|
19
|
-
var ErrInputUnavailable = errors.New("the imported private copy is unavailable")
|
|
20
|
-
|
|
21
|
-
type Schedule struct {
|
|
22
|
-
ID string `json:"id"`
|
|
23
|
-
Key string `json:"key"`
|
|
24
|
-
Owner Submitter `json:"owner"`
|
|
25
|
-
SourceJobID string `json:"sourceJobId"`
|
|
26
|
-
Name string `json:"name"`
|
|
27
|
-
InputDigest string `json:"inputDigest"`
|
|
28
|
-
InputBytes int `json:"inputBytes"`
|
|
29
|
-
WorkerRevision int `json:"workerRevision"`
|
|
30
|
-
IntervalSeconds int `json:"intervalSeconds"`
|
|
31
|
-
Enabled bool `json:"enabled"`
|
|
32
|
-
CreatedAt time.Time `json:"createdAt"`
|
|
33
|
-
NextAt time.Time `json:"nextAt"`
|
|
34
|
-
LastTriggeredAt time.Time `json:"lastTriggeredAt,omitzero"`
|
|
35
|
-
Missed uint64 `json:"missed"`
|
|
36
|
-
LastMissedAt time.Time `json:"lastMissedAt,omitzero"`
|
|
37
|
-
Reason string `json:"reason,omitempty"`
|
|
38
|
-
}
|
|
39
|
-
type ScheduleRequest struct {
|
|
40
|
-
Key string `json:"key"`
|
|
41
|
-
JobID string `json:"jobId"`
|
|
42
|
-
IntervalSeconds int `json:"intervalSeconds"`
|
|
43
|
-
Consent bool `json:"consent"`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
func validInterval(seconds int) bool { return seconds == 3600 || seconds == 86400 || seconds == 604800 }
|
|
47
|
-
func (a Access) seesSchedule(sc Schedule) bool {
|
|
48
|
-
return a.Admin || (a.Owner.Valid() && sc.Owner == a.Owner)
|
|
49
|
-
}
|
|
50
|
-
func findSchedule(j *journal, id string) *Schedule {
|
|
51
|
-
if !jobID.MatchString(id) {
|
|
52
|
-
return nil
|
|
53
|
-
}
|
|
54
|
-
for i := range j.Schedules {
|
|
55
|
-
if j.Schedules[i].ID == id {
|
|
56
|
-
return &j.Schedules[i]
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return nil
|
|
60
|
-
}
|
|
61
|
-
func (s *Store) Schedules(ctx context.Context, a Access) ([]Schedule, error) {
|
|
62
|
-
out := []Schedule{}
|
|
63
|
-
err := s.withJournal(ctx, func(_ *os.Root, j *journal) (bool, error) {
|
|
64
|
-
for _, sc := range j.Schedules {
|
|
65
|
-
if a.seesSchedule(sc) {
|
|
66
|
-
out = append(out, sc)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return false, nil
|
|
70
|
-
})
|
|
71
|
-
return out, err
|
|
72
|
-
}
|
|
73
|
-
func readCopy(root *os.Root, id, digest string, size int) ([]byte, error) {
|
|
74
|
-
if !jobID.MatchString(id) || size < 1 || size > MaxInputBytes {
|
|
75
|
-
return nil, ErrInputUnavailable
|
|
76
|
-
}
|
|
77
|
-
f, err := root.OpenFile(inputs+"/"+id, os.O_RDONLY|unix.O_NOFOLLOW, 0)
|
|
78
|
-
if err != nil {
|
|
79
|
-
return nil, ErrInputUnavailable
|
|
80
|
-
}
|
|
81
|
-
defer f.Close()
|
|
82
|
-
if checkPrivate(f) != nil {
|
|
83
|
-
return nil, ErrInputUnavailable
|
|
84
|
-
}
|
|
85
|
-
b, err := io.ReadAll(io.LimitReader(f, MaxInputBytes+1))
|
|
86
|
-
if err != nil || len(b) != size || sha256hex(b) != digest {
|
|
87
|
-
return nil, ErrInputUnavailable
|
|
88
|
-
}
|
|
89
|
-
return b, nil
|
|
90
|
-
}
|
|
91
|
-
func (s *Store) CreateSchedule(ctx context.Context, r ScheduleRequest, a Access) (Schedule, bool, error) {
|
|
92
|
-
var out Schedule
|
|
93
|
-
dup := false
|
|
94
|
-
if !a.Owner.Valid() || !r.Consent || !validInterval(r.IntervalSeconds) || !keyRE.MatchString(r.Key) {
|
|
95
|
-
return out, false, ErrInvalid
|
|
96
|
-
}
|
|
97
|
-
err := s.withJournal(ctx, func(root *os.Root, j *journal) (bool, error) {
|
|
98
|
-
for _, sc := range j.Schedules {
|
|
99
|
-
if sc.Owner == a.Owner && sc.Key == r.Key {
|
|
100
|
-
if sc.SourceJobID != r.JobID || sc.IntervalSeconds != r.IntervalSeconds {
|
|
101
|
-
return false, ErrKeyConflict
|
|
102
|
-
}
|
|
103
|
-
out, dup = sc, true
|
|
104
|
-
return false, nil
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
job := find(j, r.JobID)
|
|
108
|
-
if job == nil || job.PurgeRequested || job.Submitter != a.Owner {
|
|
109
|
-
return false, ErrNotFound
|
|
110
|
-
}
|
|
111
|
-
// Scheduling only a completed import avoids racing a mutable/incomplete source.
|
|
112
|
-
if job.State != StateSucceeded || job.ScheduleID != "" || job.WorkerRevision != s.revision {
|
|
113
|
-
return false, ErrInputUnavailable
|
|
114
|
-
}
|
|
115
|
-
data, err := readCopy(root, job.ID, job.InputDigest, job.InputBytes)
|
|
116
|
-
if err != nil {
|
|
117
|
-
return false, err
|
|
118
|
-
}
|
|
119
|
-
if len(j.Schedules) >= MaxSchedules {
|
|
120
|
-
return false, ErrScheduleFull
|
|
121
|
-
}
|
|
122
|
-
_, ownerBytes := j.ownerUsage(a.Owner)
|
|
123
|
-
if ownerBytes+int64(len(data)) > MaxOwnerBytes {
|
|
124
|
-
return false, ErrOwnerQuota
|
|
125
|
-
}
|
|
126
|
-
_, used := j.pending()
|
|
127
|
-
if used+int64(len(data)) > s.limits.MaxTotalBytes {
|
|
128
|
-
return false, ErrQuota
|
|
129
|
-
}
|
|
130
|
-
id, err := newID()
|
|
131
|
-
if err != nil {
|
|
132
|
-
return false, err
|
|
133
|
-
}
|
|
134
|
-
if err := writeInput(root, id, data); err != nil {
|
|
135
|
-
return false, err
|
|
136
|
-
}
|
|
137
|
-
now := s.now().UTC()
|
|
138
|
-
out = Schedule{ID: id, Key: r.Key, Owner: a.Owner, SourceJobID: job.ID, Name: job.Name, InputDigest: job.InputDigest, InputBytes: job.InputBytes, WorkerRevision: s.revision, IntervalSeconds: r.IntervalSeconds, Enabled: true, CreatedAt: now, NextAt: now.Add(time.Duration(r.IntervalSeconds) * time.Second)}
|
|
139
|
-
j.Schedules = append(j.Schedules, out)
|
|
140
|
-
return true, nil
|
|
141
|
-
})
|
|
142
|
-
return out, dup, err
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// SetSchedule(false) journals revocation before the cancel watcher can observe it.
|
|
146
|
-
// Enable is administrator-only and requires fresh explicit consent at the route.
|
|
147
|
-
func (s *Store) SetSchedule(ctx context.Context, id string, enabled bool, a Access) (Schedule, error) {
|
|
148
|
-
var out Schedule
|
|
149
|
-
err := s.withJournal(ctx, func(root *os.Root, j *journal) (bool, error) {
|
|
150
|
-
sc := findSchedule(j, id)
|
|
151
|
-
if sc == nil || !a.seesSchedule(*sc) {
|
|
152
|
-
return false, ErrNotFound
|
|
153
|
-
}
|
|
154
|
-
if enabled {
|
|
155
|
-
if !a.Admin {
|
|
156
|
-
return false, ErrInvalid
|
|
157
|
-
}
|
|
158
|
-
if _, err := readCopy(root, sc.ID, sc.InputDigest, sc.InputBytes); err != nil {
|
|
159
|
-
return false, err
|
|
160
|
-
}
|
|
161
|
-
sc.WorkerRevision = s.revision
|
|
162
|
-
sc.Enabled = true
|
|
163
|
-
sc.Reason = ""
|
|
164
|
-
sc.NextAt = s.now().UTC().Add(time.Duration(sc.IntervalSeconds) * time.Second)
|
|
165
|
-
} else {
|
|
166
|
-
sc.Enabled = false
|
|
167
|
-
sc.Reason = "disabled"
|
|
168
|
-
s.cancelScheduleJobs(root, j, id)
|
|
169
|
-
}
|
|
170
|
-
out = *sc
|
|
171
|
-
return true, nil
|
|
172
|
-
})
|
|
173
|
-
return out, err
|
|
174
|
-
}
|
|
175
|
-
func (s *Store) cancelScheduleJobs(root *os.Root, j *journal, id string) {
|
|
176
|
-
for i := range j.Jobs {
|
|
177
|
-
job := &j.Jobs[i]
|
|
178
|
-
if job.ScheduleID != id {
|
|
179
|
-
continue
|
|
180
|
-
}
|
|
181
|
-
if job.State == StateQueued {
|
|
182
|
-
s.finishJob(root, job, StateCanceled, "schedule-disabled")
|
|
183
|
-
} else if job.State == StateRunning {
|
|
184
|
-
job.CancelRequested = true
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
func (s *Store) DeleteSchedule(ctx context.Context, id string, a Access) error {
|
|
189
|
-
return s.withJournal(ctx, func(root *os.Root, j *journal) (bool, error) {
|
|
190
|
-
sc := findSchedule(j, id)
|
|
191
|
-
if sc == nil || !a.seesSchedule(*sc) {
|
|
192
|
-
return false, ErrNotFound
|
|
193
|
-
}
|
|
194
|
-
s.cancelScheduleJobs(root, j, id)
|
|
195
|
-
kept := j.Schedules[:0]
|
|
196
|
-
for _, v := range j.Schedules {
|
|
197
|
-
if v.ID != id {
|
|
198
|
-
kept = append(kept, v)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
j.Schedules = kept
|
|
202
|
-
return true, nil
|
|
203
|
-
})
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
type tickCopy struct {
|
|
207
|
-
schedule Schedule
|
|
208
|
-
err error
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
func (s *Store) reconcileSchedules(root *os.Root, j *journal, recovering bool, copies map[string]tickCopy) bool {
|
|
212
|
-
changed := false
|
|
213
|
-
now := s.now().UTC()
|
|
214
|
-
for i := range j.Schedules {
|
|
215
|
-
sc := &j.Schedules[i]
|
|
216
|
-
if !validInterval(sc.IntervalSeconds) || sc.NextAt.IsZero() {
|
|
217
|
-
sc.Enabled = false
|
|
218
|
-
sc.Reason = "invalid-schedule"
|
|
219
|
-
s.cancelScheduleJobs(root, j, sc.ID)
|
|
220
|
-
changed = true
|
|
221
|
-
continue
|
|
222
|
-
}
|
|
223
|
-
if sc.WorkerRevision != s.revision {
|
|
224
|
-
sc.Enabled = false
|
|
225
|
-
sc.Reason = "worker-changed"
|
|
226
|
-
s.cancelScheduleJobs(root, j, sc.ID)
|
|
227
|
-
changed = true
|
|
228
|
-
continue
|
|
229
|
-
}
|
|
230
|
-
if !sc.Enabled || sc.NextAt.After(now) {
|
|
231
|
-
continue
|
|
232
|
-
}
|
|
233
|
-
due := sc.NextAt
|
|
234
|
-
period := time.Duration(sc.IntervalSeconds) * time.Second
|
|
235
|
-
count := uint64(now.Sub(due)/period) + 1
|
|
236
|
-
// Preparation happens without the journal lock. A concurrent disable,
|
|
237
|
-
// deletion, reapproval or tick invalidates that snapshot. Do not advance
|
|
238
|
-
// its checkpoint unless this admission still uses the exact schedule.
|
|
239
|
-
copy, prepared := copies[sc.ID]
|
|
240
|
-
if !recovering && count == 1 && now.Sub(due) <= ScheduleWindow && (!prepared || copy.schedule != *sc) {
|
|
241
|
-
continue
|
|
242
|
-
}
|
|
243
|
-
sc.NextAt = due.Add(time.Duration(count) * period)
|
|
244
|
-
changed = true
|
|
245
|
-
// Recovery deliberately skips even a just-due tick. There is no startup burst.
|
|
246
|
-
if recovering || count > 1 || now.Sub(due) > ScheduleWindow {
|
|
247
|
-
sc.Missed += count
|
|
248
|
-
sc.LastMissedAt = due
|
|
249
|
-
sc.Reason = "missed"
|
|
250
|
-
continue
|
|
251
|
-
}
|
|
252
|
-
if copy.err != nil {
|
|
253
|
-
sc.Enabled = false
|
|
254
|
-
sc.Reason = "input-unavailable"
|
|
255
|
-
sc.Missed++
|
|
256
|
-
sc.LastMissedAt = due
|
|
257
|
-
continue
|
|
258
|
-
}
|
|
259
|
-
pending, ownerBytes := j.ownerUsage(sc.Owner)
|
|
260
|
-
countPending, used := j.pending()
|
|
261
|
-
reason := ""
|
|
262
|
-
switch {
|
|
263
|
-
case pending >= MaxOwnerPending:
|
|
264
|
-
reason = "owner-queue-full"
|
|
265
|
-
case ownerBytes+int64(sc.InputBytes+resultReserve) > MaxOwnerBytes:
|
|
266
|
-
reason = "owner-quota-exceeded"
|
|
267
|
-
case countPending >= MaxQueued-ManualQueueReserve:
|
|
268
|
-
reason = "queue-full"
|
|
269
|
-
case used+int64(sc.InputBytes+resultReserve) > s.limits.MaxTotalBytes:
|
|
270
|
-
reason = "quota-exceeded"
|
|
271
|
-
}
|
|
272
|
-
if reason != "" {
|
|
273
|
-
sc.Missed++
|
|
274
|
-
sc.LastMissedAt = due
|
|
275
|
-
sc.Reason = reason
|
|
276
|
-
continue
|
|
277
|
-
}
|
|
278
|
-
id, err := newID()
|
|
279
|
-
if err != nil {
|
|
280
|
-
sc.Missed++
|
|
281
|
-
sc.LastMissedAt = due
|
|
282
|
-
sc.Reason = "unavailable"
|
|
283
|
-
continue
|
|
284
|
-
}
|
|
285
|
-
// Private inputs are immutable. Link the verified schedule copy instead
|
|
286
|
-
// of reading, hashing and copying its contents under the journal lock.
|
|
287
|
-
// The worker checks the digest again when it consumes the linked input.
|
|
288
|
-
if err := root.Link(inputs+"/"+sc.ID, inputs+"/"+id); err != nil {
|
|
289
|
-
sc.Missed++
|
|
290
|
-
sc.LastMissedAt = due
|
|
291
|
-
sc.Reason = "unavailable"
|
|
292
|
-
continue
|
|
293
|
-
}
|
|
294
|
-
if err := syncDir(root, inputs); err != nil {
|
|
295
|
-
_ = root.Remove(inputs + "/" + id)
|
|
296
|
-
sc.Missed++
|
|
297
|
-
sc.LastMissedAt = due
|
|
298
|
-
sc.Reason = "unavailable"
|
|
299
|
-
continue
|
|
300
|
-
}
|
|
301
|
-
sc.LastTriggeredAt = due
|
|
302
|
-
sc.Reason = ""
|
|
303
|
-
j.Jobs = append(j.Jobs, Job{ID: id, Key: "schedule-" + id, Name: sc.Name, State: StateQueued, Submitter: sc.Owner, Worker: WorkerSHA256V1, WorkerRevision: s.revision, InputDigest: sc.InputDigest, InputBytes: sc.InputBytes, SubmittedAt: now, ScheduleID: sc.ID, ScheduledAt: due})
|
|
304
|
-
}
|
|
305
|
-
j.trim()
|
|
306
|
-
return changed
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// Tick advances each durable checkpoint and creates a job in the same commit.
|
|
310
|
-
// Multiple processes therefore cannot admit the same schedule trigger twice.
|
|
311
|
-
func (s *Store) Tick(ctx context.Context) error {
|
|
312
|
-
schedules, err := s.Schedules(ctx, Access{Admin: true})
|
|
313
|
-
if err != nil {
|
|
314
|
-
return err
|
|
315
|
-
}
|
|
316
|
-
root, err := s.openRoot()
|
|
317
|
-
if err != nil {
|
|
318
|
-
return err
|
|
319
|
-
}
|
|
320
|
-
defer root.Close()
|
|
321
|
-
copies := make(map[string]tickCopy)
|
|
322
|
-
now := s.now().UTC()
|
|
323
|
-
for _, sc := range schedules {
|
|
324
|
-
if !sc.Enabled || sc.WorkerRevision != s.revision || !validInterval(sc.IntervalSeconds) || sc.NextAt.IsZero() || sc.NextAt.After(now) || now.Sub(sc.NextAt) > ScheduleWindow {
|
|
325
|
-
continue
|
|
326
|
-
}
|
|
327
|
-
_, err := s.readScheduleCopy(ctx, root, sc.ID, sc.InputDigest, sc.InputBytes)
|
|
328
|
-
if ctx.Err() != nil {
|
|
329
|
-
return ctx.Err()
|
|
330
|
-
}
|
|
331
|
-
copies[sc.ID] = tickCopy{schedule: sc, err: err}
|
|
332
|
-
}
|
|
333
|
-
return s.withJournal(ctx, func(root *os.Root, j *journal) (bool, error) {
|
|
334
|
-
return s.reconcileSchedules(root, j, false, copies), nil
|
|
335
|
-
})
|
|
336
|
-
}
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
package background
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"errors"
|
|
6
|
-
"fmt"
|
|
7
|
-
"os"
|
|
8
|
-
"path/filepath"
|
|
9
|
-
"sync"
|
|
10
|
-
"testing"
|
|
11
|
-
"time"
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
func scheduledStore(t *testing.T) (*Store, *time.Time, Job, Schedule) {
|
|
15
|
-
t.Helper()
|
|
16
|
-
s, _ := newStore(t)
|
|
17
|
-
now := time.Date(2026, 10, 5, 0, 0, 0, 0, time.UTC)
|
|
18
|
-
s.now = func() time.Time { return now }
|
|
19
|
-
source := submit(t, s, "source", []byte("copy"))
|
|
20
|
-
_, _ = s.Claim(context.Background())
|
|
21
|
-
if err := s.Finish(context.Background(), source.ID, Outcome{State: StateSucceeded, Result: &Result{SHA256: digest([]byte("copy")), Bytes: 4}}); err != nil {
|
|
22
|
-
t.Fatal(err)
|
|
23
|
-
}
|
|
24
|
-
sc, _, err := s.CreateSchedule(context.Background(), ScheduleRequest{Key: "schedule", JobID: source.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true})
|
|
25
|
-
if err != nil {
|
|
26
|
-
t.Fatal(err)
|
|
27
|
-
}
|
|
28
|
-
return s, &now, source, sc
|
|
29
|
-
}
|
|
30
|
-
func TestScheduleDurablePrivateCopyAndConsent(t *testing.T) {
|
|
31
|
-
s, now, source, sc := scheduledStore(t)
|
|
32
|
-
ctx := context.Background()
|
|
33
|
-
list, err := NewStore(s.dir).Schedules(ctx, Access{Owner: admin})
|
|
34
|
-
if err != nil || len(list) != 1 || list[0].InputDigest != source.InputDigest || !list[0].NextAt.Equal(now.Add(time.Hour)) {
|
|
35
|
-
t.Fatalf("durable %+v %v", list, err)
|
|
36
|
-
}
|
|
37
|
-
b, err := os.ReadFile(filepath.Join(s.dir, inputs, sc.ID))
|
|
38
|
-
if err != nil || string(b) != "copy" {
|
|
39
|
-
t.Fatalf("copy %q %v", b, err)
|
|
40
|
-
}
|
|
41
|
-
for _, r := range []ScheduleRequest{{Key: "x", JobID: source.ID, IntervalSeconds: 3600}, {Key: "x", JobID: source.ID, IntervalSeconds: 1, Consent: true}, {Key: "x", JobID: "../journal.json", IntervalSeconds: 3600, Consent: true}} {
|
|
42
|
-
if _, _, err := s.CreateSchedule(ctx, r, Access{Owner: admin, Admin: true}); err == nil {
|
|
43
|
-
t.Fatalf("admitted %+v", r)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
again, dup, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "schedule", JobID: source.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true})
|
|
47
|
-
if err != nil || !dup || again.ID != sc.ID {
|
|
48
|
-
t.Fatalf("retry %+v %v %v", again, dup, err)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
func TestScheduleConcurrentTwoTriggersNoReplayRestartMissed(t *testing.T) {
|
|
52
|
-
s, now, _, sc := scheduledStore(t)
|
|
53
|
-
ctx := context.Background()
|
|
54
|
-
for round := 1; round <= 2; round++ {
|
|
55
|
-
*now = now.Add(time.Hour)
|
|
56
|
-
var wg sync.WaitGroup
|
|
57
|
-
for i := 0; i < 8; i++ {
|
|
58
|
-
wg.Add(1)
|
|
59
|
-
go func() {
|
|
60
|
-
defer wg.Done()
|
|
61
|
-
if err := s.Tick(ctx); err != nil {
|
|
62
|
-
t.Error(err)
|
|
63
|
-
}
|
|
64
|
-
}()
|
|
65
|
-
}
|
|
66
|
-
wg.Wait()
|
|
67
|
-
jobs, _ := s.List(ctx)
|
|
68
|
-
n := 0
|
|
69
|
-
for _, j := range jobs {
|
|
70
|
-
if j.ScheduleID == sc.ID {
|
|
71
|
-
n++
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if n != round {
|
|
75
|
-
t.Fatalf("round %d got %d", round, n)
|
|
76
|
-
}
|
|
77
|
-
j, err := s.Claim(ctx)
|
|
78
|
-
if err != nil || j == nil {
|
|
79
|
-
t.Fatal(err)
|
|
80
|
-
}
|
|
81
|
-
if !j.ScheduledAt.Equal(*now) {
|
|
82
|
-
t.Fatal("trigger time")
|
|
83
|
-
}
|
|
84
|
-
if err := s.Finish(ctx, j.ID, Outcome{State: StateSucceeded, Result: &Result{SHA256: j.InputDigest, Bytes: 4}}); err != nil {
|
|
85
|
-
t.Fatal(err)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
before, _ := s.List(ctx)
|
|
89
|
-
*now = now.Add(3*time.Hour + time.Minute)
|
|
90
|
-
if err := s.Recover(ctx); err != nil {
|
|
91
|
-
t.Fatal(err)
|
|
92
|
-
}
|
|
93
|
-
_ = s.Tick(ctx)
|
|
94
|
-
after, _ := s.List(ctx)
|
|
95
|
-
if len(after) != len(before) {
|
|
96
|
-
t.Fatal("restart replayed")
|
|
97
|
-
}
|
|
98
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
99
|
-
if list[0].Missed != 3 || !list[0].NextAt.After(*now) {
|
|
100
|
-
t.Fatalf("missed %+v", list)
|
|
101
|
-
}
|
|
102
|
-
*now = now.Add(-4 * time.Hour)
|
|
103
|
-
_ = s.Tick(ctx)
|
|
104
|
-
after, _ = s.List(ctx)
|
|
105
|
-
if len(after) != len(before) {
|
|
106
|
-
t.Fatal("backward clock replay")
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
func TestScheduleIsolationDisableDeleteRevision(t *testing.T) {
|
|
110
|
-
s, now, source, sc := scheduledStore(t)
|
|
111
|
-
ctx := context.Background()
|
|
112
|
-
other := Access{Owner: Submitter{User: "normal2", UID: "1026"}}
|
|
113
|
-
if list, _ := s.Schedules(ctx, other); len(list) != 0 {
|
|
114
|
-
t.Fatal("leak")
|
|
115
|
-
}
|
|
116
|
-
if _, err := s.SetSchedule(ctx, sc.ID, false, other); !errors.Is(err, ErrNotFound) {
|
|
117
|
-
t.Fatal(err)
|
|
118
|
-
}
|
|
119
|
-
if err := s.DeleteSchedule(ctx, sc.ID, other); !errors.Is(err, ErrNotFound) {
|
|
120
|
-
t.Fatal(err)
|
|
121
|
-
}
|
|
122
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "steal", JobID: source.ID, IntervalSeconds: 3600, Consent: true}, other); err == nil {
|
|
123
|
-
t.Fatal("cross-owner")
|
|
124
|
-
}
|
|
125
|
-
*now = now.Add(time.Hour)
|
|
126
|
-
_ = s.Tick(ctx)
|
|
127
|
-
job, _ := s.Claim(ctx)
|
|
128
|
-
if _, err := s.SetSchedule(ctx, sc.ID, false, Access{Owner: admin}); err != nil {
|
|
129
|
-
t.Fatal(err)
|
|
130
|
-
}
|
|
131
|
-
_ = s.Finish(ctx, job.ID, Outcome{State: StateSucceeded, Result: &Result{Bytes: 4}})
|
|
132
|
-
got, _ := s.Get(ctx, job.ID)
|
|
133
|
-
if got.State != StateCanceled || got.Result != nil {
|
|
134
|
-
t.Fatal("disable lost")
|
|
135
|
-
}
|
|
136
|
-
*now = now.Add(time.Hour)
|
|
137
|
-
_ = s.Tick(ctx)
|
|
138
|
-
jobs, _ := s.List(ctx)
|
|
139
|
-
if len(jobs) != 2 {
|
|
140
|
-
t.Fatal("disabled trigger")
|
|
141
|
-
}
|
|
142
|
-
if _, err := s.SetSchedule(ctx, sc.ID, true, Access{Owner: admin}); !errors.Is(err, ErrInvalid) {
|
|
143
|
-
t.Fatal(err)
|
|
144
|
-
}
|
|
145
|
-
s.revision++
|
|
146
|
-
if err := s.Recover(ctx); err != nil {
|
|
147
|
-
t.Fatal(err)
|
|
148
|
-
}
|
|
149
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
150
|
-
if list[0].Enabled || list[0].Reason != "worker-changed" {
|
|
151
|
-
t.Fatal(list)
|
|
152
|
-
}
|
|
153
|
-
if _, err := s.SetSchedule(ctx, sc.ID, true, Access{Admin: true, Owner: admin}); err != nil {
|
|
154
|
-
t.Fatal(err)
|
|
155
|
-
}
|
|
156
|
-
list, _ = s.Schedules(ctx, Access{Admin: true})
|
|
157
|
-
if list[0].WorkerRevision != s.revision {
|
|
158
|
-
t.Fatal("revision")
|
|
159
|
-
}
|
|
160
|
-
if err := s.DeleteSchedule(ctx, sc.ID, Access{Owner: admin}); err != nil {
|
|
161
|
-
t.Fatal(err)
|
|
162
|
-
}
|
|
163
|
-
if _, err := os.Stat(filepath.Join(s.dir, inputs, sc.ID)); !errors.Is(err, os.ErrNotExist) {
|
|
164
|
-
t.Fatal("copy remains")
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
func TestScheduleBoundsQuotasAndModeRevocation(t *testing.T) {
|
|
168
|
-
s, now, source, _ := scheduledStore(t)
|
|
169
|
-
ctx := context.Background()
|
|
170
|
-
for i := 1; i < MaxSchedules; i++ {
|
|
171
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: fmt.Sprint(i), JobID: source.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true}); err != nil {
|
|
172
|
-
t.Fatal(err)
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "overflow", JobID: source.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true}); !errors.Is(err, ErrScheduleFull) {
|
|
176
|
-
t.Fatal(err)
|
|
177
|
-
}
|
|
178
|
-
*now = now.Add(time.Hour)
|
|
179
|
-
_ = s.Tick(ctx)
|
|
180
|
-
jobs, _ := s.List(ctx)
|
|
181
|
-
n := 0
|
|
182
|
-
for _, j := range jobs {
|
|
183
|
-
if !j.State.terminal() {
|
|
184
|
-
n++
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if n != MaxOwnerPending {
|
|
188
|
-
t.Fatalf("pending %d", n)
|
|
189
|
-
}
|
|
190
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
191
|
-
missed := uint64(0)
|
|
192
|
-
for _, sc := range list {
|
|
193
|
-
missed += sc.Missed
|
|
194
|
-
}
|
|
195
|
-
if missed != 6 {
|
|
196
|
-
t.Fatalf("missed %d", missed)
|
|
197
|
-
}
|
|
198
|
-
for _, sc := range list {
|
|
199
|
-
if _, err := s.SetSchedule(ctx, sc.ID, false, Access{Admin: true}); err != nil {
|
|
200
|
-
t.Fatal(err)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
*now = now.Add(time.Hour)
|
|
204
|
-
_ = s.Tick(ctx)
|
|
205
|
-
list, _ = s.Schedules(ctx, Access{Admin: true})
|
|
206
|
-
for _, sc := range list {
|
|
207
|
-
if sc.Enabled {
|
|
208
|
-
t.Fatal("revived")
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
func TestScheduleLateLegacyTamperPurge(t *testing.T) {
|
|
213
|
-
s, now, source, sc := scheduledStore(t)
|
|
214
|
-
ctx := context.Background()
|
|
215
|
-
*now = now.Add(time.Hour + time.Minute)
|
|
216
|
-
_ = s.Tick(ctx)
|
|
217
|
-
jobs, _ := s.List(ctx)
|
|
218
|
-
if len(jobs) != 1 {
|
|
219
|
-
t.Fatal("catchup")
|
|
220
|
-
}
|
|
221
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
222
|
-
if list[0].Missed != 1 || list[0].Reason != "missed" {
|
|
223
|
-
t.Fatal(list)
|
|
224
|
-
}
|
|
225
|
-
_ = os.Remove(filepath.Join(s.dir, inputs, source.ID))
|
|
226
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "legacy", JobID: source.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true}); !errors.Is(err, ErrInputUnavailable) {
|
|
227
|
-
t.Fatal(err)
|
|
228
|
-
}
|
|
229
|
-
_ = os.WriteFile(filepath.Join(s.dir, inputs, sc.ID), []byte("evil"), 0600)
|
|
230
|
-
*now = list[0].NextAt
|
|
231
|
-
_ = s.Tick(ctx)
|
|
232
|
-
list, _ = s.Schedules(ctx, Access{Admin: true})
|
|
233
|
-
if list[0].Enabled || list[0].Reason != "input-unavailable" {
|
|
234
|
-
t.Fatal(list)
|
|
235
|
-
}
|
|
236
|
-
_, err := s.PurgeOwner(ctx, admin, "admin")
|
|
237
|
-
if err != nil {
|
|
238
|
-
t.Fatal(err)
|
|
239
|
-
}
|
|
240
|
-
list, _ = s.Schedules(ctx, Access{Admin: true})
|
|
241
|
-
if len(list) != 0 {
|
|
242
|
-
t.Fatal("purge schedule")
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
func TestScheduleReservesFourManualQueueSlots(t *testing.T) {
|
|
247
|
-
s, now, _, sc := scheduledStore(t)
|
|
248
|
-
ctx := context.Background()
|
|
249
|
-
for i := 0; i < 12; i++ {
|
|
250
|
-
_, _, err := s.Submit(ctx, SubmitRequest{Key: fmt.Sprint(i), Name: "manual", Data: []byte("x"), Submitter: Submitter{User: "other", UID: fmt.Sprint(2000 + i)}})
|
|
251
|
-
if err != nil {
|
|
252
|
-
t.Fatal(err)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
*now = now.Add(time.Hour)
|
|
256
|
-
if err := s.Tick(ctx); err != nil {
|
|
257
|
-
t.Fatal(err)
|
|
258
|
-
}
|
|
259
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
260
|
-
if list[0].ID != sc.ID || list[0].Reason != "queue-full" || list[0].Missed != 1 {
|
|
261
|
-
t.Fatal(list)
|
|
262
|
-
}
|
|
263
|
-
for i := 12; i < 16; i++ {
|
|
264
|
-
_, _, err := s.Submit(ctx, SubmitRequest{Key: fmt.Sprint(i), Name: "manual", Data: []byte("x"), Submitter: Submitter{User: "other", UID: fmt.Sprint(2000 + i)}})
|
|
265
|
-
if err != nil {
|
|
266
|
-
t.Fatalf("reserved slot: %v", err)
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
func TestRetainedCopyQuotaHistoryAndOrdinarySchedule(t *testing.T) {
|
|
271
|
-
s, now, source, _ := scheduledStore(t)
|
|
272
|
-
ctx := context.Background()
|
|
273
|
-
if err := s.Recover(ctx); err != nil {
|
|
274
|
-
t.Fatal(err)
|
|
275
|
-
}
|
|
276
|
-
if _, err := os.Stat(filepath.Join(s.dir, inputs, source.ID)); err != nil {
|
|
277
|
-
t.Fatal("recover deleted retained import")
|
|
278
|
-
}
|
|
279
|
-
_, bytes := func() (int, int64) {
|
|
280
|
-
var n int
|
|
281
|
-
var b int64
|
|
282
|
-
_ = s.withJournal(ctx, func(_ *os.Root, j *journal) (bool, error) { n, b = j.ownerUsage(admin); return false, nil })
|
|
283
|
-
return n, b
|
|
284
|
-
}()
|
|
285
|
-
if bytes != 8+resultReserve {
|
|
286
|
-
t.Fatalf("retained quota %d", bytes)
|
|
287
|
-
}
|
|
288
|
-
owner := Submitter{User: "normal1", UID: "1025"}
|
|
289
|
-
j, _, err := s.Submit(ctx, SubmitRequest{Key: "user", Name: "copy", Data: []byte("copy"), Submitter: owner})
|
|
290
|
-
if err != nil {
|
|
291
|
-
t.Fatal(err)
|
|
292
|
-
}
|
|
293
|
-
_, _ = s.Claim(ctx)
|
|
294
|
-
_ = s.Finish(ctx, j.ID, Outcome{State: StateSucceeded, Result: &Result{Bytes: 4}})
|
|
295
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "user", JobID: j.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: owner}); err != nil {
|
|
296
|
-
t.Fatal(err)
|
|
297
|
-
}
|
|
298
|
-
for i := 0; i < MaxHistory+2; i++ {
|
|
299
|
-
j := submit(t, s, fmt.Sprint(i), []byte("x"))
|
|
300
|
-
_, _ = s.Claim(ctx)
|
|
301
|
-
_ = s.Finish(ctx, j.ID, Outcome{State: StateSucceeded, Result: &Result{Bytes: 1}})
|
|
302
|
-
}
|
|
303
|
-
if _, err := os.Stat(filepath.Join(s.dir, inputs, source.ID)); !errors.Is(err, os.ErrNotExist) {
|
|
304
|
-
t.Fatal("history leaked copy")
|
|
305
|
-
}
|
|
306
|
-
// Pin survives trimming of the imported source job.
|
|
307
|
-
list, _ := s.Schedules(ctx, Access{Admin: true})
|
|
308
|
-
*now = list[0].NextAt
|
|
309
|
-
_ = s.Tick(ctx)
|
|
310
|
-
jobs, _ := s.List(ctx)
|
|
311
|
-
found := false
|
|
312
|
-
for _, j := range jobs {
|
|
313
|
-
if j.ScheduleID == list[0].ID {
|
|
314
|
-
found = true
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if !found {
|
|
318
|
-
t.Fatal("history removed pin")
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
func TestGlobalQuotaReservesResultBeforeRetainedCopyAdmission(t *testing.T) {
|
|
323
|
-
s, _ := newStore(t)
|
|
324
|
-
ctx := context.Background()
|
|
325
|
-
s.limits.MaxTotalBytes = resultReserve + 1
|
|
326
|
-
_, _, err := s.Submit(ctx, SubmitRequest{Key: "oversized-total", Name: "copy", Data: []byte("xx"), Submitter: admin})
|
|
327
|
-
if !errors.Is(err, ErrQuota) {
|
|
328
|
-
t.Fatalf("result reservation overflow admitted: %v", err)
|
|
329
|
-
}
|
|
330
|
-
j := submit(t, s, "exact", []byte("x"))
|
|
331
|
-
_, _ = s.Claim(ctx)
|
|
332
|
-
_ = s.Finish(ctx, j.ID, Outcome{State: StateSucceeded, Result: &Result{Bytes: 1}})
|
|
333
|
-
if _, _, err := s.CreateSchedule(ctx, ScheduleRequest{Key: "pin", JobID: j.ID, IntervalSeconds: 3600, Consent: true}, Access{Owner: admin, Admin: true}); !errors.Is(err, ErrQuota) {
|
|
334
|
-
t.Fatalf("retained copy quota %v", err)
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
func TestTickReadsCopyOutsideLockAndRechecksRevocation(t *testing.T) {
|
|
339
|
-
s, now, _, sc := scheduledStore(t)
|
|
340
|
-
*now = now.Add(time.Hour)
|
|
341
|
-
entered, resume := make(chan struct{}), make(chan struct{})
|
|
342
|
-
s.readScheduleCopy = func(ctx context.Context, root *os.Root, id, digest string, size int) ([]byte, error) {
|
|
343
|
-
close(entered)
|
|
344
|
-
<-resume
|
|
345
|
-
return readCopy(root, id, digest, size)
|
|
346
|
-
}
|
|
347
|
-
done := make(chan error, 1)
|
|
348
|
-
go func() { done <- s.Tick(context.Background()) }()
|
|
349
|
-
select {
|
|
350
|
-
case <-entered:
|
|
351
|
-
case <-time.After(time.Second):
|
|
352
|
-
t.Fatal("tick never prepared copy")
|
|
353
|
-
}
|
|
354
|
-
ctx, cancel := context.WithTimeout(context.Background(), 250*time.Millisecond)
|
|
355
|
-
defer cancel()
|
|
356
|
-
_, err := s.SetSchedule(ctx, sc.ID, false, Access{Owner: admin})
|
|
357
|
-
close(resume)
|
|
358
|
-
if tickErr := <-done; tickErr != nil {
|
|
359
|
-
t.Fatal(tickErr)
|
|
360
|
-
}
|
|
361
|
-
if err != nil {
|
|
362
|
-
t.Fatalf("copy read held journal lock: %v", err)
|
|
363
|
-
}
|
|
364
|
-
jobs, err := s.List(context.Background())
|
|
365
|
-
if err != nil || len(jobs) != 1 {
|
|
366
|
-
t.Fatalf("revoked snapshot admitted: %+v %v", jobs, err)
|
|
367
|
-
}
|
|
368
|
-
}
|