@bevel-software/platform-core-backend 0.20.0 → 0.21.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/dist/core/catalog-cache-invalidation.d.ts +7 -2
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -1
- package/dist/core/catalog-cache-invalidation.js +8 -9
- package/dist/core/catalog-cache-invalidation.js.map +1 -1
- package/dist/core/core-ports.d.ts +19 -0
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts +2 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +23 -105
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +30 -5
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +136 -81
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +74 -28
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +157 -20
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/public-config.d.ts +5 -1
- package/dist/core/public-config.d.ts.map +1 -1
- package/dist/core/public-config.js +7 -5
- package/dist/core/public-config.js.map +1 -1
- package/dist/core-config.d.ts +95 -1
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +24 -8
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +18 -1
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +19 -8
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts +2 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +10 -10
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/change-read-gate.d.ts +6 -3
- package/dist/modules/access/change-read-gate.d.ts.map +1 -1
- package/dist/modules/access/change-read-gate.js +9 -6
- package/dist/modules/access/change-read-gate.js.map +1 -1
- package/dist/modules/access/creator-access.d.ts +4 -2
- package/dist/modules/access/creator-access.d.ts.map +1 -1
- package/dist/modules/access/creator-access.js +7 -4
- package/dist/modules/access/creator-access.js.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts +2 -1
- package/dist/modules/agent-instructions/read-preamble.d.ts.map +1 -1
- package/dist/modules/agent-instructions/read-preamble.js +6 -9
- package/dist/modules/agent-instructions/read-preamble.js.map +1 -1
- package/dist/modules/auth/account-admission.d.ts +40 -0
- package/dist/modules/auth/account-admission.d.ts.map +1 -0
- package/dist/modules/auth/account-admission.js +17 -0
- package/dist/modules/auth/account-admission.js.map +1 -0
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +4 -1
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +19 -1
- package/dist/modules/auth/auth.service.d.ts.map +1 -1
- package/dist/modules/auth/auth.service.js +33 -1
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.d.ts.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.js +9 -0
- package/dist/modules/auth/oidc-auth-provider.js.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts +13 -1
- package/dist/modules/connection-probe/connection-probe.service.d.ts.map +1 -1
- package/dist/modules/connection-probe/connection-probe.service.js +10 -2
- package/dist/modules/connection-probe/connection-probe.service.js.map +1 -1
- package/dist/modules/database/advisory-lock.d.ts +17 -0
- package/dist/modules/database/advisory-lock.d.ts.map +1 -1
- package/dist/modules/database/advisory-lock.js +24 -3
- package/dist/modules/database/advisory-lock.js.map +1 -1
- package/dist/modules/database/connection.d.ts +67 -2
- package/dist/modules/database/connection.d.ts.map +1 -1
- package/dist/modules/database/connection.js +118 -12
- package/dist/modules/database/connection.js.map +1 -1
- package/dist/modules/database/migrate.d.ts +1 -1
- package/dist/modules/database/migrate.d.ts.map +1 -1
- package/dist/modules/database/migrate.js +27 -3
- package/dist/modules/database/migrate.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.d.ts +0 -1
- package/dist/modules/kb-fs/branch-name.d.ts.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +3 -3
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/clone-config.d.ts +9 -8
- package/dist/modules/kb-fs/clone-config.d.ts.map +1 -1
- package/dist/modules/kb-fs/clone-config.js +14 -12
- package/dist/modules/kb-fs/clone-config.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +7 -0
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +4 -4
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts +4 -4
- package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts.map +1 -1
- package/dist/modules/plugins/compile/marketplace-compiler.service.js +7 -10
- package/dist/modules/plugins/compile/marketplace-compiler.service.js.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js +5 -3
- package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts +6 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/kb-plugin-source.js +14 -9
- package/dist/modules/plugins/discovery/kb-plugin-source.js.map +1 -1
- package/dist/modules/plugins/discovery/native.source.d.ts +4 -1
- package/dist/modules/plugins/discovery/native.source.d.ts.map +1 -1
- package/dist/modules/plugins/discovery/native.source.js +4 -2
- package/dist/modules/plugins/discovery/native.source.js.map +1 -1
- package/dist/modules/plugins/index.d.ts +1 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +1 -1
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts +3 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.js +6 -6
- package/dist/modules/plugins/join-request-jobs.service.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +3 -1
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +9 -8
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugin-links.d.ts +65 -10
- package/dist/modules/plugins/plugin-links.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.js +136 -31
- package/dist/modules/plugins/plugin-links.js.map +1 -1
- package/dist/modules/plugins/plugin-links.service.d.ts +107 -5
- package/dist/modules/plugins/plugin-links.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-links.service.js +151 -21
- package/dist/modules/plugins/plugin-links.service.js.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.d.ts +10 -3
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +33 -26
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.d.ts +4 -2
- package/dist/modules/plugins/plugin-rename.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.js +10 -12
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +3 -0
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +45 -15
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +4 -4
- package/dist/modules/plugins/plugins.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.service.js +7 -10
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/plugins/teams.routes.d.ts +4 -1
- package/dist/modules/plugins/teams.routes.d.ts.map +1 -1
- package/dist/modules/plugins/teams.routes.js +11 -9
- package/dist/modules/plugins/teams.routes.js.map +1 -1
- package/dist/modules/secrets-vault/index.d.ts +1 -1
- package/dist/modules/secrets-vault/index.d.ts.map +1 -1
- package/dist/modules/secrets-vault/index.js +1 -1
- package/dist/modules/secrets-vault/index.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts +29 -11
- package/dist/modules/secrets-vault/secrets-variable-loader.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-variable-loader.js +46 -21
- package/dist/modules/secrets-vault/secrets-variable-loader.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +3 -0
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.js +4 -6
- package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +12 -8
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +20 -22
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +9 -2
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +20 -14
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/allowed-tools-check.d.ts +4 -3
- package/dist/modules/skills/allowed-tools-check.d.ts.map +1 -1
- package/dist/modules/skills/allowed-tools-check.js +8 -8
- package/dist/modules/skills/allowed-tools-check.js.map +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts +3 -1
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +9 -6
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +2 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +6 -6
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/skills/skills.routes.d.ts +4 -1
- package/dist/modules/skills/skills.routes.d.ts.map +1 -1
- package/dist/modules/skills/skills.routes.js +4 -4
- package/dist/modules/skills/skills.routes.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +4 -2
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +13 -11
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts +2 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-json-discovery.js +6 -5
- package/dist/modules/tool-manuals/mcp-json-discovery.js.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts +4 -2
- package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js +12 -10
- package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts +3 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.js +19 -16
- package/dist/modules/tool-manuals/pending-tools.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-delete.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js +14 -12
- package/dist/modules/tool-manuals/tool-delete.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts +3 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.routes.js +7 -7
- package/dist/modules/tool-manuals/tool-manuals.routes.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -2
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +15 -12
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +3 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +4 -6
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +3 -2
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +9 -9
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +11 -5
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +23 -14
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts +26 -2
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +35 -5
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js +9 -4
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
- package/dist/modules/workflow/session-ontology.service.d.ts +6 -1
- package/dist/modules/workflow/session-ontology.service.d.ts.map +1 -1
- package/dist/modules/workflow/session-ontology.service.js +6 -2
- package/dist/modules/workflow/session-ontology.service.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +8 -3
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +33 -23
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts +3 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts.map +1 -1
- package/dist/modules/workspace/session-ontology.gate.js +3 -3
- package/dist/modules/workspace/session-ontology.gate.js.map +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts +4 -3
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +15 -13
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts +5 -8
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js +35 -38
- package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js +23 -16
- package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js +12 -5
- package/dist/modules/workspace/startup/steps/personal-spaces.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-display-names.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts +7 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js +12 -5
- package/dist/modules/workspace/startup/steps/plugin-manifests.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts +4 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +14 -11
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +17 -3
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +36 -30
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +6 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +10 -6
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts +2 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +8 -7
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +18 -12
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +32 -28
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +20 -18
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/workspace/write-denial.d.ts +3 -2
- package/dist/modules/workspace/write-denial.d.ts.map +1 -1
- package/dist/modules/workspace/write-denial.js +6 -5
- package/dist/modules/workspace/write-denial.js.map +1 -1
- package/dist/shared/git.contract.d.ts +52 -7
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js +30 -8
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/shared/kb-context.d.ts +76 -0
- package/dist/shared/kb-context.d.ts.map +1 -0
- package/dist/shared/kb-context.js +108 -0
- package/dist/shared/kb-context.js.map +1 -0
- package/dist/shared/kb-layout.d.ts +3 -2
- package/dist/shared/kb-layout.d.ts.map +1 -1
- package/dist/shared/kb-layout.js +4 -3
- package/dist/shared/kb-layout.js.map +1 -1
- package/dist/shared/kb-layout.test.js +35 -27
- package/dist/shared/kb-layout.test.js.map +1 -1
- package/dist/shared/pending-proposals.d.ts +4 -1
- package/dist/shared/pending-proposals.d.ts.map +1 -1
- package/dist/shared/pending-proposals.js +3 -4
- package/dist/shared/pending-proposals.js.map +1 -1
- package/dist/shared/redact-secret.d.ts +5 -5
- package/dist/shared/redact-secret.js +5 -5
- package/dist/tenancy/index.d.ts +13 -0
- package/dist/tenancy/index.d.ts.map +1 -0
- package/dist/tenancy/index.js +13 -0
- package/dist/tenancy/index.js.map +1 -0
- package/dist/tenancy/static-tenant-source.d.ts +98 -0
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -0
- package/dist/tenancy/static-tenant-source.js +220 -0
- package/dist/tenancy/static-tenant-source.js.map +1 -0
- package/dist/tenancy/tenant-host.d.ts +80 -0
- package/dist/tenancy/tenant-host.d.ts.map +1 -0
- package/dist/tenancy/tenant-host.js +217 -0
- package/dist/tenancy/tenant-host.js.map +1 -0
- package/dist/tenancy/tenant-runtime.d.ts +91 -0
- package/dist/tenancy/tenant-runtime.d.ts.map +1 -0
- package/dist/tenancy/tenant-runtime.js +174 -0
- package/dist/tenancy/tenant-runtime.js.map +1 -0
- package/dist/tenancy/tenant-secrets.d.ts +24 -0
- package/dist/tenancy/tenant-secrets.d.ts.map +1 -0
- package/dist/tenancy/tenant-secrets.js +30 -0
- package/dist/tenancy/tenant-secrets.js.map +1 -0
- package/dist/tenancy/tenant-source.contract.d.ts +45 -0
- package/dist/tenancy/tenant-source.contract.d.ts.map +1 -0
- package/dist/tenancy/tenant-source.contract.js +21 -0
- package/dist/tenancy/tenant-source.contract.js.map +1 -0
- package/migrations/0000_core_init.sql +14 -14
- package/migrations/0003_deployment_settings.sql +1 -1
- package/migrations/0005_github_facade.sql +1 -1
- package/migrations/0012_agent_audit.sql +6 -6
- package/package.json +3 -3
- package/src/__tests__/branch-model.test.ts +7 -6
- package/src/__tests__/kb-context.ts +30 -0
- package/src/__tests__/kb-layout-config.test.ts +35 -30
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +2 -1
- package/src/core/__tests__/lifecycle.test.ts +78 -1
- package/src/core/__tests__/public-config.test.ts +5 -1
- package/src/core/catalog-cache-invalidation.ts +16 -11
- package/src/core/core-ports.ts +19 -0
- package/src/core/create-core-server.ts +27 -106
- package/src/core/create-core-services.ts +180 -95
- package/src/core/lifecycle.ts +214 -29
- package/src/core/public-config.ts +8 -5
- package/src/core-config.ts +107 -8
- package/src/index.ts +25 -2
- package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.batch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.overrides.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +2 -1
- package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +2 -1
- package/src/modules/access/__tests__/change-read-gate.test.ts +13 -11
- package/src/modules/access/__tests__/creator-access.test.ts +3 -2
- package/src/modules/access/__tests__/roles.routes.test.ts +2 -1
- package/src/modules/access/access-control.service.ts +20 -6
- package/src/modules/access/access.routes.ts +10 -13
- package/src/modules/access/change-read-gate.ts +10 -4
- package/src/modules/access/creator-access.ts +7 -2
- package/src/modules/agent-instructions/__tests__/read-preamble.test.ts +13 -12
- package/src/modules/agent-instructions/read-preamble.ts +10 -12
- package/src/modules/auth/__tests__/account.routes.test.ts +15 -0
- package/src/modules/auth/__tests__/auth.service.test.ts +60 -0
- package/src/modules/auth/account-admission.ts +44 -0
- package/src/modules/auth/account.routes.ts +4 -1
- package/src/modules/auth/auth.service.ts +33 -1
- package/src/modules/auth/oidc-auth-provider.ts +9 -0
- package/src/modules/connection-probe/connection-probe.service.ts +7 -1
- package/src/modules/database/__tests__/advisory-lock.test.ts +23 -1
- package/src/modules/database/__tests__/connection.test.ts +98 -0
- package/src/modules/database/__tests__/migrations-unqualified.test.ts +32 -0
- package/src/modules/database/advisory-lock.ts +28 -4
- package/src/modules/database/connection.ts +143 -13
- package/src/modules/database/migrate.ts +48 -14
- package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +2 -1
- package/src/modules/diff/__tests__/diff.service.test.ts +2 -1
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +6 -6
- package/src/modules/kb-fs/__tests__/clone-config.test.ts +24 -20
- package/src/modules/kb-fs/branch-name.ts +3 -3
- package/src/modules/kb-fs/clone-config.ts +15 -12
- package/src/modules/marketplace/__tests__/marketplace-repo.head.test.ts +2 -1
- package/src/modules/mcp/mcp.service.ts +11 -4
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +12 -11
- package/src/modules/plugins/__tests__/bundle-dialect.test.ts +2 -1
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +6 -4
- package/src/modules/plugins/__tests__/join-request-jobs.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +2 -1
- package/src/modules/plugins/__tests__/plugin-creation-display-name.test.ts +4 -3
- package/src/modules/plugins/__tests__/plugin-index.service.test.ts +6 -4
- package/src/modules/plugins/__tests__/plugin-links.service.test.ts +220 -5
- package/src/modules/plugins/__tests__/plugin-provision.service.test.ts +3 -1
- package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +7 -6
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +11 -2
- package/src/modules/plugins/__tests__/teams.routes.test.ts +2 -1
- package/src/modules/plugins/compile/marketplace-compiler.service.ts +7 -9
- package/src/modules/plugins/discovery/__tests__/kb-plugin-source.test.ts +20 -16
- package/src/modules/plugins/discovery/bundle-dialect/bundle.source.ts +9 -2
- package/src/modules/plugins/discovery/kb-plugin-source.ts +15 -8
- package/src/modules/plugins/discovery/native.source.ts +4 -1
- package/src/modules/plugins/index.ts +1 -1
- package/src/modules/plugins/join-request-jobs.service.ts +8 -7
- package/src/modules/plugins/join-requests.service.ts +7 -7
- package/src/modules/plugins/plugin-links.service.ts +192 -19
- package/src/modules/plugins/plugin-links.ts +147 -27
- package/src/modules/plugins/plugin-provision.service.ts +54 -27
- package/src/modules/plugins/plugin-rename.service.ts +10 -10
- package/src/modules/plugins/plugins.routes.ts +45 -15
- package/src/modules/plugins/plugins.service.ts +7 -11
- package/src/modules/plugins/teams.routes.ts +16 -8
- package/src/modules/secrets-vault/__tests__/connect-pending.route.test.ts +7 -0
- package/src/modules/secrets-vault/__tests__/secrets-variable-loader.test.ts +40 -0
- package/src/modules/secrets-vault/__tests__/tool-owner-gate.route.test.ts +2 -0
- package/src/modules/secrets-vault/index.ts +2 -0
- package/src/modules/secrets-vault/secrets-variable-loader.ts +51 -21
- package/src/modules/secrets-vault/secrets-vault.routes.ts +7 -6
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +24 -11
- package/src/modules/settings/__tests__/git-root-folders.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.boot-failure.test.ts +2 -1
- package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +7 -4
- package/src/modules/settings/__tests__/setup.routes.oidc.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.sync-status.test.ts +2 -0
- package/src/modules/settings/__tests__/setup.routes.test.ts +33 -52
- package/src/modules/settings/deployment-settings.service.ts +21 -20
- package/src/modules/settings/setup.routes.ts +26 -16
- package/src/modules/skills/__tests__/allowed-tools-check.test.ts +11 -10
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +4 -3
- package/src/modules/skills/__tests__/pending-skills.service.test.ts +3 -1
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.routes.warnings.test.ts +2 -1
- package/src/modules/skills/__tests__/skills.service.test.ts +3 -2
- package/src/modules/skills/allowed-tools-check.ts +7 -6
- package/src/modules/skills/pending-skills.service.ts +9 -8
- package/src/modules/skills/skill-access-requests.routes.ts +7 -7
- package/src/modules/skills/skills.routes.ts +4 -3
- package/src/modules/skills/skills.service.ts +13 -9
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +3 -2
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/mcp-json-discovery.test.ts +17 -12
- package/src/modules/tool-manuals/__tests__/mcp-server-edit.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/pending-tools.service.test.ts +4 -1
- package/src/modules/tool-manuals/__tests__/tool-delete.service.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.archive.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.cli.test.ts +5 -4
- package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.routes.test.ts +4 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.invalid.test.ts +13 -5
- package/src/modules/tool-manuals/__tests__/tool-manuals.mcp-oauth.test.ts +2 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.restart.test.ts +9 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.service.test.ts +3 -2
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +2 -0
- package/src/modules/tool-manuals/mcp-json-discovery.ts +6 -4
- package/src/modules/tool-manuals/mcp-server-edit.service.ts +13 -11
- package/src/modules/tool-manuals/pending-tools.service.ts +19 -16
- package/src/modules/tool-manuals/tool-delete.service.ts +13 -10
- package/src/modules/tool-manuals/tool-manuals.routes.ts +10 -8
- package/src/modules/tool-manuals/tool-manuals.service.ts +15 -13
- package/src/modules/tool-manuals/tool-manuals.tools.ts +7 -6
- package/src/modules/workflow/__tests__/apply-failure.test.ts +2 -1
- package/src/modules/workflow/__tests__/merge-announces-tree.test.ts +14 -26
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +2 -1
- package/src/modules/workflow/__tests__/session-ontology.service.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.routes.lock-path.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.deleted-branch-sweep.test.ts +3 -10
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +28 -27
- package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.platform-restore.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.read-gate.test.ts +3 -2
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +2 -1
- package/src/modules/workflow/__tests__/workflow.service.sync.test.ts +5 -4
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +2 -1
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +2 -1
- package/src/modules/workflow/agent-tools/workflow.tools.ts +11 -9
- package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +5 -4
- package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +12 -11
- package/src/modules/workflow/git/__tests__/git.service.commitChanges.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.commitFile.strayPath.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/git.service.commitFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.createBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.diffFileAtCommit.test.ts +7 -6
- package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +16 -15
- package/src/modules/workflow/git/__tests__/git.service.fileContentsAtCommit.test.ts +3 -2
- package/src/modules/workflow/git/__tests__/git.service.forkPoint.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.history-guards.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.list-branches.test.ts +10 -9
- package/src/modules/workflow/git/__tests__/git.service.listTrackedFiles.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.logForFile.test.ts +6 -5
- package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.pendingChanges.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +9 -8
- package/src/modules/workflow/git/__tests__/git.service.readFileAtRef.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.revertPathsAndPush.test.ts +2 -1
- package/src/modules/workflow/git/__tests__/git.service.status.test.ts +4 -3
- package/src/modules/workflow/git/__tests__/git.service.syncFromRemote.test.ts +8 -7
- package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +41 -3
- package/src/modules/workflow/git/git.service.ts +24 -13
- package/src/modules/workflow/git/node-git-runner.ts +37 -4
- package/src/modules/workflow/review-workflow/review-workflow.service.ts +9 -6
- package/src/modules/workflow/session-ontology.service.ts +7 -2
- package/src/modules/workflow/workflow.service.ts +31 -24
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +3 -2
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +10 -9
- package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +4 -2
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -2
- package/src/modules/workspace/__tests__/workspace.routes.branch-errors.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download-implies-read.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.file-writes.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +5 -4
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.ensure-remotes-fetched.test.ts +2 -2
- package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +6 -5
- package/src/modules/workspace/__tests__/workspace.service.move-never-overwrites.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.service.test.ts +84 -50
- package/src/modules/workspace/__tests__/workspace.service.unknown-branch.test.ts +2 -1
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +10 -7
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +4 -3
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +9 -8
- package/src/modules/workspace/__tests__/write-denial.test.ts +5 -4
- package/src/modules/workspace/session-ontology.gate.ts +6 -4
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +6 -2
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +29 -21
- package/src/modules/workspace/startup/kb-git.ts +15 -22
- package/src/modules/workspace/startup/kb-startup-runner.ts +40 -46
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +104 -98
- package/src/modules/workspace/startup/steps/groups-to-plugins.step.ts +24 -16
- package/src/modules/workspace/startup/steps/personal-spaces.step.ts +14 -5
- package/src/modules/workspace/startup/steps/plugin-display-names.step.ts +13 -5
- package/src/modules/workspace/startup/steps/plugin-manifests.step.ts +14 -5
- package/src/modules/workspace/startup/steps/seed-tree.ts +11 -9
- package/src/modules/workspace/startup/steps/template-files.step.ts +43 -34
- package/src/modules/workspace/startup/steps/template-source.ts +8 -5
- package/src/modules/workspace/workspace.routes.ts +8 -7
- package/src/modules/workspace/workspace.service.ts +30 -27
- package/src/modules/workspace/workspace.tools.ts +21 -20
- package/src/modules/workspace/write-denial.ts +7 -5
- package/src/shared/__tests__/kb-layout.plugin.test.ts +19 -16
- package/src/shared/git.contract.ts +70 -8
- package/src/shared/kb-context.ts +130 -0
- package/src/shared/kb-layout.test.ts +37 -27
- package/src/shared/kb-layout.ts +4 -3
- package/src/shared/pending-proposals.ts +7 -4
- package/src/shared/redact-secret.ts +5 -5
- package/src/tenancy/__tests__/static-tenant-source.test.ts +177 -0
- package/src/tenancy/__tests__/tenant-host.test.ts +372 -0
- package/src/tenancy/__tests__/tenant-runtime.test.ts +221 -0
- package/src/tenancy/__tests__/tenant-secrets.test.ts +35 -0
- package/src/tenancy/index.ts +35 -0
- package/src/tenancy/static-tenant-source.ts +296 -0
- package/src/tenancy/tenant-host.ts +261 -0
- package/src/tenancy/tenant-runtime.ts +208 -0
- package/src/tenancy/tenant-secrets.ts +41 -0
- package/src/tenancy/tenant-source.contract.ts +59 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
branchModelFromEnv,
|
|
5
|
-
configureBranchModel,
|
|
6
|
-
type WorkflowEvent,
|
|
7
|
-
} from '@bevel-software/platform-shared';
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
3
|
+
import type { WorkflowEvent } from '@bevel-software/platform-shared';
|
|
8
4
|
|
|
9
5
|
import type { GitService } from '../git/git.service.js';
|
|
10
6
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -47,24 +43,16 @@ const USER = { id: 'u1', email: 'someone@x.com', name: 'Someone' };
|
|
|
47
43
|
/**
|
|
48
44
|
* A default branch this deployment chose, pinned for the whole file.
|
|
49
45
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* these assertions agree with whatever
|
|
46
|
+
* The environment's pair (which `test-setup.ts` mirrors onto the shared
|
|
47
|
+
* bindings) is what most fixtures run under, so a service that read THAT
|
|
48
|
+
* would make these assertions agree with whatever it happens to say — and a
|
|
53
49
|
* regression that hardcoded a branch name would still pass wherever the two
|
|
54
50
|
* coincided. Deliberately NOT `main`, so `main` written into the emit would
|
|
55
|
-
* fail here rather than slip through.
|
|
51
|
+
* fail here rather than slip through. The service is handed this model by
|
|
52
|
+
* constructor, so nothing process-wide changes for the files after this one.
|
|
56
53
|
*/
|
|
57
54
|
const TRUNK = 'trunk';
|
|
58
|
-
|
|
59
|
-
beforeAll(() => {
|
|
60
|
-
configureBranchModel({ defaultBranch: TRUNK, protectedBranches: [TRUNK] });
|
|
61
|
-
});
|
|
62
|
-
afterAll(() => {
|
|
63
|
-
// Back to what the suite booted with: the binding is process-wide, and a
|
|
64
|
-
// file that leaves its own branch model behind changes the meaning of
|
|
65
|
-
// anything that runs after it in the same worker.
|
|
66
|
-
configureBranchModel(branchModelFromEnv());
|
|
67
|
-
});
|
|
55
|
+
const kb = testKbContext({ kbDirName: KB_DIR, branchModel: { defaultBranch: TRUNK, protectedBranches: [TRUNK] } });
|
|
68
56
|
|
|
69
57
|
function noopAccessControl(): IAccessControl {
|
|
70
58
|
return { invalidate: vi.fn() } as unknown as IAccessControl;
|
|
@@ -120,7 +108,7 @@ function makeSvc(
|
|
|
120
108
|
noopAccessControl(),
|
|
121
109
|
{ acquire: vi.fn(), release: vi.fn() } as unknown as FileLockService,
|
|
122
110
|
{} as unknown as PendingCommitsService,
|
|
123
|
-
|
|
111
|
+
kb,
|
|
124
112
|
openChangeGate(),
|
|
125
113
|
bus,
|
|
126
114
|
);
|
|
@@ -145,10 +133,10 @@ describe('applying a change request announces the tree it rewrote', () => {
|
|
|
145
133
|
expect(treeEvents()).toEqual([
|
|
146
134
|
{ kind: 'fs-tree-changed', workspaceId: encodeURIComponent(TRUNK), branch: TRUNK },
|
|
147
135
|
]);
|
|
148
|
-
// The deployment's own default branch, read from the
|
|
149
|
-
// written into the emit: these two are the same
|
|
150
|
-
// branch name would make them differ.
|
|
151
|
-
expect(
|
|
136
|
+
// The deployment's own default branch, read from the context the service
|
|
137
|
+
// was handed rather than written into the emit: these two are the same
|
|
138
|
+
// thing, and a hardcoded branch name would make them differ.
|
|
139
|
+
expect(kb.defaultBranch).toBe(TRUNK);
|
|
152
140
|
});
|
|
153
141
|
|
|
154
142
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { promises as fs } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import os from 'node:os';
|
|
@@ -120,7 +121,7 @@ describe('mergeChangeRequest — roles.yaml preservation guard', () => {
|
|
|
120
121
|
{} as unknown as Database,
|
|
121
122
|
git, prs, reviewWorkflow, workspaceService, ac,
|
|
122
123
|
fileLocks, {} as unknown as PendingCommitsService,
|
|
123
|
-
KB_DIR,
|
|
124
|
+
testKbContext({ kbDirName: KB_DIR }),
|
|
124
125
|
openChangeGate(),
|
|
125
126
|
);
|
|
126
127
|
// Conflicts are now surfaced by the local merge inside `reviewWorkflow.mergePr`
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
|
|
3
4
|
import { SessionOntologyService } from '../session-ontology.service.js';
|
|
4
5
|
import type { Database } from '../../database/connection.js';
|
|
@@ -90,7 +91,7 @@ vi.mock('drizzle-orm', async (importOriginal) => {
|
|
|
90
91
|
|
|
91
92
|
function makeService() {
|
|
92
93
|
const db = makeFakeDb();
|
|
93
|
-
return { svc: new SessionOntologyService(db as unknown as Database), db };
|
|
94
|
+
return { svc: new SessionOntologyService(db as unknown as Database, testKbContext()), db };
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
describe('SessionOntologyService (touched-set model)', () => {
|
|
@@ -157,7 +158,7 @@ describe('SessionOntologyService (touched-set model)', () => {
|
|
|
157
158
|
it('survives a "restart": a new instance re-reads the touched set from the store', async () => {
|
|
158
159
|
await svc.checkOperation('s1', P_READ, false);
|
|
159
160
|
await svc.checkOperation('s1', PL_READ, false);
|
|
160
|
-
const afterRestart = new SessionOntologyService(db as unknown as Database);
|
|
161
|
+
const afterRestart = new SessionOntologyService(db as unknown as Database, testKbContext());
|
|
161
162
|
// The poison persists across the restart: writes still blocked.
|
|
162
163
|
expect((await afterRestart.checkOperation('s1', P_READ, true)).allow).toBe(false);
|
|
163
164
|
});
|
|
@@ -2,6 +2,7 @@ import type { Server } from 'node:http';
|
|
|
2
2
|
import type { AddressInfo } from 'node:net';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
5
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
5
6
|
import type { AuthUser, Change, IWorkflowService } from '@bevel-software/platform-shared';
|
|
6
7
|
import type { Database } from '../../database/connection.js';
|
|
7
8
|
import type { IAccessControl } from '../../access/access-control.interface.js';
|
|
@@ -79,7 +80,7 @@ async function makeHarness(): Promise<Harness> {
|
|
|
79
80
|
{} as IAccessControl,
|
|
80
81
|
new FileLockService(fake.db),
|
|
81
82
|
pending,
|
|
82
|
-
KB,
|
|
83
|
+
testKbContext({ kbDirName: KB }),
|
|
83
84
|
openChangeGate(),
|
|
84
85
|
events,
|
|
85
86
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { describe, it, expect, vi
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import { drizzle } from 'drizzle-orm/pg-proxy';
|
|
3
|
-
import { configureBranchModel } from '@bevel-software/platform-shared';
|
|
4
4
|
import type { GitService } from '../git/git.service.js';
|
|
5
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
6
6
|
import type { IReviewWorkflowService } from '../review-workflow/review-workflow.interface.js';
|
|
@@ -103,7 +103,7 @@ function makeService(db: Database, git: Partial<GitService>) {
|
|
|
103
103
|
{} as IAccessControl,
|
|
104
104
|
{} as FileLockService,
|
|
105
105
|
{} as PendingCommitsService,
|
|
106
|
-
|
|
106
|
+
testKbContext(),
|
|
107
107
|
openChangeGate(),
|
|
108
108
|
);
|
|
109
109
|
}
|
|
@@ -132,13 +132,6 @@ function retire(svc: WorkflowService, number: number, base: string) {
|
|
|
132
132
|
).retireMergedSourceBranch(number, base, USER);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
beforeEach(() => {
|
|
136
|
-
configureBranchModel({
|
|
137
|
-
defaultBranch: 'target-company-state',
|
|
138
|
-
protectedBranches: ['current-company-state', 'target-company-state'],
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
135
|
describe('post-merge branch retirement', () => {
|
|
143
136
|
it('keeps a branch another open request proposes INTO', async () => {
|
|
144
137
|
const deleted: string[] = [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, Change } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -113,7 +114,7 @@ function makeFacade(git: GitService, locks: FileLockService, events: WorkflowEve
|
|
|
113
114
|
{} as IAccessControl,
|
|
114
115
|
locks,
|
|
115
116
|
pending,
|
|
116
|
-
|
|
117
|
+
testKbContext(),
|
|
117
118
|
openChangeGate(),
|
|
118
119
|
events,
|
|
119
120
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe, it, expect, vi
|
|
2
|
-
import {
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
3
3
|
import type { GitService } from '../git/git.service.js';
|
|
4
4
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
5
5
|
import type { IReviewWorkflowService } from '../review-workflow/review-workflow.interface.js';
|
|
@@ -67,7 +67,7 @@ function makeService(open: OpenRow[], listBranches: () => Promise<{ name: string
|
|
|
67
67
|
{} as IAccessControl,
|
|
68
68
|
{} as FileLockService,
|
|
69
69
|
{} as PendingCommitsService,
|
|
70
|
-
|
|
70
|
+
testKbContext(),
|
|
71
71
|
openChangeGate(),
|
|
72
72
|
);
|
|
73
73
|
(svc as unknown as { events?: { emit(e: unknown): void } }).events = {
|
|
@@ -76,13 +76,6 @@ function makeService(open: OpenRow[], listBranches: () => Promise<{ name: string
|
|
|
76
76
|
return { svc, git, invalidated, emitted };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
beforeEach(() => {
|
|
80
|
-
configureBranchModel({
|
|
81
|
-
defaultBranch: 'target-company-state',
|
|
82
|
-
protectedBranches: ['current-company-state', 'target-company-state'],
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
79
|
describe('closeChangeRequestsWithDeletedBranches', () => {
|
|
87
80
|
it('closes a request whose source branch is gone', async () => {
|
|
88
81
|
const { svc, invalidated, emitted } = makeService(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type {
|
|
3
4
|
AuthUser,
|
|
4
5
|
ChangeInput,
|
|
@@ -13,7 +14,7 @@ import { FileLockService } from '../file-lock.service.js';
|
|
|
13
14
|
import { PendingCommitsService } from '../pending-commits.service.js';
|
|
14
15
|
import { WorkflowService } from '../workflow.service.js';
|
|
15
16
|
import { PullRebaseConflictError, WorkflowDomainError } from '../../../shared/domain-errors.js';
|
|
16
|
-
import { DEFAULT_BRANCH
|
|
17
|
+
import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
|
|
17
18
|
import type { Database } from '../../database/connection.js';
|
|
18
19
|
import { openChangeGate } from '../../../__tests__/open-change-gate.js';
|
|
19
20
|
|
|
@@ -238,7 +239,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
238
239
|
const branches = [{ name: 'main', isCurrent: true, isProtected: true, ahead: 0, behind: 0, hasRemote: true }];
|
|
239
240
|
(git.listBranches as ReturnType<typeof vi.fn>).mockResolvedValue(branches);
|
|
240
241
|
|
|
241
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
242
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
242
243
|
await expect(svc.listBranches('w1')).resolves.toBe(branches);
|
|
243
244
|
// listBranches(workspaceId, opts?) forwards opts — undefined when omitted.
|
|
244
245
|
expect(git.listBranches).toHaveBeenCalledWith('w1', undefined);
|
|
@@ -248,7 +249,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
248
249
|
const git = makeGit();
|
|
249
250
|
(git.createBranch as ReturnType<typeof vi.fn>).mockResolvedValue({ name: 'feat' });
|
|
250
251
|
|
|
251
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
252
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
252
253
|
await svc.createBranch('w1', 'feat', 'current-company-state');
|
|
253
254
|
expect(git.createBranch).toHaveBeenCalledWith('w1', 'feat', 'current-company-state');
|
|
254
255
|
});
|
|
@@ -258,7 +259,7 @@ describe('WorkflowService — branch delegation', () => {
|
|
|
258
259
|
const status = { branch: 'main', isDirty: false, hasUpstream: true, unpushedCommits: 0, conflicted: [], unmergedFromUpstream: false };
|
|
259
260
|
(git.status as ReturnType<typeof vi.fn>).mockResolvedValue(status);
|
|
260
261
|
|
|
261
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
262
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
262
263
|
await expect(svc.branchStatus('w1')).resolves.toBe(status);
|
|
263
264
|
expect(git.status).toHaveBeenCalledWith('w1');
|
|
264
265
|
});
|
|
@@ -272,7 +273,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
272
273
|
const commit = { sha: 'abc', authorName: 'Alice', authorEmail: 'alice@example.com', subject: 'tweak owner', committedAt: '2026-01-01T00:00:00Z' };
|
|
273
274
|
(git.commit as ReturnType<typeof vi.fn>).mockResolvedValue(commit);
|
|
274
275
|
|
|
275
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
276
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
276
277
|
await expect(svc.commitChange('w1', user, input)).resolves.toBe(commit);
|
|
277
278
|
expect(git.commit).toHaveBeenCalledWith('w1', user, input);
|
|
278
279
|
});
|
|
@@ -281,7 +282,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
281
282
|
const git = makeGit();
|
|
282
283
|
(git.logForFile as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
283
284
|
|
|
284
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
285
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
285
286
|
await svc.listChangesForFile('w1', 'Knowledge/Foo.md', 5);
|
|
286
287
|
expect(git.logForFile).toHaveBeenCalledWith('w1', 'Knowledge/Foo.md', 5);
|
|
287
288
|
});
|
|
@@ -290,7 +291,7 @@ describe('WorkflowService — change delegation', () => {
|
|
|
290
291
|
const git = makeGit();
|
|
291
292
|
(git.diffFileBetweenBranches as ReturnType<typeof vi.fn>).mockResolvedValue('@@ diff');
|
|
292
293
|
|
|
293
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
294
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
294
295
|
const diff = await svc.compareFile('w1', 'Foo.md', 'a', 'b');
|
|
295
296
|
expect(diff).toBe('@@ diff');
|
|
296
297
|
expect(git.diffFileBetweenBranches).toHaveBeenCalledWith('w1', 'Foo.md', 'a', 'b');
|
|
@@ -302,7 +303,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
302
303
|
const prs = makePrs();
|
|
303
304
|
(prs.listOpenPrs as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
304
305
|
|
|
305
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
306
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
306
307
|
await svc.listChangeRequests({ fresh: true });
|
|
307
308
|
expect(prs.listOpenPrs).toHaveBeenCalledWith({ fresh: true });
|
|
308
309
|
});
|
|
@@ -314,7 +315,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
314
315
|
const input: PostChangeRequestCommentInput = { body: 'hi' };
|
|
315
316
|
(reviewWorkflow.postComment as ReturnType<typeof vi.fn>).mockResolvedValue(comment);
|
|
316
317
|
|
|
317
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
318
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
318
319
|
const user = makeUser();
|
|
319
320
|
await expect(svc.postComment(42, user, input, 'sha1')).resolves.toBe(comment);
|
|
320
321
|
expect(reviewWorkflow.postComment).toHaveBeenCalledWith(42, user, input, 'sha1');
|
|
@@ -327,7 +328,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
327
328
|
const reviewWorkflow = makeReviewWorkflow();
|
|
328
329
|
(reviewWorkflow.approveFile as ReturnType<typeof vi.fn>).mockResolvedValue([]);
|
|
329
330
|
|
|
330
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
331
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
331
332
|
await svc.approveFile(7, 'Foo.md', makeUser(), [], 'sha', 'main', null, 'w1');
|
|
332
333
|
expect(prs.invalidateDetailCache).toHaveBeenCalledWith(7);
|
|
333
334
|
expect(prs.invalidateDetailCache).toHaveBeenCalledTimes(1);
|
|
@@ -338,7 +339,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
338
339
|
const reviewWorkflow = makeReviewWorkflow();
|
|
339
340
|
(reviewWorkflow.cancelPr as ReturnType<typeof vi.fn>).mockResolvedValue({ prNumber: 9, cancelledAt: 't' });
|
|
340
341
|
|
|
341
|
-
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
342
|
+
const svc = new WorkflowService(makeDb(), makeGit(), prs, reviewWorkflow, makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
342
343
|
const user = makeUser();
|
|
343
344
|
await svc.rejectChangeRequest(9, user, 'open', null, 'main', 'w1');
|
|
344
345
|
expect(reviewWorkflow.cancelPr).toHaveBeenCalledWith(9, user, 'open', null, 'main', 'w1');
|
|
@@ -357,7 +358,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
357
358
|
|
|
358
359
|
const git = makeGit();
|
|
359
360
|
const workspaceService = makeWorkspaceService();
|
|
360
|
-
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
361
|
+
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
361
362
|
// Conflicts are surfaced by the local merge inside `reviewWorkflow.mergePr`
|
|
362
363
|
// (mocked here), so there's no provider "mergeable" pre-check to stub.
|
|
363
364
|
const outcome = await svc.mergeChangeRequest(
|
|
@@ -412,7 +413,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
412
413
|
id: 'resolved-target-ws',
|
|
413
414
|
});
|
|
414
415
|
const pending = makePendingCommits();
|
|
415
|
-
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), pending,
|
|
416
|
+
const svc = new WorkflowService(makeDb(), git, prs, reviewWorkflow, workspaceService, makeAccessControl(), makeFileLockService(), pending, testKbContext(), openChangeGate());
|
|
416
417
|
|
|
417
418
|
const outcome = await svc.mergeChangeRequest(
|
|
418
419
|
4, makeUser(), 'sha', [], 'open', 'PR title', 'main', 'w1', { bypass: true },
|
|
@@ -435,7 +436,7 @@ describe('WorkflowService — change request delegation + cache invalidation', (
|
|
|
435
436
|
describe('WorkflowService — file lock delegation', () => {
|
|
436
437
|
it('acquireLock delegates to FileLockService.acquire', async () => {
|
|
437
438
|
const fileLocks = makeFileLockService();
|
|
438
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
439
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
439
440
|
await svc.acquireLock('w1', 'b', 'p', makeUser());
|
|
440
441
|
expect(fileLocks.acquire).toHaveBeenCalledWith('w1', 'b', 'p', expect.objectContaining({ email: 'alice@example.com' }), undefined);
|
|
441
442
|
});
|
|
@@ -445,7 +446,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
445
446
|
// a coordination hold masquerade as an edit lock on the very next read
|
|
446
447
|
// (which is how the write paths decide what the holder may do).
|
|
447
448
|
const fileLocks = makeFileLockService();
|
|
448
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
449
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
449
450
|
await svc.acquireLock('w1', 'b', 'p', makeUser(), { coordination: true });
|
|
450
451
|
expect(fileLocks.acquire).toHaveBeenCalledWith(
|
|
451
452
|
'w1', 'b', 'p', expect.objectContaining({ email: 'alice@example.com' }), { coordination: true },
|
|
@@ -454,7 +455,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
454
455
|
|
|
455
456
|
it('getLock delegates to FileLockService.get', async () => {
|
|
456
457
|
const fileLocks = makeFileLockService();
|
|
457
|
-
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
458
|
+
const svc = new WorkflowService(makeDb(), makeGit(), makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
458
459
|
await expect(svc.getLock('w1', 'b', 'p')).resolves.toBeNull();
|
|
459
460
|
expect(fileLocks.get).toHaveBeenCalledWith('w1', 'b', 'p');
|
|
460
461
|
});
|
|
@@ -469,7 +470,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
469
470
|
acquiredAt: '', lastHeartbeatAt: '', expiresAt: '',
|
|
470
471
|
});
|
|
471
472
|
const pending = makePendingCommits();
|
|
472
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, pending,
|
|
473
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, pending, testKbContext(), openChangeGate());
|
|
473
474
|
await expect(svc.releaseLock('w1', 'feat', 'Foo.md', makeUser())).resolves.toBeUndefined();
|
|
474
475
|
// No inline git work — the worker handles that out of band.
|
|
475
476
|
expect(git.commitFile).not.toHaveBeenCalled();
|
|
@@ -488,28 +489,28 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
488
489
|
// One open request rides the branch — deleting it would strand the request.
|
|
489
490
|
// `sourceBranch` matters to the guard now: it decides whether the refusal
|
|
490
491
|
// says "withdraw yours" (source) or names the other request's actors (target).
|
|
491
|
-
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
492
|
+
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
492
493
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).rejects.toThrow(/open change request \(#7\)/);
|
|
493
494
|
expect(git.deleteBranch).not.toHaveBeenCalled();
|
|
494
495
|
});
|
|
495
496
|
|
|
496
497
|
it('deleteBranch refuses when an open request proposes INTO the branch (target end)', async () => {
|
|
497
498
|
const git = makeGit();
|
|
498
|
-
const svc = new WorkflowService(makeDb([{ number: 9, sourceBranch: 'other/y', targetBranch: 'feat/x', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
499
|
+
const svc = new WorkflowService(makeDb([{ number: 9, sourceBranch: 'other/y', targetBranch: 'feat/x', state: 'open' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
499
500
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).rejects.toThrow(/proposes changes into/);
|
|
500
501
|
expect(git.deleteBranch).not.toHaveBeenCalled();
|
|
501
502
|
});
|
|
502
503
|
|
|
503
504
|
it('deleteBranch proceeds past a CLOSED request — the guard filters on state, not mere mention', async () => {
|
|
504
505
|
const git = makeGit();
|
|
505
|
-
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'closed' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
506
|
+
const svc = new WorkflowService(makeDb([{ number: 7, sourceBranch: 'feat/x', targetBranch: 'dev', state: 'closed' }]), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
506
507
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).resolves.toBeUndefined();
|
|
507
508
|
expect(git.deleteBranch).toHaveBeenCalled();
|
|
508
509
|
});
|
|
509
510
|
|
|
510
511
|
it('deleteBranch deletes when the branch has no open change request', async () => {
|
|
511
512
|
const git = makeGit();
|
|
512
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
513
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
513
514
|
await expect(svc.deleteBranch('w1', 'feat/x', makeUser())).resolves.toBeUndefined();
|
|
514
515
|
expect(git.deleteBranch).toHaveBeenCalledWith('w1', 'feat/x', expect.objectContaining({ email: 'alice@example.com' }), undefined);
|
|
515
516
|
});
|
|
@@ -529,7 +530,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
529
530
|
vi.mocked(git.deleteBranch)
|
|
530
531
|
.mockImplementationOnce(async () => { order.push('first:start'); await gate; order.push('first:end'); })
|
|
531
532
|
.mockImplementationOnce(async () => { order.push('second'); });
|
|
532
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(),
|
|
533
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
533
534
|
const first = svc.deleteBranch('w1', 'feat/x', makeUser());
|
|
534
535
|
const second = svc.deleteBranch('w1', 'feat/x', makeUser());
|
|
535
536
|
// Only release the gate once the first operation is provably inside its
|
|
@@ -544,7 +545,7 @@ describe('WorkflowService — file lock delegation', () => {
|
|
|
544
545
|
it('releaseLock refuses when the caller does not hold the lock', async () => {
|
|
545
546
|
const git = makeGit();
|
|
546
547
|
const fileLocks = makeFileLockService(); // default: get → null
|
|
547
|
-
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(),
|
|
548
|
+
const svc = new WorkflowService(makeDb(), git, makePrs(), makeReviewWorkflow(), makeWorkspaceService(), makeAccessControl(), fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
548
549
|
await expect(svc.releaseLock('w1', 'feat', 'Foo.md', makeUser())).rejects.toThrow(/not held by you/);
|
|
549
550
|
// The commit must NOT run when the caller doesn't hold the lock —
|
|
550
551
|
// otherwise a non-holder could trigger a commit attributed as them.
|
|
@@ -605,7 +606,7 @@ describe('WorkflowService — revertChangeRequestFile / closeEmptyChangeRequest'
|
|
|
605
606
|
returning: vi.fn(async () => updateRows),
|
|
606
607
|
});
|
|
607
608
|
const db = chain as unknown as Database;
|
|
608
|
-
const svc = new WorkflowService(db, git, prs, makeReviewWorkflow(), makeWorkspaceService(), access, fileLocks, makePendingCommits(),
|
|
609
|
+
const svc = new WorkflowService(db, git, prs, makeReviewWorkflow(), makeWorkspaceService(), access, fileLocks, makePendingCommits(), testKbContext(), openChangeGate());
|
|
609
610
|
return { svc, git, prs, access, fileLocks, db: chain };
|
|
610
611
|
}
|
|
611
612
|
|
|
@@ -808,7 +809,7 @@ describe('WorkflowService — deleteChangeRequest (admin moderation verb)', () =
|
|
|
808
809
|
returning: vi.fn(async () => [{ id: 1 }]),
|
|
809
810
|
});
|
|
810
811
|
const workspaces = makeWorkspaceService();
|
|
811
|
-
const svc = new WorkflowService(chain as unknown as Database, git, prs, makeReviewWorkflow(), workspaces, access, makeFileLockService(), makePendingCommits(),
|
|
812
|
+
const svc = new WorkflowService(chain as unknown as Database, git, prs, makeReviewWorkflow(), workspaces, access, makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
812
813
|
return { svc, prs, db: chain, access, workspaces };
|
|
813
814
|
}
|
|
814
815
|
|
|
@@ -916,7 +917,7 @@ describe('WorkflowService.mergeBranch — an agent merges branches, never an ope
|
|
|
916
917
|
const access = makeAccessControl();
|
|
917
918
|
(access.canWriteBatchAtRef as ReturnType<typeof vi.fn>).mockResolvedValue(opts.canWrite === undefined ? null : opts.canWrite);
|
|
918
919
|
const workspaceService = makeWorkspaceService();
|
|
919
|
-
const svc = new WorkflowService(makeDb([OPEN_REQUEST]), git, makePrs(), makeReviewWorkflow(), workspaceService, access, makeFileLockService(), makePendingCommits(),
|
|
920
|
+
const svc = new WorkflowService(makeDb([OPEN_REQUEST]), git, makePrs(), makeReviewWorkflow(), workspaceService, access, makeFileLockService(), makePendingCommits(), testKbContext(), openChangeGate());
|
|
920
921
|
const merge = (git as unknown as { mergeChangeRequest: ReturnType<typeof vi.fn> }).mergeChangeRequest;
|
|
921
922
|
return { svc, git, access, merge };
|
|
922
923
|
}
|
|
@@ -956,7 +957,7 @@ describe('WorkflowService.mergeBranch — an agent merges branches, never an ope
|
|
|
956
957
|
});
|
|
957
958
|
|
|
958
959
|
it('refuses a protected target when the caller could not commit the changed files directly', async () => {
|
|
959
|
-
expect(isProtectedBranch(PROTECTED)).toBe(true);
|
|
960
|
+
expect(testKbContext().isProtectedBranch(PROTECTED)).toBe(true);
|
|
960
961
|
const { svc, git, access, merge } = harness({ canWrite: new Map([['Team/Process.md', false]]) });
|
|
961
962
|
const err = await svc.mergeBranch(makeUser(), 'alice/other', PROTECTED).catch((e: unknown) => e);
|
|
962
963
|
expect(err).toMatchObject({ status: 403, payload: { kind: 'protected-merge-target', deniedPaths: ['Team/Process.md'] } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, PullRequestSummary } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -138,7 +139,7 @@ function makeHarness(requests: PullRequestSummary[], access: Access = {}) {
|
|
|
138
139
|
accessControl,
|
|
139
140
|
fileLocks,
|
|
140
141
|
pendingCommits,
|
|
141
|
-
|
|
142
|
+
testKbContext(),
|
|
142
143
|
openChangeGate(),
|
|
143
144
|
);
|
|
144
145
|
// Which request an UPDATE is closing is not recoverable from the drizzle
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -53,7 +54,7 @@ function makeService(canRestorePlatformFile: IAccessControl['canRestorePlatformF
|
|
|
53
54
|
accessControl,
|
|
54
55
|
{ acquire, get: vi.fn(async () => null) } as unknown as FileLockService,
|
|
55
56
|
{} as PendingCommitsService,
|
|
56
|
-
KB,
|
|
57
|
+
testKbContext({ kbDirName: KB }),
|
|
57
58
|
openChangeGate(),
|
|
58
59
|
new WorkflowEventBus(),
|
|
59
60
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -61,7 +62,7 @@ function makeService(opts: {
|
|
|
61
62
|
accessControl,
|
|
62
63
|
{ acquire, get: vi.fn(async () => null) } as unknown as FileLockService,
|
|
63
64
|
{} as PendingCommitsService,
|
|
64
|
-
KB,
|
|
65
|
+
testKbContext({ kbDirName: KB }),
|
|
65
66
|
opts.gate ?? gateThat({ allowed: true, via: 'readable' }).gate,
|
|
66
67
|
new WorkflowEventBus(),
|
|
67
68
|
);
|
|
@@ -81,7 +82,7 @@ describe('WorkflowService cannot exist without the gate', () => {
|
|
|
81
82
|
{} as IAccessControl,
|
|
82
83
|
{} as FileLockService,
|
|
83
84
|
{} as PendingCommitsService,
|
|
84
|
-
KB,
|
|
85
|
+
testKbContext({ kbDirName: KB }),
|
|
85
86
|
undefined as unknown as IChangeReadGate,
|
|
86
87
|
),
|
|
87
88
|
).toThrow(/requires a read-before-write gate/);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, type MockInstance } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, Change } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -143,7 +144,7 @@ function makeFacade(
|
|
|
143
144
|
{} as IAccessControl,
|
|
144
145
|
locks,
|
|
145
146
|
pending,
|
|
146
|
-
|
|
147
|
+
testKbContext(),
|
|
147
148
|
openChangeGate(),
|
|
148
149
|
events,
|
|
149
150
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { RemoteSyncPullResult } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -37,7 +38,7 @@ function build(opts: { sync: () => Promise<RemoteSyncPullResult> }) {
|
|
|
37
38
|
{} as IAccessControl,
|
|
38
39
|
{} as FileLockService,
|
|
39
40
|
pendingCommits,
|
|
40
|
-
|
|
41
|
+
testKbContext(),
|
|
41
42
|
openChangeGate(),
|
|
42
43
|
events,
|
|
43
44
|
);
|
|
@@ -259,7 +260,7 @@ describe('WorkflowService.retireRemoteGoneClone', () => {
|
|
|
259
260
|
const svc = new WorkflowService(
|
|
260
261
|
{} as Database, git, {} as PullRequestService, {} as IReviewWorkflowService,
|
|
261
262
|
workspaceService, {} as IAccessControl, {} as FileLockService, {} as PendingCommitsService,
|
|
262
|
-
|
|
263
|
+
testKbContext(),
|
|
263
264
|
openChangeGate(),
|
|
264
265
|
);
|
|
265
266
|
return { svc, git, workspaceService };
|
|
@@ -327,7 +328,7 @@ describe('WorkflowService.retireRemoteGoneClone — what can bring the branch ba
|
|
|
327
328
|
const svc = new WorkflowService(
|
|
328
329
|
{} as Database, git, {} as PullRequestService, {} as IReviewWorkflowService,
|
|
329
330
|
workspaceService, {} as IAccessControl, {} as FileLockService, {} as PendingCommitsService,
|
|
330
|
-
|
|
331
|
+
testKbContext(),
|
|
331
332
|
openChangeGate(),
|
|
332
333
|
);
|
|
333
334
|
expect(await svc.retireRemoteGoneClone('ali%2Fx')).toBe(false);
|
|
@@ -356,7 +357,7 @@ describe('WorkflowService.retireRemoteGoneClone — what can bring the branch ba
|
|
|
356
357
|
const svc = new WorkflowService(
|
|
357
358
|
{} as Database, git, {} as PullRequestService, {} as IReviewWorkflowService,
|
|
358
359
|
workspaceService, {} as IAccessControl, {} as FileLockService, {} as PendingCommitsService,
|
|
359
|
-
|
|
360
|
+
testKbContext(),
|
|
360
361
|
openChangeGate(),
|
|
361
362
|
);
|
|
362
363
|
// Retirement enters first; a createBranch for the same name arrives while
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { testKbContext } from '../../../__tests__/kb-context.js';
|
|
2
3
|
import type { AuthUser, PullRequestDetail } from '@bevel-software/platform-shared';
|
|
3
4
|
import type { GitService } from '../git/git.service.js';
|
|
4
5
|
import type { PullRequestService } from '../git/pull-request.service.js';
|
|
@@ -102,7 +103,7 @@ function harness(opts: {
|
|
|
102
103
|
{} as unknown as IAccessControl,
|
|
103
104
|
{} as unknown as FileLockService,
|
|
104
105
|
pendingCommits as unknown as PendingCommitsService,
|
|
105
|
-
|
|
106
|
+
testKbContext(),
|
|
106
107
|
openChangeGate(),
|
|
107
108
|
);
|
|
108
109
|
return { svc, git, prs, pendingCommits, reviewWorkflow, refreshed };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Server as HttpServer } from 'node:http';
|
|
2
2
|
import express from 'express';
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { testKbContext } from '../../../../__tests__/kb-context.js';
|
|
4
5
|
import { ToolRegistry } from '../../../tool-registry/tool-registry.js';
|
|
5
6
|
import { InternalTokenService } from '../../../tool-auth/internal-token.service.js';
|
|
6
7
|
import { createToolAuthMiddleware } from '../../../tool-auth/tool-auth.middleware.js';
|
|
@@ -96,7 +97,7 @@ async function start(): Promise<string> {
|
|
|
96
97
|
const toolHandler = createToolHandlerFactory(resolve);
|
|
97
98
|
|
|
98
99
|
const router = express.Router();
|
|
99
|
-
registerWorkflowTools(registry, router, toolAuth, toolHandler,
|
|
100
|
+
registerWorkflowTools(registry, router, toolAuth, toolHandler, testKbContext());
|
|
100
101
|
router.use(createManualRoutes(registry, toolAuth));
|
|
101
102
|
|
|
102
103
|
const app = express();
|