Skip to content

feat(filinq): build flow-operations - #2120

Open
rubenvdlinde wants to merge 10 commits into
developmentfrom
quality/build-flow-operations
Open

rubenvdlinde wants to merge 10 commits into
developmentfrom
quality/build-flow-operations

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Continues flow-operations after #2062 (register schema and demo runs, tasks 1.1–1.2).

Tasks done

  • 2.1 RegisterFlowOperationsListener registers the four operations on RegisterOperationsEvent and loads the rule-builder script on LoadSettingsScriptsEvent; wired in DocumentGenerationRegistrar.
  • 2.2 Four ISpecificOperation classes under lib/Flow/Operation/ (file entity, admin + personal scope, translated name/description, icon). validateOperation() refuses malformed options with UnexpectedValueException: options must be a JSON object; validation takes only a known documentType (new ValidationProfileResolver::documentTypes()); PDF/A takes only a relative targetFolder without ...
  • 2.3 FlowOperationTrigger (request side): resolves the file from the event (file events, rename/copy targets, tag assigned), asks IRuleMatcher::getFlows(), dedupes on {operation, fileId} with a queued/running run, stores the run as queued and enqueues one FlowOperationJob. It never throws into the triggering request. FlowOperationJob starts the run, resolves the file in the owner's folder tree, runs the operation as the owner (volatile session, restored afterwards) and records the outcome; every failure ends the run failed with a reason.
  • 2.4 Loop guard: a file a run recorded as producedFileId, or a file created while an operation is writing its output (FlowOutputGuard), gets a skipped run with reason own_output and is never queued.
  • 2.5 Operation bodies: anonymise = intake only (extractAndDetectEntities(), counts per entity type, never values; a publication prohibition or the gate exception fails the run, a gate that cannot be asked fails closed; no review is written and no override passed). OCR = OcrRunService::run() with triggeredBy: flow (added to the ocrResult enum); disabled / no Tesseract / no text fail, a non-candidate is skipped; the summary holds confidence and text length only. PDF/A = new <name>.pdfa.pdf beside the source or in the target folder (created under the owner's home), the intermediate PDF of a non-PDF source removed; the source is never touched, and a run refuses rather than let the conversion replace an existing <name>.pdf of the user. Validation = DocumentValidationService::validate() with the configured profile; failed fails the run, warnings leave it succeeded with the findings.
  • 3.3 <category>workflow</category> in appinfo/info.xml.
  • 3.1 src/flowOperations.js (own webpack entry filinq-flow-operations.js, outside the shared chunks): registers the four operators by PHP class with window.OCA.WorkflowEngine.registerOperator; PDF/A and validation get a plain custom element (labelled input, hint linked via aria-describedby, CSS variables only) that stores the options JSON and emits update:model-value.
  • 3.2 Flow runs listing: FlowRuns index page over flowOperationRun (operation, file, status, reason, start, end; no add action) in the settings menu.
  • 4.1 PHPUnit for the backend (live verification on Postgres not done, see below).
  • 4.3 EN + NL for every new UI and server string (l10n/*.json, .js rebuilt). Theme: only Nextcloud CSS variables are used; not checked visually.
  • Docs: docs/features/flow-operations.md (text only; 4.4 stays open for the screenshots).
  • Register: run schema gains a pass transition (running → skipped), a failure-notification body naming operation, file and reason, and fileName as its object name.

Tasks left

  • 1.3 apply-blocker: the P1Y retention placeholder needs a selectielijst-manager-approved value; a lint that fails on the placeholder would turn the suite red until that sign-off, so it is not added here.
  • 4.1 live verification on Postgres (real rule, cron, notification), 4.2 Playwright spec, 4.4 screenshots, 4.5 openspec validate --strict and the hydra gates: live, e2e, screenshot and tooling tasks, not done in this build.
  • The operator element follows the web-component contract of the NC 32+ Flow UI (element, update:model-value with detail[0]); confirm it in the live check.

Tests

  • Added: 54 PHPUnit tests (tests/unit/Flow/*, AppInfo/InfoXmlTest, ValidationProfileResolverTest); one line broken per subject, each caught. 5 vitest tests (tests/vitest/flowOperations.spec.js); manifest fragment test updated for the new page and menu entry.
  • vitest: 756 passed. node tests/validate-manifest.js: PASS. test:l10n: OK (en/nl parity).
  • check:l10n-js reports the six .js catalogues stale on plain development as well: the generator drops their SPDX header. Inherited; the headers are kept here and only the new keys change.
  • Unit suite before: 6695 tests, OK. After: 6749 tests, OK (6 skipped, as before).
  • php -l, phpcs and phpstan clean on the changed lib files.

Generated by Claude Code

Four Nextcloud Flow file operations (anonymise intake, OCR, PDF/A copy,
validation checks), their registration listener, the queued job that runs
them as the file owner, and the loop guard on the operations' own output.

Assisted-by: ClaudeCode:claude-opus-5-5
Unit tests for the four Flow operations, the trigger, the run store, the
queued job, the registration listener and the workflow category; the
OCP WorkflowEngine contracts load lazily in the unit bootstrap.

Assisted-by: ClaudeCode:claude-opus-5-5
The Flow rule-builder script registering the four operations, with
labelled option editors for the PDF/A target folder and the validation
document type; the Flow runs listing; EN and NL strings.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
flowOperationRun and ocrResult changed shape on this branch without a
version bump, so an existing install would never import them. Both move
to 1.1.0 and the register to 8.56.0.

Assisted-by: ClaudeCode:claude-opus-5-5
Resolves the conflicts with development: l10n catalogues keep both sides'
strings, the register moves to v8.64.0 over development's v8.63.0, webpack
keeps both the flowOperations and verify entries, and ListenerRegistrarTest
counts both sides' listeners (26). FlowOperationRunRepository::save() moves to
openregister main's saveObject(ObjectSaveOptions) form, which development's
stubs now use; same register, schema, uuid and RBAC/multitenancy off.

Assisted-by: ClaudeCode:claude-opus-5-5
Register info: both lines' entries kept, version 8.67.0 above
development's 8.66.0. ListenerRegistrarTest counts both lines'
listeners (30).

Assisted-by: ClaudeCode:claude-opus-5-5
Register v8.68.0 keeps both sides: the line's flowOperationRun and
ocrResult 1.1.0 beside development's document and documentType schemas
and seeds.

Assisted-by: ClaudeCode:claude-opus-5-5
Resolves the conflicts in the register (both lines' schemas kept,
register 8.72.0) and in ListenerRegistrarTest (the two flow-operation
listeners and the PDF/UA attach listeners both counted).

Assisted-by: ClaudeCode:claude-opus-5-5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant