Skip to content

feat(intent): generates completion hook — sourceStatus flips the source after the target is created#6237

Merged
delchev merged 1 commit into
masterfrom
feat/generates-completion-hook
Jul 10, 2026
Merged

feat(intent): generates completion hook — sourceStatus flips the source after the target is created#6237
delchev merged 1 commit into
masterfrom
feat/generates-completion-hook

Conversation

@delchev

@delchev delchev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

generates: (create-from) gains an optional sourceStatus: <EntityStatus seed id> — the completion hook the flow was missing:

generates:
  - name: invoice-from-proforma
    from: ProformaInvoice
    to: SalesInvoice
    map: { Customer: Customer, Company: Company }
    defaults: { date: now }
    sourceStatus: 3        # the proforma flips to INVOICED once the invoice exists

Until now the create-from link was one-way: the target was created through its repository (numbering, status init, calculated fields all fire), but the source stayed in its pre-generation status and the flip was a manual step.

Semantics

A workflow-style system write, consistent with the setter delegates: the source's EntityStatus FK is set after the target (and its cloned items) are saved, persisted via updateWithoutEvent — no -updated re-fire, so onUpdate reactions stay quiet — and the source's -transitioned topic is published, so posting glue and integrations observe the transition like any other status change.

  • Parser: sourceStatus requires the from entity to declare a function: EntityStatus relation.
  • Glue: pre-resolves the FK property (PascalCase) + seed id; empty when the hook is absent, so existing generates blocks generate byte-identical code.
  • Template: the flip renders after the save + items clone in Generate.java.template.

Verification

  • Live end-to-end on a generated application: proforma → Generate Invoice → invoice created → proforma Status == 3 (INVOICED).
  • GlueGeneratesTest: the resolved hook fields and the no-hook default (guards the byte-identical path for existing blocks). Full engine-intent suite 114/114.
  • Docs: intent-assistant-guide.md, module README (the item moves out of the Planned list).

🤖 Generated with Claude Code

…ce after the target is created

generates: gains an optional sourceStatus: <EntityStatus seed id> - the
completion hook the create-from flow was missing: once the target
exists, the SOURCE document reaches its post-generation status (the
canonical case: a proforma flips to INVOICED the moment the invoice is
generated; previously that link was one-way and the flip was manual).

A workflow-style system write: persisted via updateWithoutEvent (no
-updated re-fire, onUpdate reactions stay quiet) and the source's
-transitioned topic IS published, so posting glue / integrations can
observe the transition. Parser requires the from entity to declare a
function: EntityStatus relation; the glue pre-resolves the FK property
and seed id; the Generate template emits the flip after the save (and
after the items clone).

Verified live: proforma -> Generate Invoice -> invoice created ->
proforma Status == 3 (INVOICED). GlueGeneratesTest covers the glue
resolution + the no-hook default; full engine-intent suite 114/114.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@delchev delchev merged commit 89a5282 into master Jul 10, 2026
10 checks passed
@delchev delchev deleted the feat/generates-completion-hook branch July 10, 2026 14:19
delchev added a commit that referenced this pull request Jul 10, 2026
…nd function: Calendar (#6238) landed (#6257)

Co-authored-by: Claude Fable 5 <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