feat(intent): first-class document numbering DSL — number: {} field attribute (N1)#6382
Merged
Merged
Conversation
…ttribute (N1)
N1 of first-class document numbering (kf-catalog UPSTREAM_PLAN #11a): the DSL surface + model +
parse + validation. Lets a string field declare its numbering declaratively instead of the
hand-written placeholder action + generateNumber service-task delegate + per-suite Number entity.
- name: number
type: string
number: { series: SalesInvoice, format: "SI-{seq:07}", scope: [Company, year], resetOn: year, stampOn: issue }
- NumberIntent model (series, format, scope, resetOn, stampOn); FieldIntent.number (Gson binds it by
name, like dependsOn).
- Validation: number sits only on a non-key string field; series is required; stampOn is
create|issue; scope entries are `year` or sibling field/relation names; resetOn supports only
`year` and needs `year` in scope.
Runtime + generation are the following increments: N2 the per-tenant counter store + allocation/
format service, N3 the create/issue stamping + placeholder + idempotency, N4 scope/resetOn. See
PROPOSAL_NUMBERING.md. Decisions locked 2026-07-22: field-level attribute, platform per-tenant
counter table, both stampOn modes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 22, 2026
delchev
added a commit
that referenced
this pull request
Jul 22, 2026
… shell settings (N2) (#6384) N2 of first-class document numbering (kf-catalog UPSTREAM_PLAN #11a): the runtime the DSL (N1, #6382) will generate against, plus the application-shell settings surface. New module components/engine/engine-numbering: - DocumentNumberStore — a per-tenant DIRIGIBLE_DOCUMENT_NUMBERS table (via the tenant-routed default datasource + SqlFactory, like DIRIGIBLE_CONFIGURATIONS), keyed by (series, scope). allocate() is gap-free: the increment takes a row lock so concurrent allocations of the same counter serialize; the row is created on first use. - DocumentNumberService — allocate + the format grammar ({seq}/{seq:0N} zero-pad, {series}, and scope tokens {year}/{<Field>}) + scope-key derivation; plus list()/setNext() for management. - DocumentNumberEndpoint — /services/core/numbering (ADMINISTRATOR/OPERATOR): GET the tenant's counters, PUT the next value a (series, scope) counter will allocate. Application shell (resources-application) — a built-in "Document Numbering" Settings entry (next to Region & Language / Tenant Configuration): lists the counters and lets an admin set each series' next value (reset/seed a sequence, e.g. start invoices at 1000); read-only on a 403. Verified on a booted instance: GET [] then PUT {series:SalesInvoice,next:1000} (204) then GET shows counter 999 (next allocate = 1000); the settings page + appShell.js serve the new entry. DocumentNumberServiceTest covers the format renderer + scope-key. The SDK entry + generated stamping + idempotency are N3. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
delchev
added a commit
that referenced
this pull request
Jul 22, 2026
) * feat(numbering): per-tenant document-number counter store + runtime + shell settings (N2) N2 of first-class document numbering (kf-catalog UPSTREAM_PLAN #11a): the runtime the DSL (N1, #6382) will generate against, plus the application-shell settings surface. New module components/engine/engine-numbering: - DocumentNumberStore — a per-tenant DIRIGIBLE_DOCUMENT_NUMBERS table (via the tenant-routed default datasource + SqlFactory, like DIRIGIBLE_CONFIGURATIONS), keyed by (series, scope). allocate() is gap-free: the increment takes a row lock so concurrent allocations of the same counter serialize; the row is created on first use. - DocumentNumberService — allocate + the format grammar ({seq}/{seq:0N} zero-pad, {series}, and scope tokens {year}/{<Field>}) + scope-key derivation; plus list()/setNext() for management. - DocumentNumberEndpoint — /services/core/numbering (ADMINISTRATOR/OPERATOR): GET the tenant's counters, PUT the next value a (series, scope) counter will allocate. Application shell (resources-application) — a built-in "Document Numbering" Settings entry (next to Region & Language / Tenant Configuration): lists the counters and lets an admin set each series' next value (reset/seed a sequence, e.g. start invoices at 1000); read-only on a 403. Verified on a booted instance: GET [] then PUT {series:SalesInvoice,next:1000} (204) then GET shows counter 999 (next allocate = 1000); the settings page + appShell.js serve the new entry. DocumentNumberServiceTest covers the format renderer + scope-key. The SDK entry + generated stamping + idempotency are N3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * feat(numbering): sdk.numbering.DocumentNumbers — client SDK for first-class numbering (N3a) The SDK bridge from client-Java to the per-tenant counter runtime (N2, #6384): allocate the next gap-free number for a series and render it through the format. Both hand-written custom/ code and the forthcoming generated stamping (N3b) share one engine + one sequence + the same counter the application shell's Document Numbering settings manage. - DocumentNumbers.next(series, format, scope) / next(series, format) → the formatted number, via Beans.get(DocumentNumberService). - api-modules-java depends on engine-numbering (same precedent as engine-document for sdk.print). Verified: NumberingSdkIT drops a client-Java @controller calling DocumentNumbers.next and asserts a gap-free formatted sequence over HTTP (T-0001, T-0002) in the caller's tenant scope. N3b (generation): turn a `number: {}` field (N1, #6382) into the create-time stamp/placeholder + the issue-step stamp delegate + idempotency, calling this SDK. Depends on #6384. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
N1 of first-class document numbering (kf-catalog UPSTREAM_PLAN #11a) — the DSL surface + model + parse + validation. A string field declares its numbering declaratively, replacing the hand-written placeholder action +
generateNumberservice-task delegate + per-suiteNumberentity every document re-implements today.This PR (N1)
NumberIntentmodel (series,format,scope,resetOn,stampOn);FieldIntent.number(Gson binds it by name, likedependsOn).numberonly on a non-key string field;seriesrequired;stampOn∈create|issue;scopeentries areyearor sibling field/relation names;resetOnsupports onlyyearand needsyearin scope.IntentParserTest#firstClassNumberingParsesAndValidates(valid parse + the four rejections).Following increments
stampOn: create(insert stamp) +stampOn: issue(a generated stamp step the process references) + create-time placeholder + idempotency.scope/resetOn(year + field partitioning).Design + decisions (field-level attribute; platform per-tenant counter table; both
stampOnmodes) inPROPOSAL_NUMBERING.md. Purely additive (a new optional field attribute) — no behavior change until N2/N3 generate against it.🤖 Generated with Claude Code