Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
674170f
docs(openspec): object slugs are configurable and unique per register…
WilcoLouwerse Oct 22, 2026
62d2564
fix(objects): object slugs are unique per register and schema and fro…
WilcoLouwerse Oct 22, 2026
2fa3fee
feat(objects): occ openregister:backfill-slugs fills missing object s…
WilcoLouwerse Oct 22, 2026
7c77f6b
test(objects): cover the object-slug rules, docs and changelog for #4037
WilcoLouwerse Oct 22, 2026
9062635
docs(openspec): mark the rig rerun of the slug reproduction as done
WilcoLouwerse Oct 22, 2026
ca4dc03
fix(objects): address the review of the object-slug change
WilcoLouwerse Oct 22, 2026
29fee35
docs(objects): add @spec tags to the slug methods
WilcoLouwerse Oct 22, 2026
e943c4c
style(objects): replace inline IFs and long lines on the slug code
WilcoLouwerse Oct 22, 2026
2f58ab2
fix(objects): backfill no longer stops at an unconvertible row
WilcoLouwerse Oct 22, 2026
018f847
test(objects): remove the headers and blank runs left by the slug tes…
WilcoLouwerse Oct 22, 2026
423fdca
docs(objects): state that --reslug rewrites frozen slugs
WilcoLouwerse Oct 22, 2026
8cbb62b
refactor(objects): remove the slug helpers left unused
WilcoLouwerse Oct 22, 2026
722441e
docs(objects): say what --reslug does on a collision
WilcoLouwerse Oct 22, 2026
6d2779c
fix(objects): keep a slug on a --reslug collision and audit each back…
WilcoLouwerse Oct 22, 2026
85244a6
test(objects): cover the slug backfill command and a real second run
WilcoLouwerse Oct 22, 2026
3f81682
fix(objects): keep slugs unique on restore and seed import
WilcoLouwerse Oct 22, 2026
81b03c1
test(objects): pin the slug freeze through the update pipeline
WilcoLouwerse Oct 22, 2026
dbedaa8
fix(objects): answer 409 on every identifier route and prefer id and …
WilcoLouwerse Oct 22, 2026
d85bcc6
fix(objects): compare slugs case-insensitively in bulk save and split…
WilcoLouwerse Oct 22, 2026
61cb81e
test(objects): assert the bulk upsert slug guard through the statemen…
WilcoLouwerse Oct 22, 2026
0efcea5
style(objects): clear the remaining phpmd findings on lines this chan…
WilcoLouwerse Oct 22, 2026
7033830
style(objects): wrap the over-long lines and document the ImportHandl…
WilcoLouwerse Oct 22, 2026
cd30ba8
fix(objects): compare the normalised client slug with the frozen slug
WilcoLouwerse Oct 22, 2026
02068f9
docs(objects): state that a client-sent slug is slugified
WilcoLouwerse Oct 22, 2026
349562f
fix(import): look a uuid-less seed up by its normalised slug
WilcoLouwerse Oct 22, 2026
0a09d5a
fix(objects): log the collision when a restore or seed takes the suff…
WilcoLouwerse Oct 22, 2026
7532ecc
fix(objects): record the real skipped count in the slug backfill audi…
WilcoLouwerse Oct 22, 2026
0b442bc
fix(objects): write no audit entry for a slug backfill run that chang…
WilcoLouwerse Oct 22, 2026
375adc7
fix(objects): audit, evict and report when a slug backfill write chun…
WilcoLouwerse Oct 22, 2026
0e1da55
fix(objects): bound the slug backfill audit entry
WilcoLouwerse Oct 22, 2026
2dfce0a
fix(objects): write the row that vacates a slug before the row that t…
WilcoLouwerse Oct 22, 2026
d9a6c6e
docs(objects): specify the write order of the slug reslug
WilcoLouwerse Oct 22, 2026
272aa99
perf(objects): plan the slug reslug walk in linear work
WilcoLouwerse Oct 22, 2026
f52a24d
fix(objects): read the identifier rows key-match first and read 007 a…
WilcoLouwerse Oct 22, 2026
7bec557
fix(objects): answer 409 for an ambiguous identifier on the remaining…
WilcoLouwerse Oct 22, 2026
0e14f04
docs(objects): specify the id/uuid precedence and the routes that ans…
WilcoLouwerse Oct 22, 2026
e80191a
refactor(objects): split the reslug walk and the client slug rule out…
WilcoLouwerse Oct 22, 2026
92ccd90
docs(objects): tag the new slug methods with their spec requirement
WilcoLouwerse Oct 22, 2026
161574f
fix(objects): keep the rows of a reslug cycle instead of writing them
WilcoLouwerse Oct 22, 2026
9b3d412
fix(objects): only a canonical integer is an object id in the identif…
WilcoLouwerse Oct 22, 2026
684e2e8
fix(objects): keep presenceDepart at 200 for an ambiguous identifier
WilcoLouwerse Oct 22, 2026
e89d4e0
fix(import): find a uuid-less seed stored under a suffixed slug
WilcoLouwerse Oct 22, 2026
508c1a9
refactor(objects): keep the pre-push fixes within the phpmd and phpcs…
WilcoLouwerse Oct 22, 2026
035cd12
fix(objects): drop the --reslug option from the slug backfill
WilcoLouwerse Oct 23, 2026
ee9c751
fix(relations): answer 409 for an ambiguous identifier
WilcoLouwerse Oct 23, 2026
3af28b1
fix(audit): look an object's history up within its register and schema
WilcoLouwerse Oct 26, 2026
bfd2c0a
fix(objects): a slug lists this schema's files and an ambiguous slug …
WilcoLouwerse Oct 26, 2026
002b32d
feat(objects): @schema.name as the second slug source
WilcoLouwerse Oct 26, 2026
fcc2abb
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 26, 2026
17d208f
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 26, 2026
7b4d7b9
test(objects): give the ambiguous-slug test's user a uid
WilcoLouwerse Oct 26, 2026
692c764
docs(objects): tag ObjectSlugSource's client-slug methods with their …
WilcoLouwerse Oct 26, 2026
8d2a506
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 27, 2026
7e80d4c
fix(review): #4774 f1/f5 — a name that slugifies to nothing gives no …
WilcoLouwerse Oct 27, 2026
e6f9f6e
fix(review): #4774 f2 — an anonymous files listing resolves the slug …
WilcoLouwerse Oct 27, 2026
6c911d2
fix(review): #4774 f3 — only a missing register or schema drops the h…
WilcoLouwerse Oct 27, 2026
12fad8e
fix(review): #4774 f4 — a reader gets 409 for an ambiguous slug on th…
WilcoLouwerse Oct 27, 2026
bea91e1
fix(review): #4774 f4 — the object logs route answers a reader 409 too
WilcoLouwerse Oct 27, 2026
e600b32
fix(review): #4774 f2 — the anonymous files lookup writes no read aud…
WilcoLouwerse Oct 27, 2026
b75d0ea
test(objects): put the administrator test's docblock back above it
WilcoLouwerse Oct 27, 2026
529d684
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 29, 2026
785f819
style(bulk): keep MagicBulkHandler under the phpmd class-length limit
WilcoLouwerse Oct 29, 2026
0f8d0d9
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 30, 2026
b2974c4
fix(review): #4715 s3-f1 — SchemaMapper factory never wires ObjectAct…
WilcoLouwerse Oct 30, 2026
8373e2c
fix(review): #4715 s3-f1 — WebhookMapper factory never wires WebhookI…
WilcoLouwerse Oct 30, 2026
a3a18af
test(review): #4715 s3-f3 — Registrar tests pass with optional deps d…
WilcoLouwerse Oct 30, 2026
405d599
fix(review): #4715 s2-f1 — Referenced-calculation refresh runs cascad…
WilcoLouwerse Oct 30, 2026
d8e4249
test(review): #4715 s3-f4 — ListenerRegistrarTest would miss a droppe…
WilcoLouwerse Oct 30, 2026
1051e5b
chore(review): #4715 s4-f1 — .mailmap ships contributors' personal ad…
WilcoLouwerse Oct 30, 2026
7b27ce0
chore(review): #4715 s4-f4 — New repo-only files ship in the release …
WilcoLouwerse Oct 30, 2026
6a66f1c
fix(review): #4715 s2-f2 — Destruction-list register ships with no au…
WilcoLouwerse Oct 30, 2026
26d1df1
fix(review): #4715 s2-f3 — Task-key migration says 'run upgrade again…
WilcoLouwerse Oct 30, 2026
1138bc3
fix(review): #4715 s2-f4 — Dry-run controller translates only DoesNot…
WilcoLouwerse Oct 30, 2026
24cd723
fix(review): #4715 s2-f7 — Mixed-schema manage gate skips rows withou…
WilcoLouwerse Oct 30, 2026
4cdeb52
fix(review): #4715 s3-f3 — pre-push: wire TaskInboxService blockers a…
WilcoLouwerse Oct 30, 2026
bf2de1d
fix(review): #4715 s3-f3 — pre-push: wire ImportHandler shape validat…
WilcoLouwerse Oct 30, 2026
fb0ba2c
test(review): #4715 s3-f3 — pre-push: apply the factory wiring guard …
WilcoLouwerse Oct 30, 2026
1016453
fix(review): #4715 a-F — Daily example-set refresh re-grants what an …
WilcoLouwerse Oct 30, 2026
198a6cd
fix(review): #4715 s3-f1 — pre-push: hand the property-RBAC handler t…
WilcoLouwerse Oct 30, 2026
039a529
docs(review): #4715 s3-f1 — pre-push: correct the LeafRegistry commen…
WilcoLouwerse Oct 30, 2026
a345370
docs(review): #4715 s3-f1 — pre-push: record the save-time behaviour …
WilcoLouwerse Oct 30, 2026
324781f
fix(review): #4715 a-F — pre-push: refuse only sub-admins on a group …
WilcoLouwerse Oct 30, 2026
f793d34
fix(review): #4715 s2-f2 — pre-push: let the 1.1.0 schema authorizati…
WilcoLouwerse Oct 30, 2026
41085ed
test(review): #4715 s3-f3 — pre-push: state the true reason Organisat…
WilcoLouwerse Oct 30, 2026
5fb8ad4
docs(review): #4715 s3-f1 — pre-push: the GraphQL schema is per calle…
WilcoLouwerse Oct 30, 2026
402ac2c
style(phpmd): suppress the size and flag findings development brought in
WilcoLouwerse Oct 30, 2026
691a9a4
fix(slugs): re-check moved slugs, decide PATCH and history ambiguity …
WilcoLouwerse Oct 30, 2026
e078c58
test(review): #4715 s3-f3 — pre-push: wiring would write both default…
WilcoLouwerse Oct 30, 2026
26ffc70
fix(review): #4715 s2-f1 — pre-push: dedupe queued refreshes and run …
WilcoLouwerse Oct 30, 2026
66a2a92
fix(review): #4715 s2-f3 — pre-push: document the repair step and its…
WilcoLouwerse Oct 30, 2026
1eb89b4
fix(review): #4715 s2-f1 — pre-push: key the refresh dedupe on depth …
WilcoLouwerse Oct 30, 2026
2246c14
fix(review): #4715 s2-f2 — pre-push: state the empty-array-is-absent …
WilcoLouwerse Oct 30, 2026
573b2d7
docs(slugs): @spec on the public slug-fold methods
WilcoLouwerse Oct 30, 2026
1843620
Merge origin/development into fix/4037-unique-configurable-object-slugs
WilcoLouwerse Oct 30, 2026
5415879
Merge branch 'development' into review/pr-4715-fixes-integration
WilcoLouwerse Oct 30, 2026
e06324f
Merge branch 'development' into review/pr-4715-fixes-surface
WilcoLouwerse Oct 30, 2026
335a63a
Merge #5162 (review/pr-4715-fixes-integration) into the beta release …
WilcoLouwerse Nov 2, 2026
6a1106f
Merge #5169 (review/pr-4715-fixes-surface) into the beta release branch
WilcoLouwerse Nov 2, 2026
ef8fb7e
Merge #5186 (review/pr-4715-fixes-rbac) into the beta release branch
WilcoLouwerse Nov 2, 2026
7b7ee42
Merge #4774 (fix/4037-unique-configurable-object-slugs) into the beta…
WilcoLouwerse Nov 2, 2026
1df1a60
test(listeners): pin the frozen-object delete guard and the retention…
WilcoLouwerse Nov 2, 2026
d4e7df2
chore(release): raise the app version so the task-key repair step runs
WilcoLouwerse Nov 2, 2026
2155770
docs(spec): name the spec of four methods the #4715 review fixes added
WilcoLouwerse Nov 2, 2026
98ec0ca
feat(demo-data): three generated destruction lists for the mock register
WilcoLouwerse Nov 2, 2026
400b566
Merge pull request #5385 from ConductionNL/hotfix/beta-until-2026-10-30
WilcoLouwerse Nov 2, 2026
93ec611
chore(release): 2.1.42-beta.20261102161558
github-actions[bot] Nov 2, 2026
d30af2f
chore(release): sync beta back into development
WilcoLouwerse Nov 2, 2026
4ac9997
Merge branch 'development' into sync/beta-to-development-2.1.35-unsta…
WilcoLouwerse Nov 2, 2026
25aa252
Merge branch 'development' into sync/beta-to-development-2.1.35-unsta…
WilcoLouwerse Nov 2, 2026
8a18f0d
Merge pull request #5388 from ConductionNL/release/v2.1.42-beta.20261…
WilcoLouwerse Nov 3, 2026
249e991
Merge branch 'beta' into sync/beta-to-development-2.1.35-unstable.202…
WilcoLouwerse Nov 3, 2026
cf3774f
Merge branch 'development' into sync/beta-to-development-2.1.35-unsta…
WilcoLouwerse Nov 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
app-name: openregister
verify-vendor-deps: true
vendor-check-paths: 'openai-php/client/src,theodo-group/llphant/src'
# One line: the shared workflow splices this into its rsync command.
# .mailmap maps contributors to personal addresses; git needs it, an
# installed app does not. sigrid.yaml (analysis scope) and
# ARCHITECTURE.md (contributor docs) are repository tooling.
extra-rsync-excludes: "--exclude='/.mailmap' --exclude='/sigrid.yaml' --exclude='/ARCHITECTURE.md'"
secrets: inherit

beta:
Expand All @@ -36,6 +41,11 @@ jobs:
app-name: openregister
verify-vendor-deps: true
vendor-check-paths: 'openai-php/client/src,theodo-group/llphant/src'
# One line: the shared workflow splices this into its rsync command.
# .mailmap maps contributors to personal addresses; git needs it, an
# installed app does not. sigrid.yaml (analysis scope) and
# ARCHITECTURE.md (contributor docs) are repository tooling.
extra-rsync-excludes: "--exclude='/.mailmap' --exclude='/sigrid.yaml' --exclude='/ARCHITECTURE.md'"
secrets: inherit

stable:
Expand All @@ -49,5 +59,10 @@ jobs:
app-name: openregister
verify-vendor-deps: true
vendor-check-paths: 'openai-php/client/src,theodo-group/llphant/src'
# One line: the shared workflow splices this into its rsync command.
# .mailmap maps contributors to personal addresses; git needs it, an
# installed app does not. sigrid.yaml (analysis scope) and
# ARCHITECTURE.md (contributor docs) are repository tooling.
extra-rsync-excludes: "--exclude='/.mailmap' --exclude='/sigrid.yaml' --exclude='/ARCHITECTURE.md'"
secrets: inherit

7 changes: 6 additions & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Open Register drijft apps zoals OpenCatalogi, Procest, Pipelinq en Software Cata

Vrij en open source onder de EUPL-licentie.
]]></description>
<version>2.1.35-unstable.20261028180000</version>
<version>2.1.42-beta.20261102161558</version>
<licence>EUPL-1.2</licence>
<author mail="info@conduction.nl" homepage="https://www.conduction.nl/">Conduction</author>
<namespace>OpenRegister</namespace>
Expand Down Expand Up @@ -412,6 +412,11 @@ Vrij en open source onder de EUPL-licentie.
1,664 tables, measured 2026-10-06). Last, after every step that
creates tasks. Idempotent. -->
<step>OCA\OpenRegister\Repair\BackfillTaskSubjectLocation</step>
<!-- Version1Date20261024120000 leaves the task_key unique index out
when stored keys collide, and a migration never runs twice; this
step adds it on a later upgrade or `occ maintenance:repair` once
the keys are distinct. Idempotent. -->
<step>OCA\OpenRegister\Repair\EnsureTaskKeyUniqueIndex</step>
</post-migration>
<install>
<step>OCA\OpenRegister\Repair\ReconcileDeclaredBackgroundJobs</step>
Expand Down
179 changes: 179 additions & 0 deletions lib/BackgroundJob/ReferencedCalculationJob.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?php

/**
* OpenRegister ReferencedCalculationJob
*
* Actor-forwarded background job carrying the deferred work of
* ReferencedCalculationListener: re-saves the objects whose materialised
* `@ref` calculations read a changed field of an updated object. The
* re-saves fan out (up to SYNC_LIMIT referrers per dependency, each firing
* the post-write listeners again), so they run here and not inside the
* user's update request (ADR-078).
*
* Each entry carries the changed fields read by a dependent (computed
* inline from the old and new data, which a job cannot see) and the cascade
* depth, so a refresh queued from one of these re-saves stops at the
* refresher's MAX_DEPTH. Each entry also names the user whose update queued
* it, and runs as that user: the job's own actor is whoever
* ListenerDeferralService captured first in the process that queued it,
* which for a refresh queued from inside another refresh job need not be
* the same person. Idempotent: a re-save recomputes from current data.
*
* SPDX-License-Identifier: EUPL-1.2
* SPDX-FileCopyrightText: 2026 Conduction B.V.
*
* @category BackgroundJob
* @package OCA\OpenRegister\BackgroundJob
*
* @author Conduction Development Team <dev@conduction.nl>
* @copyright 2026 Conduction B.V.
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* @version GIT: <git-id>
*
* @link https://OpenRegister.app
*
* @psalm-suppress UnusedClass
*/

declare(strict_types=1);

namespace OCA\OpenRegister\BackgroundJob;

use OCA\OpenRegister\Service\Calculation\ReferencedCalculationRefresher;
use OCA\OpenRegister\Service\Deferral\DeferredEntryObjectResolver;
use OCA\OpenRegister\Service\Deferral\DeferredListenerContext;
use OCA\OpenRegister\Service\OrganisationService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

/**
* Deferred referenced-calculation refresh under the forwarded actor.
*
* @spec openspec/changes/rematerialise-on-referenced-change/specs/computed-fields/spec.md#requirement-a-referenced-change-refreshes-the-materialised-values-that-read-it
*/
class ReferencedCalculationJob extends ActorForwardedJob {
/**
* The session the entry's own actor is set on.
*
* @var IUserSession
*/
private IUserSession $session;

/**
* Resolves the entry's actor.
*
* @var IUserManager
*/
private IUserManager $users;

/**
* Wire the refresh collaborators on top of the actor plumbing.
*
* @param ITimeFactory $time Time factory for the parent job class.
* @param IUserSession $userSession Session to impersonate on / restore.
* @param IUserManager $userManager Resolver for the captured user id.
* @param OrganisationService $organisation Active-organisation resolver.
* @param LoggerInterface $logger PSR logger.
* @param DeferredEntryObjectResolver $resolver Stale-safe entry re-fetch.
* @param ReferencedCalculationRefresher $refresher Re-saves the referring objects.
*
* @return void
*/
public function __construct(
ITimeFactory $time,
IUserSession $userSession,
IUserManager $userManager,
OrganisationService $organisation,
LoggerInterface $logger,
private readonly DeferredEntryObjectResolver $resolver,
private readonly ReferencedCalculationRefresher $refresher,
) {
$this->session = $userSession;
$this->users = $userManager;
parent::__construct(
time: $time,
userSession: $userSession,
userManager: $userManager,
organisation: $organisation,
logger: $logger
);
}//end __construct()

/**
* Refresh the referrers of every live entry; a failing entry does not abort the chunk.
*
* @param DeferredListenerContext $context The captured dispatch-time context.
*
* @return void
*
* @spec openspec/changes/rematerialise-on-referenced-change/specs/computed-fields/spec.md#requirement-a-referenced-change-refreshes-the-materialised-values-that-read-it
*/
protected function runDeferred(DeferredListenerContext $context): void {
foreach ($context->getEntries() as $entry) {
$changed = array_values(array_filter(($entry['changed'] ?? []), 'is_string'));
if ($changed === []) {
continue;
}

$object = $this->resolver->resolve(entry: $entry);
if ($object === null) {
continue;
}

$actor = $this->actorOf(entry: $entry);
if ($actor === false) {
continue;
}

$previous = $this->session->getUser();
try {
// No actor (an occ or cron origin) runs as no user, never as
// whoever the job itself was captured for.
$this->session->setUser($actor);

$this->refresher->refreshChanged(updated: $object, changed: $changed, depth: (int) ($entry['depth'] ?? 0));
} catch (\Throwable $e) {
$this->logger->warning(
message: '[ReferencedCalculationJob] Refresh failed for entry',
context: [
'file' => __FILE__,
'line' => __LINE__,
'uuid' => ($entry['uuid'] ?? null),
'error' => $e->getMessage(),
]
);
} finally {
$this->session->setUser($previous);
}//end try
}//end foreach
}//end runDeferred()

/**
* The user whose update queued the entry: null when there was none (run as no user), false when that user is gone.
*
* @param array<string, mixed> $entry The entry.
*
* @return IUser|null|false
*/
private function actorOf(array $entry): IUser|null|false {
$uid = ($entry['actor'] ?? null);
if (is_string($uid) === false || $uid === '') {
return null;
}

$user = $this->users->get($uid);
if ($user === null) {
$this->logger->warning(
message: '[ReferencedCalculationJob] The user of the original update no longer resolves; entry skipped',
context: ['file' => __FILE__, 'line' => __LINE__, 'uuid' => ($entry['uuid'] ?? null), 'actor' => $uid]
);
return false;
}

return $user;
}//end actorOf()
}//end class
3 changes: 2 additions & 1 deletion lib/Command/ExampleSetInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ protected function configure(): void {
shortcut: null,
mode: InputOption::VALUE_NONE,
description: 'Rewrite every object the set declares and already holds to its current values '
.'(dates against today, cast, lookups); objects the set did not write are left alone'
.'(dates against today, cast, lookups); objects the set did not write are left alone, '
.'and accounts, groups, memberships and sub-admins are not touched'
)
->addOption(
name: 'daily',
Expand Down
12 changes: 10 additions & 2 deletions lib/Controller/BulkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ private function refusedSchemaGate(int $schemaId): ?JSONResponse {
}//end refusedSchemaGate()

/**
* The refusal of a mixed-schema batch naming a schema the caller may not manage, or null.
* The refusal of a mixed-schema batch naming a schema the caller may not manage, or a row naming none, or null.
*
* @param bool $isMixedSchema Whether the batch names its schema per row.
* @param array<mixed> $objects The rows.
*
* @return JSONResponse|null 403, or null when every named schema passes or the batch is single-schema.
* @return JSONResponse|null 400 for a row without @self.schema, 403, or null when every row
* names a schema that passes or the batch is single-schema.
*
* @spec openspec/specs/object-lifecycle/spec.md#requirement-the-mixed-schema-bulk-route-checks-every-schema-its-rows-name
*/
Expand All @@ -166,6 +167,13 @@ private function refusedRowSchemas(bool $isMixedSchema, array $objects): ?JSONRe
return null;
}

if ($unmanageable === SchemaManageGate::NO_SCHEMA) {
return new JSONResponse(
data: ['error' => 'Every object of a mixed-schema bulk write must name its schema in @self.schema.'],
statusCode: Http::STATUS_BAD_REQUEST
);
}

return new JSONResponse(
data: ['error' => 'User does not have permission to bulk-write objects on schema ' . $unmanageable],
statusCode: Http::STATUS_FORBIDDEN
Expand Down
9 changes: 9 additions & 0 deletions lib/Controller/FlowDryRunController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use Psr\Log\LoggerInterface;
use Throwable;

/**
* The flow dry-run endpoint.
Expand All @@ -48,12 +50,14 @@ class FlowDryRunController extends Controller {
* @param IRequest $request The request.
* @param FlowAccess $access Who the caller is and which flow rights they hold.
* @param FlowDryRunService $service Walks the flow against the object.
* @param LoggerInterface $logger Records a dry run that failed for another reason.
*/
public function __construct(
string $appName,
IRequest $request,
private readonly FlowAccess $access,
private readonly FlowDryRunService $service,
private readonly LoggerInterface $logger,
) {
parent::__construct(appName: $appName, request: $request);
}//end __construct()
Expand Down Expand Up @@ -100,6 +104,11 @@ public function dryRun(string $id): JSONResponse {
return new JSONResponse($this->service->dryRun(flowId: $id, register: $register, schema: $schema, objectId: $objectId));
} catch (DoesNotExistException $e) {
return new JSONResponse(['error' => $e->getMessage()], Http::STATUS_NOT_FOUND);
} catch (Throwable $e) {
// Anything else the lookups or the engine throw is logged and answered
// without its message, which may name internals (ADR-105).
$this->logger->error('[FlowDryRun] dry run failed', ['exception' => $e]);
return new JSONResponse(['error' => 'The dry run could not be completed.'], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}//end dryRun()
}//end class
14 changes: 12 additions & 2 deletions lib/Db/MapperRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

namespace OCA\OpenRegister\Db;

use OCA\OpenRegister\Service\ObjectAction\ObjectActionValidator;
use OCA\OpenRegister\Service\Schemas\PropertyValidatorHandler;
use OCA\OpenRegister\Kernel\Contracts\AppSettingsInterface;
use OCA\OpenRegister\Service\Webhook\WebhookInterceptionCache;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use Psr\Container\ContainerInterface;

Expand Down Expand Up @@ -56,7 +58,12 @@ function (ContainerInterface $container) {
userSession: $container->get('OCP\IUserSession'),
groupManager: $container->get('OCP\IGroupManager'),
appConfig: $container->get('OCP\IAppConfig'),
logger: $container->get('Psr\Log\LoggerInterface')
logger: $container->get('Psr\Log\LoggerInterface'),
// Lazy: resolving the validator here closes the cycle
// ObjectActionValidator → … → RegisterMapper → SchemaMapper.
// Omitting it silently skipped the admin-only `elevate`
// rule and the bound-flow checks (openregister#5143).
objectActions: static fn (): ObjectActionValidator => $container->get(ObjectActionValidator::class)
);
}
);
Expand Down Expand Up @@ -90,7 +97,10 @@ function (ContainerInterface $container) {
organisationMapper: $container->get(OrganisationMapper::class),
userSession: $container->get('OCP\IUserSession'),
groupManager: $container->get('OCP\IGroupManager'),
appConfig: $container->get('OCP\IAppConfig')
appConfig: $container->get('OCP\IAppConfig'),
// Without it webhook CRUD never invalidates the interception
// flag WebhookService caches.
interceptionCache: $container->get(WebhookInterceptionCache::class)
);
}
);
Expand Down
Loading
Loading