Skip to content

feat(intent): function: Snapshot — generated read-only versioned record copies#6374

Merged
delchev merged 1 commit into
masterfrom
feat/intent-snapshot-function
Jul 22, 2026
Merged

feat(intent): function: Snapshot — generated read-only versioned record copies#6374
delchev merged 1 commit into
masterfrom
feat/intent-snapshot-function

Conversation

@delchev

@delchev delchev commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

A sibling of function: Attachment (#6371) for system-generated copies — the printed Sales-Invoice stored on issue, vs a user-uploaded Purchase-Invoice scan. Same composition-child + CMS + file-metadata machinery, but read-only and versioned.

Stacked on #6371. Until it merges, this diff also shows #6371's backend files; the Snapshot-specific change is 5 files (parser, model, EdmIntentGenerator, controller template, test). Rebase to a clean diff once #6371 lands.

Changes

  • IntentParsersnapshot added to ENTITY_FUNCTIONS.
  • EntityIntentisSnapshot() + isFileChild() (attachment or snapshot — shared metadata injection).
  • EdmIntentGenerator — a file-child gets the injected file-metadata columns + synthesized Id PK + audit (now keyed on isFileChild). A Snapshot additionally gets a read-only, major Version column carrying the new DOCUMENT_VERSION widget (the copy's sequence within its master — for special treatment in forms / print templates), and is marked attachmentReadOnly="true" alongside attachmentEntity.
  • EntityController template — the /upload verb is gated off when attachmentReadOnly; a Snapshot controller exposes download + list only (copies are created server-side, never uploaded/deleted by the user). The read-only Harmonia Files panel (feat(harmonia): Attachments / Snapshot files panel (function:Attachment UI) #6373) already keys on attachmentReadOnly.

Verified

  • EdmIntentGeneratorTest: injected metadata + Id + Version/DOCUMENT_VERSION + attachmentReadOnly.
  • A generated CompanySnapshotController has @Get /{id}/download and no @Post /upload; the model carries Version (DOCUMENT_VERSION) + attachmentReadOnly=true.

Context

Part A of the Sales-Invoice snapshot flow (design in kf-catalog UPSTREAM_PLAN #11). Follow-ups: C server-side print render, D generateSnapshot BPM serviceTask + delegate (mint on issue, number stays / version increments on amend — see #11a first-class document numbering).

Depends on #6371 (+ #6370 merged, #6373 UI panel).

🤖 Generated with Claude Code

…rd copies

A sibling of function: Attachment (#6371) for SYSTEM-GENERATED copies (e.g. the printed
invoice stored on issue) rather than user-uploaded files. Same composition-child + CMS +
file-metadata machinery, but read-only and versioned.

- IntentParser: `snapshot` added to ENTITY_FUNCTIONS.
- EntityIntent: isSnapshot() + isFileChild() (attachment or snapshot — shared injection).
- EdmIntentGenerator: a file-child gets the injected metadata columns + synthesized Id + audit
  (now keyed on isFileChild). A Snapshot additionally gets a read-only, major `Version` column
  carrying the new DOCUMENT_VERSION widget (the copy's sequence within its master, for special
  treatment in forms/print), and is marked attachmentReadOnly="true" alongside attachmentEntity.
- EntityController template: the `/upload` verb is gated off when attachmentReadOnly — a Snapshot
  controller exposes download + list only (no upload; copies are created server-side by the
  forthcoming generateSnapshot serviceTask). The read-only Harmonia Files panel (#6373) already
  keys on attachmentReadOnly (download only, no upload/remove).

Verified: EdmIntentGeneratorTest (metadata + Id + Version/DOCUMENT_VERSION + attachmentReadOnly);
a generated CompanySnapshotController has @get /{id}/download and NO @post /upload, and the model
carries Version(DOCUMENT_VERSION) + attachmentReadOnly=true.

Part A of the Sales-Invoice snapshot flow. Follow-ups: C (server-side print render) and D
(generateSnapshot BPM serviceTask + delegate, mint on issue). Depends on #6371.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@delchev
delchev force-pushed the feat/intent-snapshot-function branch from 01d45f1 to 9b0144c Compare July 22, 2026 12:10
delchev added a commit that referenced this pull request Jul 22, 2026
…opy on issue

Part D of the Sales-Invoice snapshot flow: generates the JavaDelegate a process wires as a
`delegate:` service task to mint an immutable printed copy of a document on issue (the number
stays across amendments; only the snapshot Version increments).

- SnapshotSupport builds the `snapshots` glue collection — one descriptor per function: Snapshot
  child of a DOCUMENT master (which has a PrintFeeder to render from): master, master PK (the
  process variable), the snapshot entity/perspective/master-FK, language.
- GlueIntentGenerator emits the `snapshots` collection into the .glue.
- generateUtils adds the `snapshots` case (sanitizes the perspective → javaPerspective, its own loop
  like printFeeders/settlements).
- Snapshot.java.template generates gen/events/<Master>SnapshotGenerator.java: reads the master id
  from the process variable, reuses the master's generated PrintFeeder (same gen.events package) for
  the {document, items} payload, renders server-side via sdk.print.Print (#6376), stores the PDF via
  sdk.cms.Attachments (#6370), and writes a <Snapshot> row with Version = max existing + 1 (gap-free
  — snapshots are immutable). Bound by the BPMN via the existing `delegate:` (flowable:class) path —
  no new parser/BPMN wiring, and ServiceTaskHandlerGenerator already skips a delegate: task.

Verified: on the SalesInvoice document master with a function: Snapshot child + a `generateSnapshot`
delegate step, the .glue carries the snapshots descriptor, gen/events/SalesInvoiceSnapshotGenerator
.java is emitted, and it compiles cleanly into the client bean container (538 beans, no javac errors).

Depends on: #6374 (function: Snapshot type — the PR base), #6376 (sdk.print.Print), #6371/#6370
(sdk.cms.Attachments). Follow-up: KF adoption wires generateSnapshot into the SalesInvoice process
after markIssued + the Confirm/Amend loop; a full process-run e2e mints the first snapshot on issue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@delchev
delchev merged commit f6c00cd into master Jul 22, 2026
10 checks passed
@delchev
delchev deleted the feat/intent-snapshot-function branch July 22, 2026 12:16
delchev added a commit that referenced this pull request Jul 22, 2026
…opy on issue (#6377)

* feat(intent): function: Snapshot — generated read-only versioned record copies

A sibling of function: Attachment (#6371) for SYSTEM-GENERATED copies (e.g. the printed
invoice stored on issue) rather than user-uploaded files. Same composition-child + CMS +
file-metadata machinery, but read-only and versioned.

- IntentParser: `snapshot` added to ENTITY_FUNCTIONS.
- EntityIntent: isSnapshot() + isFileChild() (attachment or snapshot — shared injection).
- EdmIntentGenerator: a file-child gets the injected metadata columns + synthesized Id + audit
  (now keyed on isFileChild). A Snapshot additionally gets a read-only, major `Version` column
  carrying the new DOCUMENT_VERSION widget (the copy's sequence within its master, for special
  treatment in forms/print), and is marked attachmentReadOnly="true" alongside attachmentEntity.
- EntityController template: the `/upload` verb is gated off when attachmentReadOnly — a Snapshot
  controller exposes download + list only (no upload; copies are created server-side by the
  forthcoming generateSnapshot serviceTask). The read-only Harmonia Files panel (#6373) already
  keys on attachmentReadOnly (download only, no upload/remove).

Verified: EdmIntentGeneratorTest (metadata + Id + Version/DOCUMENT_VERSION + attachmentReadOnly);
a generated CompanySnapshotController has @get /{id}/download and NO @post /upload, and the model
carries Version(DOCUMENT_VERSION) + attachmentReadOnly=true.

Part A of the Sales-Invoice snapshot flow. Follow-ups: C (server-side print render) and D
(generateSnapshot BPM serviceTask + delegate, mint on issue). Depends on #6371.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(intent): generateSnapshot delegate — render + store a document copy on issue

Part D of the Sales-Invoice snapshot flow: generates the JavaDelegate a process wires as a
`delegate:` service task to mint an immutable printed copy of a document on issue (the number
stays across amendments; only the snapshot Version increments).

- SnapshotSupport builds the `snapshots` glue collection — one descriptor per function: Snapshot
  child of a DOCUMENT master (which has a PrintFeeder to render from): master, master PK (the
  process variable), the snapshot entity/perspective/master-FK, language.
- GlueIntentGenerator emits the `snapshots` collection into the .glue.
- generateUtils adds the `snapshots` case (sanitizes the perspective → javaPerspective, its own loop
  like printFeeders/settlements).
- Snapshot.java.template generates gen/events/<Master>SnapshotGenerator.java: reads the master id
  from the process variable, reuses the master's generated PrintFeeder (same gen.events package) for
  the {document, items} payload, renders server-side via sdk.print.Print (#6376), stores the PDF via
  sdk.cms.Attachments (#6370), and writes a <Snapshot> row with Version = max existing + 1 (gap-free
  — snapshots are immutable). Bound by the BPMN via the existing `delegate:` (flowable:class) path —
  no new parser/BPMN wiring, and ServiceTaskHandlerGenerator already skips a delegate: task.

Verified: on the SalesInvoice document master with a function: Snapshot child + a `generateSnapshot`
delegate step, the .glue carries the snapshots descriptor, gen/events/SalesInvoiceSnapshotGenerator
.java is emitted, and it compiles cleanly into the client bean container (538 beans, no javac errors).

Depends on: #6374 (function: Snapshot type — the PR base), #6376 (sdk.print.Print), #6371/#6370
(sdk.cms.Attachments). Follow-up: KF adoption wires generateSnapshot into the SalesInvoice process
after markIssued + the Confirm/Amend loop; a full process-run e2e mints the first snapshot on issue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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