@synopackageland/cli 0.4.1 → 0.5.3
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/README.md +7 -3
- package/dist/authorization-sdk.d.ts +5 -0
- package/dist/authorization-sdk.js +5 -0
- package/dist/build-spk/delete-app-data.d.ts +27 -7
- package/dist/build-spk/delete-app-data.js +35 -34
- package/dist/build-spk/dsm-arch.d.ts +6 -1
- package/dist/build-spk/dsm-arch.js +25 -1
- package/dist/build-spk/dsm-version.d.ts +14 -0
- package/dist/build-spk/dsm-version.js +47 -0
- package/dist/build-spk/gateway.d.ts +31 -0
- package/dist/build-spk/gateway.js +55 -0
- package/dist/build-spk/generator.d.ts +5 -0
- package/dist/build-spk/generator.js +103 -107
- package/dist/build-spk/install-wizard.d.ts +20 -0
- package/dist/build-spk/install-wizard.js +76 -0
- package/dist/build-spk/native-lifecycle.d.ts +5 -0
- package/dist/build-spk/native-lifecycle.js +12 -2
- package/dist/build-spk/resource-worker.d.ts +9 -4
- package/dist/build-spk/resource-worker.js +15 -6
- package/dist/build-spk/share-combobox.d.ts +3 -0
- package/dist/build-spk/share-combobox.js +27 -0
- package/dist/build-spk/uninstall-wizard.d.ts +14 -0
- package/dist/build-spk/uninstall-wizard.js +33 -0
- package/dist/build-spk/wizard-i18n.d.ts +18 -0
- package/dist/build-spk/wizard-i18n.js +38 -0
- package/dist/build-spk/wizard-messages.d.ts +388 -0
- package/dist/build-spk/wizard-messages.js +387 -0
- package/dist/cli.js +132 -32
- package/dist/compose/analyze.d.ts +20 -0
- package/dist/compose/analyze.js +75 -11
- package/dist/contract/validate.js +33 -1
- package/dist/contract/web-launch.d.ts +22 -0
- package/dist/contract/web-launch.js +37 -0
- package/dist/deploy/deploy.d.ts +3 -0
- package/dist/deploy/deploy.js +11 -2
- package/dist/error-registry.js +62 -3
- package/dist/host/dsm-port-profile.d.ts +1 -1
- package/dist/host/dsm-port-profile.js +1 -1
- package/dist/host/open-url.d.ts +2 -0
- package/dist/host/open-url.js +4 -1
- package/dist/images/pin.d.ts +52 -0
- package/dist/images/pin.js +249 -0
- package/dist/init.d.ts +27 -3
- package/dist/init.js +126 -16
- package/dist/inspect.d.ts +3 -0
- package/dist/inspect.js +15 -3
- package/dist/standalone/authorization-window.d.ts +2 -0
- package/dist/standalone/authorization-window.js +28 -0
- package/dist/standalone/authorization.d.ts +48 -0
- package/dist/standalone/authorization.js +116 -0
- package/dist/standalone/background.d.ts +21 -0
- package/dist/standalone/background.js +52 -0
- package/dist/standalone/binary.d.ts +1 -0
- package/dist/standalone/binary.js +1 -1
- package/dist/standalone/build.d.ts +2 -0
- package/dist/standalone/build.js +54 -10
- package/dist/standalone/dsm-window.js +10 -3
- package/dist/standalone/helper-inventory.d.ts +15 -0
- package/dist/standalone/helper-inventory.js +9 -0
- package/dist/standalone/helper.d.ts +1 -0
- package/dist/standalone/helper.js +29 -11
- package/dist/standalone/host-adapter.d.ts +1 -1
- package/dist/standalone/host-adapter.js +33 -15
- package/dist/standalone/host-file-navigation.d.ts +7 -0
- package/dist/standalone/host-file-navigation.js +172 -0
- package/dist/standalone/inspect-helper.js +21 -6
- package/dist/standalone/inspect-spk.d.ts +1 -1
- package/dist/standalone/inspect-spk.js +211 -7
- package/dist/standalone/job-diagnostics.d.ts +1 -0
- package/dist/standalone/job-diagnostics.js +49 -0
- package/dist/standalone/lifecycle-helper.d.ts +1 -1
- package/dist/standalone/lifecycle-helper.js +2 -2
- package/dist/standalone/lifecycle.d.ts +1 -1
- package/dist/standalone/lifecycle.js +14 -4
- package/dist/standalone/manifest.d.ts +15 -2
- package/dist/standalone/manifest.js +37 -6
- package/dist/standalone/native-layout.d.ts +74 -0
- package/dist/standalone/native-layout.js +318 -0
- package/dist/standalone/resource.d.ts +11 -0
- package/dist/standalone/resource.js +13 -0
- package/dist/standalone/root-ops.d.ts +2 -0
- package/dist/standalone/root-ops.js +10 -0
- package/dist/standalone/root-window.d.ts +3 -1
- package/dist/standalone/root-window.js +156 -38
- package/dist/standalone/shared-folder.d.ts +39 -0
- package/dist/standalone/shared-folder.js +141 -0
- package/dist/standalone/spk.d.ts +4 -0
- package/dist/standalone/spk.js +47 -3
- package/dist/standalone/worker-contract-json.d.ts +8 -0
- package/dist/standalone/worker-contract-json.js +141 -0
- package/dist/standalone/worker-contract.d.ts +189 -0
- package/dist/standalone/worker-contract.js +175 -0
- package/dist/standalone/worker-registry.d.ts +40 -0
- package/dist/standalone/worker-registry.js +167 -0
- package/dist/templates/_authorization/main.go +104 -0
- package/dist/templates/_authorization/main_test.go +35 -0
- package/dist/templates/_daemon/go.mod +2 -0
- package/dist/templates/_gateway/auth.go +101 -0
- package/dist/templates/_gateway/auth_test.go +216 -0
- package/dist/templates/_gateway/cgi.go +133 -0
- package/dist/templates/_gateway/cgi_test.go +156 -0
- package/dist/templates/_gateway/csrf.go +73 -0
- package/dist/templates/_gateway/csrf_test.go +155 -0
- package/dist/templates/_gateway/directory.go +108 -0
- package/dist/templates/_gateway/directory_test.go +202 -0
- package/dist/templates/_gateway/gateway.go +412 -0
- package/dist/templates/_gateway/gateway_test.go +676 -0
- package/dist/templates/_gateway/go.mod +3 -0
- package/dist/templates/_gateway/groups.go +66 -0
- package/dist/templates/_gateway/main.go +45 -0
- package/dist/templates/binary/synology-app.yaml +1 -1
- package/dist/templates/compose-import/compose.yaml +1 -1
- package/dist/templates/compose-import/synology-app.yaml +1 -1
- package/dist/templates/hello-files/compose.yaml +1 -1
- package/dist/templates/hello-files/synology-app.yaml +1 -1
- package/dist/templates/native-go/README.md +118 -5
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/dist/templates/native-go/backend/cmd/app/main.go +25 -6
- package/dist/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/dist/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/dist/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/dist/templates/native-go/backend/go.mod +5 -3
- package/dist/templates/native-go/backend/go.sum +4 -4
- package/dist/templates/native-go/backend/internal/api/registry.go +17 -6
- package/dist/templates/native-go/backend/internal/api/server.go +7 -1
- package/dist/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/dist/templates/native-go/backend/internal/app/background.go +270 -0
- package/dist/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/dist/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/dist/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/dist/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/dist/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +22 -5
- package/dist/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/dist/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/dist/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/dist/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/dist/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/dist/templates/native-go/backend/internal/background/access.go +57 -0
- package/dist/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/dist/templates/native-go/backend/internal/background/runner.go +185 -0
- package/dist/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/dist/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/dist/templates/native-go/backend/internal/background/store.go +807 -0
- package/dist/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/dist/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/dist/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/dist/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/dist/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/dist/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/dist/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/dist/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/management.go +86 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/dist/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/dist/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/dist/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/status.go +22 -13
- package/dist/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/dist/templates/native-go/dsm-package.yaml +2 -2
- package/dist/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/dist/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/dist/templates/native-go-background/BACKGROUND.md +111 -0
- package/dist/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/dist/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/dist/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/dist/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/dist/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/dist/templates/native-go-vue/README.md +38 -7
- package/dist/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/dist/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/dist/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/dist/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/dist/templates/native-go-vue/frontend/package.json +1 -1
- package/dist/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/dist/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/dist/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/dist/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/dist/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/dist/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/dist/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +2 -6
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/dist/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/dist/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/dist/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/dist/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/dist/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/dist/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/dist/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/dist/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/validate.js +6 -3
- package/package.json +5 -2
- package/schema/synology-app.schema.json +19 -0
- package/skills/reference/create.md +6 -2
- package/templates/_authorization/main.go +104 -0
- package/templates/_authorization/main_test.go +35 -0
- package/templates/_daemon/go.mod +2 -0
- package/templates/_gateway/auth.go +101 -0
- package/templates/_gateway/auth_test.go +216 -0
- package/templates/_gateway/cgi.go +133 -0
- package/templates/_gateway/cgi_test.go +156 -0
- package/templates/_gateway/csrf.go +73 -0
- package/templates/_gateway/csrf_test.go +155 -0
- package/templates/_gateway/directory.go +108 -0
- package/templates/_gateway/directory_test.go +202 -0
- package/templates/_gateway/gateway.go +412 -0
- package/templates/_gateway/gateway_test.go +676 -0
- package/templates/_gateway/go.mod +3 -0
- package/templates/_gateway/groups.go +66 -0
- package/templates/_gateway/main.go +45 -0
- package/templates/binary/synology-app.yaml +1 -1
- package/templates/compose-import/compose.yaml +1 -1
- package/templates/compose-import/synology-app.yaml +1 -1
- package/templates/hello-files/compose.yaml +1 -1
- package/templates/hello-files/synology-app.yaml +1 -1
- package/templates/native-go/README.md +118 -5
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/templates/native-go/backend/cmd/app/main.go +25 -6
- package/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/templates/native-go/backend/go.mod +5 -3
- package/templates/native-go/backend/go.sum +4 -4
- package/templates/native-go/backend/internal/api/registry.go +17 -6
- package/templates/native-go/backend/internal/api/server.go +7 -1
- package/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/templates/native-go/backend/internal/app/background.go +270 -0
- package/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/templates/native-go/backend/internal/app/routes.go +22 -5
- package/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/templates/native-go/backend/internal/background/access.go +57 -0
- package/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/templates/native-go/backend/internal/background/runner.go +185 -0
- package/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/templates/native-go/backend/internal/background/store.go +807 -0
- package/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/management.go +86 -0
- package/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/templates/native-go/backend/internal/helper/status.go +22 -13
- package/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/templates/native-go/dsm-package.yaml +2 -2
- package/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/templates/native-go-background/BACKGROUND.md +111 -0
- package/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/templates/native-go-vue/README.md +38 -7
- package/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/templates/native-go-vue/frontend/src/style.css +2 -6
- package/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/templates/hello-web/compose.yaml +0 -21
- package/dist/templates/hello-web/html/app.js +0 -1
- package/dist/templates/hello-web/html/index.html +0 -13
- package/dist/templates/hello-web/synology-app.yaml +0 -13
- package/dist/templates/hello-web-page/compose.yaml +0 -21
- package/dist/templates/hello-web-page/html/app.js +0 -1
- package/dist/templates/hello-web-page/html/index.html +0 -13
- package/dist/templates/hello-web-page/synology-app.yaml +0 -13
- package/templates/hello-web/compose.yaml +0 -21
- package/templates/hello-web/html/app.js +0 -1
- package/templates/hello-web/html/index.html +0 -13
- package/templates/hello-web/synology-app.yaml +0 -13
- package/templates/hello-web-page/compose.yaml +0 -21
- package/templates/hello-web-page/html/app.js +0 -1
- package/templates/hello-web-page/html/index.html +0 -13
- package/templates/hello-web-page/synology-app.yaml +0 -13
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
//go:build synopkgland_sdk_workers
|
|
2
|
+
|
|
3
|
+
package helper
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"context"
|
|
7
|
+
"dsmapp/internal/helper/jobcontract"
|
|
8
|
+
"encoding/json"
|
|
9
|
+
"fmt"
|
|
10
|
+
"slices"
|
|
11
|
+
"syscall"
|
|
12
|
+
"testing"
|
|
13
|
+
"time"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
type sdkMemoryJournal struct {
|
|
17
|
+
sdkJobTestJournal
|
|
18
|
+
records []sdkJournalRecord
|
|
19
|
+
recordsCode Code
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func (j *sdkMemoryJournal) Records() ([]sdkJournalRecord, Code) {
|
|
23
|
+
if j.recordsCode != "" {
|
|
24
|
+
return nil, j.recordsCode
|
|
25
|
+
}
|
|
26
|
+
out := []sdkJournalRecord{}
|
|
27
|
+
for _, r := range j.records {
|
|
28
|
+
raw, _ := encodeSDKJournal(r)
|
|
29
|
+
copy, c := decodeSDKJournal(raw)
|
|
30
|
+
if c != "" {
|
|
31
|
+
return nil, c
|
|
32
|
+
}
|
|
33
|
+
out = append(out, copy)
|
|
34
|
+
}
|
|
35
|
+
return out, ""
|
|
36
|
+
}
|
|
37
|
+
func (j *sdkMemoryJournal) Reserve(i sdkJobIntent) Code {
|
|
38
|
+
if c := j.sdkJobTestJournal.Reserve(i); c != "" {
|
|
39
|
+
return c
|
|
40
|
+
}
|
|
41
|
+
b, _ := json.Marshal(sdkJournalRecord{Schema: 1, Intent: i, State: "pending"})
|
|
42
|
+
r, c := decodeSDKJournal(b)
|
|
43
|
+
if c != "" {
|
|
44
|
+
return c
|
|
45
|
+
}
|
|
46
|
+
j.records = append(j.records, r)
|
|
47
|
+
return ""
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type sdkBackgroundValidatorFake struct {
|
|
51
|
+
root readOnlyRootWitness
|
|
52
|
+
now func() time.Time
|
|
53
|
+
code Code
|
|
54
|
+
after func()
|
|
55
|
+
mutate func(*sdkBackgroundProof)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func (v *sdkBackgroundValidatorFake) ValidateBackground(_ context.Context, _ backgroundSnapshot, r sdkJobRequest, g Grant) (sdkBackgroundProof, Code) {
|
|
59
|
+
if v.after != nil {
|
|
60
|
+
v.after()
|
|
61
|
+
}
|
|
62
|
+
p := sdkBackgroundProof{Binding: r.Control.Binding, Continuity: g.LastValidated, Continuous: true, CheckedAt: v.now(), Root: v.root}
|
|
63
|
+
if v.mutate != nil {
|
|
64
|
+
v.mutate(&p)
|
|
65
|
+
}
|
|
66
|
+
return p, v.code
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type sdkBackgroundFixture struct {
|
|
70
|
+
*sdkJobTestFixture
|
|
71
|
+
bg *sdkBackgroundOwner
|
|
72
|
+
offline *offlineFake
|
|
73
|
+
journal2 *sdkMemoryJournal
|
|
74
|
+
validator2 *sdkBackgroundValidatorFake
|
|
75
|
+
wall time.Time
|
|
76
|
+
mono time.Duration
|
|
77
|
+
clockKnown bool
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
func newSDKBackgroundFixture(t *testing.T) *sdkBackgroundFixture {
|
|
81
|
+
f := sdkJobFixture(t, jobcontract.Interactive, jobcontract.Background)
|
|
82
|
+
x := &sdkBackgroundFixture{sdkJobTestFixture: f, wall: f.c.now(), clockKnown: true}
|
|
83
|
+
now := func() time.Time { return x.wall }
|
|
84
|
+
f.c.now = now
|
|
85
|
+
f.s.authority.now = now
|
|
86
|
+
f.s.authority.native.now = now
|
|
87
|
+
x.offline = &offlineFake{proof: backgroundAppProof{Identity: f.native.account.Identity, AppID: "FixturePrivilege", Known: true, Allowed: true, OfflineEquivalent: true, CheckedAt: x.wall}}
|
|
88
|
+
observer := &backgroundObserver{accounts: f.native, groups: f.native, app: x.offline, appID: "FixturePrivilege", now: now}
|
|
89
|
+
x.journal2 = &sdkMemoryJournal{sdkJobTestJournal: sdkJobTestJournal{intents: map[string]sdkJobIntent{}, receipts: map[string]sdkJobReceipt{}}}
|
|
90
|
+
f.o.services.Journal = x.journal2
|
|
91
|
+
x.validator2 = &sdkBackgroundValidatorFake{root: f.validator.root, now: now}
|
|
92
|
+
var c Code
|
|
93
|
+
x.bg, c = newSDKBackgroundOwner(f.o, observer, x.validator2, x.journal2, func() (time.Time, time.Duration, bool) { return x.wall, x.mono, x.clockKnown })
|
|
94
|
+
if c != "" {
|
|
95
|
+
t.Fatal(c)
|
|
96
|
+
}
|
|
97
|
+
return x
|
|
98
|
+
}
|
|
99
|
+
func (f *sdkBackgroundFixture) prepare(t *testing.T, ttl time.Duration) Intent {
|
|
100
|
+
t.Helper()
|
|
101
|
+
i, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input, TTL: ttl})
|
|
102
|
+
if c != "" {
|
|
103
|
+
t.Fatal(c)
|
|
104
|
+
}
|
|
105
|
+
return i
|
|
106
|
+
}
|
|
107
|
+
func (f *sdkBackgroundFixture) confirm(t *testing.T, i Intent) jobcontract.BackgroundRecord {
|
|
108
|
+
t.Helper()
|
|
109
|
+
r, c := f.bg.confirm(context.Background(), f.carriers, i.ID, i.SummaryDigest, f.repo.store.Revision)
|
|
110
|
+
if c != "" {
|
|
111
|
+
t.Fatal(c)
|
|
112
|
+
}
|
|
113
|
+
return r
|
|
114
|
+
}
|
|
115
|
+
func (f *sdkBackgroundFixture) refresh() {
|
|
116
|
+
f.native.session.CheckedAt = f.wall
|
|
117
|
+
f.native.account.CheckedAt = f.wall
|
|
118
|
+
f.native.groups.CheckedAt = f.wall
|
|
119
|
+
f.native.app.CheckedAt = f.wall
|
|
120
|
+
f.offline.proof.CheckedAt = f.wall
|
|
121
|
+
f.c.gate.observe(f.c.gate.binding, 1, true, f.wall)
|
|
122
|
+
}
|
|
123
|
+
func TestSDKBackgroundConsentSingleUseAndNoSessionReuse(t *testing.T) {
|
|
124
|
+
f := newSDKBackgroundFixture(t)
|
|
125
|
+
i := f.prepare(t, 0)
|
|
126
|
+
r := f.confirm(t, i)
|
|
127
|
+
if r.ExpiresAt-r.CreatedAt != 24*60*60*1000 || r.Binding.SessionRef != "" || r.Issuer != r.Binding.Actor || len(f.repo.store.Background) != 1 || len(f.journal2.records) != 1 {
|
|
128
|
+
t.Fatal(r)
|
|
129
|
+
}
|
|
130
|
+
if _, c := f.bg.confirm(context.Background(), f.carriers, i.ID, i.SummaryDigest, f.repo.store.Revision); c != ErrReplay {
|
|
131
|
+
t.Fatal(c)
|
|
132
|
+
}
|
|
133
|
+
f.native.sessionCode = ErrDenied
|
|
134
|
+
res, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID)
|
|
135
|
+
if c != "" || res.Record.State != "consumed" || res.Record.ExecutionKey == "" || len(f.c.operations) != 1 {
|
|
136
|
+
t.Fatal(c, res)
|
|
137
|
+
}
|
|
138
|
+
if _, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID); c != ErrReplay {
|
|
139
|
+
t.Fatal("single use", c)
|
|
140
|
+
}
|
|
141
|
+
// S3 reservation is not registry->spawn. Neither process factory nor session
|
|
142
|
+
// refresh is invoked for background; S7 must implement offline child assembly.
|
|
143
|
+
if len(f.children) != 0 {
|
|
144
|
+
t.Fatal("production launch path added")
|
|
145
|
+
}
|
|
146
|
+
if c := f.c.launchReserved(res.operation); c != ErrUnavailable {
|
|
147
|
+
t.Fatal("background entered interactive launcher", c)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
func TestSDKBackgroundIntentLimitsExactInputAndExpiry(t *testing.T) {
|
|
151
|
+
f := newSDKBackgroundFixture(t)
|
|
152
|
+
for n := 0; n < MaxLiveIntents; n++ {
|
|
153
|
+
f.prepare(t, time.Hour)
|
|
154
|
+
}
|
|
155
|
+
if _, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input}); c != ErrBusy {
|
|
156
|
+
t.Fatal("intent cap", c)
|
|
157
|
+
}
|
|
158
|
+
f = newSDKBackgroundFixture(t)
|
|
159
|
+
i := f.prepare(t, time.Hour)
|
|
160
|
+
if _, c := f.bg.confirm(context.Background(), f.carriers, i.ID, grantRef('b'), f.repo.store.Revision); c != ErrDenied {
|
|
161
|
+
t.Fatal(c)
|
|
162
|
+
}
|
|
163
|
+
f.wall = f.wall.Add(IntentTTL)
|
|
164
|
+
f.mono += IntentTTL
|
|
165
|
+
f.refresh()
|
|
166
|
+
if _, c := f.bg.confirm(context.Background(), f.carriers, i.ID, i.SummaryDigest, f.repo.store.Revision); c != ErrExpired {
|
|
167
|
+
t.Fatal("exact expiry", c)
|
|
168
|
+
}
|
|
169
|
+
f = newSDKBackgroundFixture(t)
|
|
170
|
+
if _, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input, TTL: 8 * 24 * time.Hour}); c != ErrLimit {
|
|
171
|
+
t.Fatal(c)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
func TestSDKBackgroundClockAndMissingProofLatch(t *testing.T) {
|
|
175
|
+
for _, kind := range []string{"wall-expiry", "monotonic-expiry", "rollback", "clock-unknown", "offline-missing", "input-change"} {
|
|
176
|
+
t.Run(kind, func(t *testing.T) {
|
|
177
|
+
f := newSDKBackgroundFixture(t)
|
|
178
|
+
r := f.confirm(t, f.prepare(t, time.Minute))
|
|
179
|
+
id := r.Binding.Binding.Delegation.ID
|
|
180
|
+
switch kind {
|
|
181
|
+
case "wall-expiry":
|
|
182
|
+
f.wall = f.wall.Add(time.Minute)
|
|
183
|
+
case "monotonic-expiry":
|
|
184
|
+
f.mono += time.Minute
|
|
185
|
+
case "rollback":
|
|
186
|
+
f.wall = f.wall.Add(-time.Second)
|
|
187
|
+
case "clock-unknown":
|
|
188
|
+
f.clockKnown = false
|
|
189
|
+
case "offline-missing":
|
|
190
|
+
f.bg.observer.app = nil
|
|
191
|
+
case "input-change":
|
|
192
|
+
f.journal2.records[0].Intent.Request.Input.Steps[0].Segments[0] = "other"
|
|
193
|
+
}
|
|
194
|
+
f.refresh()
|
|
195
|
+
if _, c := f.bg.consume(context.Background(), id); c == "" {
|
|
196
|
+
t.Fatal("invalid lease")
|
|
197
|
+
}
|
|
198
|
+
if len(f.children) != 0 || len(f.c.operations) != 0 {
|
|
199
|
+
t.Fatal("spawn/reservation without proof")
|
|
200
|
+
}
|
|
201
|
+
f.wall = time.UnixMilli(int64(r.CreatedAt))
|
|
202
|
+
f.mono = 0
|
|
203
|
+
f.clockKnown = true
|
|
204
|
+
f.refresh()
|
|
205
|
+
f.bg.observer.app = f.offline
|
|
206
|
+
if _, c := f.bg.consume(context.Background(), id); c == "" {
|
|
207
|
+
t.Fatal("denial resurrected")
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
func TestSDKBackgroundParentRevokeDrainsEveryDerivedJob(t *testing.T) {
|
|
214
|
+
f := newSDKBackgroundFixture(t)
|
|
215
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
216
|
+
res, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID)
|
|
217
|
+
if c != "" {
|
|
218
|
+
t.Fatal(c)
|
|
219
|
+
}
|
|
220
|
+
child := &sdkJobTestProcess{operationFixture: operationFixture{childFixture: childFixture{exitOn: syscall.SIGTERM}}, ok: true}
|
|
221
|
+
res.operation.process = child
|
|
222
|
+
f.bg.job(r.Binding.Binding.Delegation.ID).process = child
|
|
223
|
+
f.c.started++
|
|
224
|
+
result, c := f.s.authority.Revoke(context.Background(), f.carriers, f.g.ID, f.g.Revision, f.repo.store.Revision)
|
|
225
|
+
if c != "" || !result.Revoked || !result.Drained {
|
|
226
|
+
t.Fatal(result, c)
|
|
227
|
+
}
|
|
228
|
+
if f.repo.store.Background[0].State != "revoked" || len(f.c.operations) != 0 || f.c.reaped != 1 {
|
|
229
|
+
t.Fatal("parent fanout missing", f.repo.store.Background, len(f.c.operations), f.c.reaped)
|
|
230
|
+
}
|
|
231
|
+
j := f.bg.job(r.Binding.Binding.Delegation.ID)
|
|
232
|
+
if j.failure == "" || !j.receipt.Job.Drained || !j.terminal {
|
|
233
|
+
t.Fatal("job revived or missing durable Q", j.receipt)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
func TestSDKBackgroundParentFailureDoesNotClaimRQ(t *testing.T) {
|
|
237
|
+
for _, kind := range []string{"R", "Q"} {
|
|
238
|
+
t.Run(kind, func(t *testing.T) {
|
|
239
|
+
f := newSDKBackgroundFixture(t)
|
|
240
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
241
|
+
if kind == "R" {
|
|
242
|
+
f.repo.fail = ErrCommitUncertain
|
|
243
|
+
} else {
|
|
244
|
+
f.repo.qFailure = ErrUnavailable
|
|
245
|
+
}
|
|
246
|
+
result, c := f.s.authority.Revoke(context.Background(), f.carriers, f.g.ID, f.g.Revision, f.repo.store.Revision)
|
|
247
|
+
if c == "" || result.Drained || (kind == "R" && result.Revoked) {
|
|
248
|
+
t.Fatal("invented R/Q", result, c)
|
|
249
|
+
}
|
|
250
|
+
if j := f.bg.job(r.Binding.Binding.Delegation.ID); j.failure == "" || j.receipt.Job.Drained {
|
|
251
|
+
t.Fatal("no sticky output denial", j.receipt)
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
func TestSDKBackgroundRestartSuspendsConsumedAndPending(t *testing.T) {
|
|
257
|
+
f := newSDKBackgroundFixture(t)
|
|
258
|
+
first := f.confirm(t, f.prepare(t, time.Hour))
|
|
259
|
+
f.confirm(t, f.prepare(t, time.Hour))
|
|
260
|
+
if _, c := f.bg.consume(context.Background(), first.Binding.Binding.Delegation.ID); c != "" {
|
|
261
|
+
t.Fatal(c)
|
|
262
|
+
}
|
|
263
|
+
if _, c := NewGrantAuthority(f.repo, nil, nil, nil); c != "" {
|
|
264
|
+
t.Fatal(c)
|
|
265
|
+
}
|
|
266
|
+
for _, r := range f.repo.store.Background {
|
|
267
|
+
if r.State != "suspended" {
|
|
268
|
+
t.Fatal("restart authority", r)
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if f.repo.store.Background[0].ExecutionKey == "" {
|
|
272
|
+
t.Fatal("lost burned key")
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
func TestSDKBackgroundIdentityMismatchRevokesAllDelegations(t *testing.T) {
|
|
277
|
+
f := newSDKBackgroundFixture(t)
|
|
278
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
279
|
+
f.confirm(t, f.prepare(t, time.Hour))
|
|
280
|
+
f.native.account.Identity.UID++
|
|
281
|
+
if _, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID); c == "" {
|
|
282
|
+
t.Fatal("identity mismatch admitted")
|
|
283
|
+
}
|
|
284
|
+
if f.repo.store.Grants[0].State != GrantRevoked {
|
|
285
|
+
t.Fatal("parent identity was not revoked")
|
|
286
|
+
}
|
|
287
|
+
for _, r := range f.repo.store.Background {
|
|
288
|
+
if r.State != "revoked" {
|
|
289
|
+
t.Fatal("partial invalidation", r.State)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
func TestSDKBackgroundSharedIssuerFanoutAndRetainedClosure(t *testing.T) {
|
|
294
|
+
f := newSDKBackgroundFixture(t)
|
|
295
|
+
f.repo.store.Grants[0].Scope.Kind = ScopeShared
|
|
296
|
+
f.g.Scope.Kind = ScopeShared
|
|
297
|
+
first := f.confirm(t, f.prepare(t, time.Hour))
|
|
298
|
+
one, c := f.bg.consume(context.Background(), first.Binding.Binding.Delegation.ID)
|
|
299
|
+
if c != "" {
|
|
300
|
+
t.Fatal(c)
|
|
301
|
+
}
|
|
302
|
+
old := f.native.account.Identity
|
|
303
|
+
f.rememberOfflineActor()
|
|
304
|
+
bob := RelaxedIdentity{UID: 2002, Username: "bob"}
|
|
305
|
+
setRelaxedIdentity(f.native, bob)
|
|
306
|
+
f.offline.proof.Identity = bob
|
|
307
|
+
second := f.confirm(t, f.prepare(t, time.Hour))
|
|
308
|
+
two, c := f.bg.consume(context.Background(), second.Binding.Binding.Delegation.ID)
|
|
309
|
+
if c != "" {
|
|
310
|
+
t.Fatal(c)
|
|
311
|
+
}
|
|
312
|
+
for _, res := range []sdkBackgroundReservation{one, two} {
|
|
313
|
+
p := &sdkJobTestProcess{operationFixture: operationFixture{childFixture: childFixture{exitOn: syscall.SIGTERM}}}
|
|
314
|
+
res.operation.process = p
|
|
315
|
+
f.bg.job(res.Record.Binding.Binding.Delegation.ID).process = p
|
|
316
|
+
f.c.started++
|
|
317
|
+
}
|
|
318
|
+
// The consenting shared issuer was alice; bob is only a beneficiary. An
|
|
319
|
+
// issuer mismatch must drain BOTH actors, not just jobs of the current caller.
|
|
320
|
+
if c := f.bg.invalidateIdentities(context.Background(), []RelaxedIdentity{old, {UID: old.UID, Username: "alice2"}}); c != "" {
|
|
321
|
+
t.Fatal(c)
|
|
322
|
+
}
|
|
323
|
+
if len(f.c.operations) != 0 || f.c.reaped != 2 {
|
|
324
|
+
t.Fatal("shared beneficiary survived", len(f.c.operations), f.c.reaped)
|
|
325
|
+
}
|
|
326
|
+
for _, r := range f.repo.store.Background {
|
|
327
|
+
if r.State != "revoked" {
|
|
328
|
+
t.Fatal("shared record survived")
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// A retained, interrupted intent still contributes old identities even when
|
|
332
|
+
// no current job owns it. Closure must be order-independent.
|
|
333
|
+
g := cloneAuthorityGrant(f.g)
|
|
334
|
+
g.ID = grantRef('7')
|
|
335
|
+
g.Owner.UID = 3003
|
|
336
|
+
g.Owner.Username = "alice3"
|
|
337
|
+
g.Issuer = g.Owner
|
|
338
|
+
g.State = GrantActive
|
|
339
|
+
f.repo.store.Grants = append(f.repo.store.Grants, g)
|
|
340
|
+
seed := f.journal2.records[0]
|
|
341
|
+
seed.State = "interrupted"
|
|
342
|
+
seed.Intent.Actor = jobcontract.Principal{IdentityBasis: "uid-username", UID: old.UID, Username: "alice3"}
|
|
343
|
+
seed.Intent.Request.Control.Binding.Job.ID = grantRef('8')
|
|
344
|
+
f.journal2.records = append(f.journal2.records, seed)
|
|
345
|
+
f.s.authority.mu.Lock()
|
|
346
|
+
ids, c := f.s.authority.sdkIdentityClosureLocked([]RelaxedIdentity{old})
|
|
347
|
+
f.s.authority.mu.Unlock()
|
|
348
|
+
if c != "" || !slices.Contains(ids, RelaxedIdentity{UID: 3003, Username: "alice3"}) {
|
|
349
|
+
t.Fatal("retained identity missing", ids, c)
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
func TestSDKBackgroundIncompleteIndexFences(t *testing.T) {
|
|
353
|
+
f := newSDKBackgroundFixture(t)
|
|
354
|
+
f.confirm(t, f.prepare(t, time.Hour))
|
|
355
|
+
f.journal2.recordsCode = ErrUnavailable
|
|
356
|
+
if c := f.bg.invalidateIdentities(context.Background(), []RelaxedIdentity{f.native.account.Identity}); c != ErrCleanupRequired || !f.s.authority.fenced {
|
|
357
|
+
t.Fatal(c, f.s.authority.fenced)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
func TestSDKBackgroundLeaseRechecksExpiryAndOriginalInput(t *testing.T) {
|
|
362
|
+
f := newSDKBackgroundFixture(t)
|
|
363
|
+
r := f.confirm(t, f.prepare(t, time.Minute))
|
|
364
|
+
id := r.Binding.Binding.Delegation.ID
|
|
365
|
+
if _, c := f.bg.consume(context.Background(), id); c != "" {
|
|
366
|
+
t.Fatal(c)
|
|
367
|
+
}
|
|
368
|
+
f.native.sessionCode = ErrDenied
|
|
369
|
+
admitted := 0
|
|
370
|
+
if c := f.bg.admit(context.Background(), id, 0, func() Code { admitted++; return "" }); c != "" || admitted != 1 {
|
|
371
|
+
t.Fatal("offline lease required session", c)
|
|
372
|
+
}
|
|
373
|
+
f.wall = f.wall.Add(time.Minute)
|
|
374
|
+
f.mono += time.Minute
|
|
375
|
+
f.refresh()
|
|
376
|
+
if c := f.bg.admit(context.Background(), id, 0, func() Code { admitted++; return "" }); c == "" || admitted != 1 {
|
|
377
|
+
t.Fatal("expired output admitted", c)
|
|
378
|
+
}
|
|
379
|
+
if f.repo.store.Background[0].State != "expired" {
|
|
380
|
+
t.Fatal("expiry not latched")
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
func TestSDKBackgroundQueueSlotsAndFullAuthority(t *testing.T) {
|
|
384
|
+
f := newSDKBackgroundFixture(t)
|
|
385
|
+
r1 := f.confirm(t, f.prepare(t, time.Hour))
|
|
386
|
+
r2 := f.confirm(t, f.prepare(t, time.Hour))
|
|
387
|
+
if _, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input}); c != ErrBusy {
|
|
388
|
+
t.Fatal("UID pending cap", c)
|
|
389
|
+
}
|
|
390
|
+
if _, c := f.bg.consume(context.Background(), r1.Binding.Binding.Delegation.ID); c != "" {
|
|
391
|
+
t.Fatal(c)
|
|
392
|
+
}
|
|
393
|
+
if _, c := f.bg.consume(context.Background(), r2.Binding.Binding.Delegation.ID); c != ErrBusy {
|
|
394
|
+
t.Fatal("background slot cap", c)
|
|
395
|
+
}
|
|
396
|
+
if f.repo.store.Background[1].State != "active" {
|
|
397
|
+
t.Fatal("busy consumed key")
|
|
398
|
+
}
|
|
399
|
+
f = newSDKBackgroundFixture(t)
|
|
400
|
+
for n := 1; n < MaxGrants; n++ {
|
|
401
|
+
g := cloneAuthorityGrant(f.g)
|
|
402
|
+
g.ID = fmt.Sprintf("%064x", n)
|
|
403
|
+
g.State = GrantRevoked
|
|
404
|
+
g.Reason = ErrRevoked
|
|
405
|
+
g.RevokedAt = g.CreatedAt
|
|
406
|
+
f.repo.store.Grants = append(f.repo.store.Grants, g)
|
|
407
|
+
}
|
|
408
|
+
if _, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input}); c != ErrLimit {
|
|
409
|
+
t.Fatal("tombstone cap", c)
|
|
410
|
+
}
|
|
411
|
+
if len(f.repo.store.Grants) != MaxGrants {
|
|
412
|
+
t.Fatal("evicted tombstones")
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
func TestSDKBackgroundIntentFsyncCannotRefreshProof(t *testing.T) {
|
|
416
|
+
f := newSDKBackgroundFixture(t)
|
|
417
|
+
i := f.prepare(t, time.Hour)
|
|
418
|
+
pending := f.s.authority.intents[i.ID]
|
|
419
|
+
pending.intent.ExpiresAt = f.wall.Add(time.Millisecond).UnixMilli()
|
|
420
|
+
f.s.authority.intents[i.ID] = pending
|
|
421
|
+
f.journal2.afterReserve = func() {
|
|
422
|
+
f.wall = f.wall.Add(10 * time.Millisecond)
|
|
423
|
+
f.mono += 10 * time.Millisecond
|
|
424
|
+
}
|
|
425
|
+
if _, c := f.bg.confirm(context.Background(), f.carriers, i.ID, i.SummaryDigest, f.repo.store.Revision); c != ErrExpired || !f.s.authority.fenced || len(f.repo.store.Background) != 0 {
|
|
426
|
+
t.Fatal(c, f.s.authority.fenced)
|
|
427
|
+
}
|
|
428
|
+
if len(f.journal2.records) != 1 {
|
|
429
|
+
t.Fatal("orphan execution key lost")
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
type sdkOfflineDirectory struct {
|
|
434
|
+
live *relaxedFake
|
|
435
|
+
liveApp *offlineFake
|
|
436
|
+
accounts map[string]RelaxedAccount
|
|
437
|
+
groups map[RelaxedIdentity]RelaxedGroups
|
|
438
|
+
apps map[RelaxedIdentity]backgroundAppProof
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
func (d *sdkOfflineDirectory) LookupRelaxedAccount(_ context.Context, name string) (RelaxedAccount, Code) {
|
|
442
|
+
if name == d.live.account.Identity.Username {
|
|
443
|
+
return d.live.account, d.live.accountCode
|
|
444
|
+
}
|
|
445
|
+
a, ok := d.accounts[name]
|
|
446
|
+
if !ok {
|
|
447
|
+
return RelaxedAccount{}, ErrDenied
|
|
448
|
+
}
|
|
449
|
+
return a, ""
|
|
450
|
+
}
|
|
451
|
+
func (d *sdkOfflineDirectory) LookupRelaxedGroups(_ context.Context, a RelaxedAccount) (RelaxedGroups, Code) {
|
|
452
|
+
if a.Identity == d.live.account.Identity {
|
|
453
|
+
return d.live.groups, d.live.groupCode
|
|
454
|
+
}
|
|
455
|
+
g, ok := d.groups[a.Identity]
|
|
456
|
+
if !ok {
|
|
457
|
+
return RelaxedGroups{}, ErrUnavailable
|
|
458
|
+
}
|
|
459
|
+
return g, ""
|
|
460
|
+
}
|
|
461
|
+
func (d *sdkOfflineDirectory) observeBackgroundApp(ctx context.Context, a RelaxedAccount, app string) (backgroundAppProof, Code) {
|
|
462
|
+
if a.Identity == d.live.account.Identity {
|
|
463
|
+
return d.liveApp.observeBackgroundApp(ctx, a, app)
|
|
464
|
+
}
|
|
465
|
+
p, ok := d.apps[a.Identity]
|
|
466
|
+
if !ok {
|
|
467
|
+
return backgroundAppProof{}, ErrUnavailable
|
|
468
|
+
}
|
|
469
|
+
return p, ""
|
|
470
|
+
}
|
|
471
|
+
func (f *sdkBackgroundFixture) rememberOfflineActor() *sdkOfflineDirectory {
|
|
472
|
+
d, ok := f.bg.observer.accounts.(*sdkOfflineDirectory)
|
|
473
|
+
if !ok {
|
|
474
|
+
d = &sdkOfflineDirectory{live: f.native, liveApp: f.offline, accounts: map[string]RelaxedAccount{}, groups: map[RelaxedIdentity]RelaxedGroups{}, apps: map[RelaxedIdentity]backgroundAppProof{}}
|
|
475
|
+
f.bg.observer.accounts = d
|
|
476
|
+
f.bg.observer.groups = d
|
|
477
|
+
f.bg.observer.app = d
|
|
478
|
+
}
|
|
479
|
+
d.accounts[f.native.account.Identity.Username] = f.native.account
|
|
480
|
+
d.groups[f.native.account.Identity] = f.native.groups
|
|
481
|
+
d.apps[f.native.account.Identity] = f.offline.proof
|
|
482
|
+
return d
|
|
483
|
+
}
|
|
484
|
+
func TestSDKBackgroundObservesSharedIssuerBeforeLease(t *testing.T) {
|
|
485
|
+
f := newSDKBackgroundFixture(t)
|
|
486
|
+
f.repo.store.Grants[0].Scope.Kind = ScopeShared
|
|
487
|
+
f.g.Scope.Kind = ScopeShared
|
|
488
|
+
d := f.rememberOfflineActor()
|
|
489
|
+
old := f.native.account.Identity
|
|
490
|
+
bob := RelaxedIdentity{UID: 2002, Username: "bob"}
|
|
491
|
+
setRelaxedIdentity(f.native, bob)
|
|
492
|
+
f.offline.proof.Identity = bob
|
|
493
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
494
|
+
issuer := d.accounts[old.Username]
|
|
495
|
+
issuer.Identity.UID++
|
|
496
|
+
d.accounts[old.Username] = issuer
|
|
497
|
+
if _, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID); c == "" {
|
|
498
|
+
t.Fatal("shared issuer was never observed")
|
|
499
|
+
}
|
|
500
|
+
if f.repo.store.Grants[0].State != GrantRevoked || f.repo.store.Background[0].State != "revoked" {
|
|
501
|
+
t.Fatal("shared issuer mismatch not durable")
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
func TestSDKBackgroundSharesOnlyOneOwnerAndJournal(t *testing.T) {
|
|
506
|
+
f := newSDKBackgroundFixture(t)
|
|
507
|
+
if _, c := newSDKJobOwner(f.s, f.registry, f.o.services); c != ErrBusy {
|
|
508
|
+
t.Fatal("second owner permitted", c)
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
func TestSDKBackgroundUnknownClockSuspends(t *testing.T) {
|
|
512
|
+
f := newSDKBackgroundFixture(t)
|
|
513
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
514
|
+
f.clockKnown = false
|
|
515
|
+
if _, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID); c == "" {
|
|
516
|
+
t.Fatal("unknown clock")
|
|
517
|
+
}
|
|
518
|
+
if f.repo.store.Background[0].State != "suspended" {
|
|
519
|
+
t.Fatal("unknown clock not suspended", f.repo.store.Background[0].State)
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
func TestSDKBackgroundBoundedQueueRotatesUIDs(t *testing.T) {
|
|
524
|
+
f := newSDKBackgroundFixture(t)
|
|
525
|
+
f.repo.store.Grants[0].Scope.Kind = ScopeShared
|
|
526
|
+
f.g.Scope.Kind = ScopeShared
|
|
527
|
+
for n := 0; n < 8; n++ {
|
|
528
|
+
f.rememberOfflineActor()
|
|
529
|
+
if n > 0 {
|
|
530
|
+
id := RelaxedIdentity{UID: uint32(1001 + n), Username: fmt.Sprintf("user-%d", n)}
|
|
531
|
+
setRelaxedIdentity(f.native, id)
|
|
532
|
+
f.offline.proof.Identity = id
|
|
533
|
+
}
|
|
534
|
+
f.confirm(t, f.prepare(t, time.Hour))
|
|
535
|
+
f.confirm(t, f.prepare(t, time.Hour))
|
|
536
|
+
}
|
|
537
|
+
ids, c := f.bg.ready(context.Background())
|
|
538
|
+
if c != "" || len(ids) != jobcontract.MaxPending {
|
|
539
|
+
t.Fatal(len(ids), c)
|
|
540
|
+
}
|
|
541
|
+
seen := map[uint32]bool{}
|
|
542
|
+
for _, id := range ids[:8] {
|
|
543
|
+
uid := f.bg.job(id).background.snapshot.identity.UID
|
|
544
|
+
if seen[uid] {
|
|
545
|
+
t.Fatal("UID starvation")
|
|
546
|
+
}
|
|
547
|
+
seen[uid] = true
|
|
548
|
+
}
|
|
549
|
+
again, c := f.bg.ready(context.Background())
|
|
550
|
+
if c != "" || f.bg.job(ids[0]).actor.UID() == f.bg.job(again[0]).actor.UID() {
|
|
551
|
+
t.Fatal("queue never rotates", c)
|
|
552
|
+
}
|
|
553
|
+
f.rememberOfflineActor()
|
|
554
|
+
id := RelaxedIdentity{UID: 3003, Username: "overflow"}
|
|
555
|
+
setRelaxedIdentity(f.native, id)
|
|
556
|
+
f.offline.proof.Identity = id
|
|
557
|
+
if _, c := f.bg.prepare(context.Background(), f.carriers, sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input}); c != ErrBusy {
|
|
558
|
+
t.Fatal("package pending cap", c)
|
|
559
|
+
}
|
|
560
|
+
if len(f.children) != 0 || len(f.c.operations) != 0 {
|
|
561
|
+
t.Fatal("queue itself dispatched")
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Keep signal events on the lifecycle owner's call stack so tests can control
|
|
566
|
+
// cancellation without racing fixture state or waiting for a wall-clock delay.
|
|
567
|
+
type sdkBackgroundRevokeProcess struct {
|
|
568
|
+
sdkJobTestProcess
|
|
569
|
+
afterSignal func(syscall.Signal)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
func (p *sdkBackgroundRevokeProcess) signal(s syscall.Signal) error {
|
|
573
|
+
if err := p.sdkJobTestProcess.signal(s); err != nil {
|
|
574
|
+
return err
|
|
575
|
+
}
|
|
576
|
+
if p.afterSignal != nil {
|
|
577
|
+
p.afterSignal(s)
|
|
578
|
+
}
|
|
579
|
+
return nil
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
func TestSDKBackgroundRevokePermissionAndFailedQ(t *testing.T) {
|
|
583
|
+
f := newSDKBackgroundFixture(t)
|
|
584
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
585
|
+
id := r.Binding.Binding.Delegation.ID
|
|
586
|
+
res, c := f.bg.consume(context.Background(), id)
|
|
587
|
+
if c != "" {
|
|
588
|
+
t.Fatal(c)
|
|
589
|
+
}
|
|
590
|
+
p := &sdkBackgroundRevokeProcess{} // never reaped, including after TERM/KILL
|
|
591
|
+
res.operation.process = p
|
|
592
|
+
f.bg.job(id).process = p
|
|
593
|
+
f.c.started++
|
|
594
|
+
bob := RelaxedIdentity{UID: 2002, Username: "bob"}
|
|
595
|
+
setRelaxedIdentity(f.native, bob)
|
|
596
|
+
f.native.groups.Admin = false
|
|
597
|
+
if result, c := f.bg.revoke(context.Background(), f.carriers, id, res.Record.Binding.Binding.Delegation.Revision, f.repo.store.Revision); c != ErrDenied || result.Revoked {
|
|
598
|
+
t.Fatal("foreign nonadmin revoked", result, c)
|
|
599
|
+
}
|
|
600
|
+
if f.repo.store.Background[0].State != "consumed" || res.operation.canceled || len(p.signals) != 0 || f.journal2.cancels != 0 || f.s.authority.fenced {
|
|
601
|
+
t.Fatal("foreign nonadmin changed revocation state")
|
|
602
|
+
}
|
|
603
|
+
f.native.groups.Admin = true
|
|
604
|
+
ctx, cancel := context.WithCancel(context.Background())
|
|
605
|
+
defer cancel()
|
|
606
|
+
p.afterSignal = func(s syscall.Signal) {
|
|
607
|
+
if s != syscall.SIGTERM {
|
|
608
|
+
t.Fatal("unexpected escalation before cancellation", s)
|
|
609
|
+
}
|
|
610
|
+
// Cancel only after R, denial and journal cancellation have completed
|
|
611
|
+
// and Q has started. Scheduling during authorization cannot consume
|
|
612
|
+
// the drain budget; the child still never supplies a reap proof.
|
|
613
|
+
if f.repo.inTransaction || f.repo.store.Background[0].State != "revoked" || !res.operation.canceled || f.journal2.cancels != 1 || !p.relayStopped() {
|
|
614
|
+
t.Fatal("Q signaled before durable R/denial")
|
|
615
|
+
}
|
|
616
|
+
cancel()
|
|
617
|
+
}
|
|
618
|
+
result, c := f.bg.revoke(ctx, f.carriers, id, res.Record.Binding.Binding.Delegation.Revision, f.repo.store.Revision)
|
|
619
|
+
if c != ErrCleanupRequired || !result.Revoked || result.Drained || len(f.c.operations) != 1 || !f.s.authority.fenced {
|
|
620
|
+
t.Fatal("fake Q", result, c)
|
|
621
|
+
}
|
|
622
|
+
if f.repo.store.Background[0].State != "revoked" || !res.operation.canceled || f.bg.job(id).receipt.Job.Drained {
|
|
623
|
+
t.Fatal("lost R/denial")
|
|
624
|
+
}
|
|
625
|
+
if !slices.Equal(p.signals, []syscall.Signal{syscall.SIGTERM}) || p.reaped || f.c.reaped != 0 || f.journal2.cancels != 1 {
|
|
626
|
+
t.Fatal("failed Q lacked the stop event or invented a reap proof", p.signals, p.reaped, f.c.reaped, f.journal2.cancels)
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
func TestSDKBackgroundDelayedJobDoesNotExtendExpiry(t *testing.T) {
|
|
630
|
+
f := newSDKBackgroundFixture(t)
|
|
631
|
+
req := sdkBackgroundPrepare{Worker: f.r.Control.Binding.Worker, Parent: f.r.Control.Binding.ParentGrant, Input: f.r.Input, TTL: time.Minute, NotBefore: f.wall.Add(30 * time.Second)}
|
|
632
|
+
i, c := f.bg.prepare(context.Background(), f.carriers, req)
|
|
633
|
+
if c != "" {
|
|
634
|
+
t.Fatal(c)
|
|
635
|
+
}
|
|
636
|
+
r := f.confirm(t, i)
|
|
637
|
+
if ids, c := f.bg.ready(context.Background()); c != "" || len(ids) != 0 {
|
|
638
|
+
t.Fatal(ids, c)
|
|
639
|
+
}
|
|
640
|
+
if _, c := f.bg.consume(context.Background(), r.Binding.Binding.Delegation.ID); c != ErrBusy {
|
|
641
|
+
t.Fatal(c)
|
|
642
|
+
}
|
|
643
|
+
f.wall = f.wall.Add(time.Minute)
|
|
644
|
+
f.mono += time.Minute
|
|
645
|
+
f.refresh()
|
|
646
|
+
if ids, c := f.bg.ready(context.Background()); c != "" || len(ids) != 0 {
|
|
647
|
+
t.Fatal("deadline extended", ids, c)
|
|
648
|
+
}
|
|
649
|
+
if f.repo.store.Background[0].State != "expired" {
|
|
650
|
+
t.Fatal("expired pending retained active")
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
func TestSDKBackgroundDisconnectDoesNotCancelConsent(t *testing.T) {
|
|
655
|
+
f := newSDKBackgroundFixture(t)
|
|
656
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
657
|
+
id := r.Binding.Binding.Delegation.ID
|
|
658
|
+
if _, c := f.bg.consume(context.Background(), id); c != "" {
|
|
659
|
+
t.Fatal(c)
|
|
660
|
+
}
|
|
661
|
+
j := f.bg.job(id)
|
|
662
|
+
if c := f.o.disconnect(context.Background(), j.request.Control.Binding); c != "" {
|
|
663
|
+
t.Fatal(c)
|
|
664
|
+
}
|
|
665
|
+
if j.failure != "" || j.terminal || f.journal2.cancels != 0 || len(f.c.operations) != 1 {
|
|
666
|
+
t.Fatal("closing browser canceled offline delegation")
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
func TestSDKBackgroundSuspendedParentPollCompletesQ(t *testing.T) {
|
|
670
|
+
f := newSDKBackgroundFixture(t)
|
|
671
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
672
|
+
id := r.Binding.Binding.Delegation.ID
|
|
673
|
+
res, c := f.bg.consume(context.Background(), id)
|
|
674
|
+
if c != "" {
|
|
675
|
+
t.Fatal(c)
|
|
676
|
+
}
|
|
677
|
+
child := &sdkJobTestProcess{operationFixture: operationFixture{childFixture: childFixture{exitOn: syscall.SIGTERM}}}
|
|
678
|
+
res.operation.process = child
|
|
679
|
+
f.bg.job(id).process = child
|
|
680
|
+
f.c.started++
|
|
681
|
+
proof := admissionFor(t, f.s.authority.native, f.carriers, f.g)
|
|
682
|
+
proof.Continuous = false
|
|
683
|
+
if c := f.s.authority.WithGrantAdmission(proof, func(Grant, NativeActor) Code { return "" }); c != ErrSuspended {
|
|
684
|
+
t.Fatal(c)
|
|
685
|
+
}
|
|
686
|
+
if c := f.o.poll(context.Background()); c != "" {
|
|
687
|
+
t.Fatal(c)
|
|
688
|
+
}
|
|
689
|
+
j := f.bg.job(id)
|
|
690
|
+
if !j.terminal || !j.receipt.Job.Drained || len(f.c.operations) != 0 {
|
|
691
|
+
t.Fatal("suspension never completed Q", j.receipt)
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
func TestSDKBackgroundObserverFenceDefersSignalsToLifecycleOwner(t *testing.T) {
|
|
696
|
+
f := newSDKBackgroundFixture(t)
|
|
697
|
+
r := f.confirm(t, f.prepare(t, time.Hour))
|
|
698
|
+
id := r.Binding.Binding.Delegation.ID
|
|
699
|
+
res, c := f.bg.consume(context.Background(), id)
|
|
700
|
+
if c != "" {
|
|
701
|
+
t.Fatal(c)
|
|
702
|
+
}
|
|
703
|
+
child := &sdkJobTestProcess{operationFixture: operationFixture{childFixture: childFixture{exitOn: syscall.SIGTERM}}}
|
|
704
|
+
res.operation.process = child
|
|
705
|
+
f.bg.job(id).process = child
|
|
706
|
+
f.c.started++
|
|
707
|
+
f.c.gate.fence("fixture")
|
|
708
|
+
if c := f.o.poll(context.Background()); c != ErrFenced {
|
|
709
|
+
t.Fatal(c)
|
|
710
|
+
}
|
|
711
|
+
if len(child.signals) != 0 {
|
|
712
|
+
t.Fatal("signaled before durable lifecycle fence", child.signals)
|
|
713
|
+
}
|
|
714
|
+
}
|