Skip to content

v5.1.0

Latest

Choose a tag to compare

@Ahoo-Wang Ahoo-Wang released this 24 Nov 11:42
b883a02

CosId 5.1.0

A minor release of CosId 5 (tag v5.1.0; the Docker image is tagged 5.1.0, 5.1 and latest). It adds one
feature: a periodic segment can write its period key in a pattern of its own, as the 4.x group.pattern did (#1501,
#1503). It also updates dependencies. Existing configuration, ids and storage formats are unchanged; the Java API and
the cosid.* configuration only gain additions.

CosId 5 的次版本:新增一项功能,周期号段可以用自己的格式书写期号,与 4.x 的 group.pattern 相同(#1501,#1503);并更新了依赖。
现有配置、ID 与存储格式不变;Java API 与 cosid.* 配置只有新增。

Released: 2026-11-24.

Upgrading from 5.0.x

Nothing to change: without the new key, ids are written as in 5.0.x.

  • GroupedCodecSpec has a new variant, FormattedDatePrefix (D40). A switch over GroupedCodecSpec without a
    default branch no longer compiles, as its Javadoc warns; applications build specs and rarely switch over them.
  • Replacing a custom Period with period.pattern. An application that wrote its periods in another pattern with
    a custom Period (for 4.x document numbers such as TO-261124-1) can now configure it instead. The custom period's
    store keys (261124) differ from the preset's (20261124), so the switch starts new keys and restarts the current
    period's sequence: make it between two periods, with every instance stopped.

New: the period key in a pattern of its own (#1501, #1503)

cosid:
  generators:
    "[trading.trade_order]":
      strategy: periodic-segment
      store: db
      period: YEAR_MONTH_DAY
      zone: Asia/Shanghai
      codec:
        - period: { pattern: yyMMdd }
        - prefix: "TO-"                  # TO-261124-1, TO-261124-2, … and TO-261125-1 the next day
  • Only the text changes. The store keys, GroupedId.period(), the migration key mapping and purge --before keep
    the preset (yyyy, yyyyMM, yyyyMMdd), and decode gives it back. So changing the pattern does not restart a
    sequence, and two-digit years never reach a store (D51).
  • The pattern must tell exactly the period's date: a YEAR_MONTH_DAY pattern needs the year, month and day, and
    none takes a field finer than its period; a wrong pattern fails the start. It is read strictly in the root locale
    (MMM is Nov everywhere), and yy reads as 2000 to 2099: a period it would read back as another is refused
    rather than issued. A fixed-length pattern such as yyMMdd decodes even without a delimiter. Preset periods only.
  • API: GroupedCodecSpec.FormattedDatePrefix(pattern, delimiter, value, outer) and
    GroupedCodec.datePrefix(Period, pattern, delimiter, inner, outer). Configuration:
    cosid.generators.<name>.codec[n].period.pattern.
  • cosid-migration config writes the 4.x group.pattern as period.pattern, so grouped text ids keep their 4.x
    form while plan reformats the store keys. A pattern that cannot write the 5.x keys (such as yyMM for days) is
    reported and left out, as is a change of locale for text fields such as MMM.

See how the period is written and the migration guide.

Dependencies

Gradle 9.9.2 (#1498). The documentation site: Vite 6.4.6 (#1492), mermaid 12.3.0 (#1431), source-map-js 1.2.4 (#1500)
and Node 24.22.3 for its build (#1495). Renovate: its action (#1499), and rules that keep deliberate pins (the 4.x
baselines, Java 21, Axon 4, the MyBatis of Activiti, the site's esbuild) from being proposed (#1502).

Release evidence

  • CI green on the release commit, the published jars in Maven and Gradle applications on Spring Boot 4.1.2 and in a
    plain-Java consumer without a BOM (CI job published-jars).
  • No release gate run: the one code change adds a codec variant. The generation paths the gate measures and the
    existing grouped codecs are unchanged; the new variant computes a period's text once per period, outside the per-id
    path.