Skip to content

Publish HarmonyOS SDK 0.5.0 - #27

Merged
Fiona2016 merged 6 commits into
publishfrom
main
Aug 18, 2026
Merged

Publish HarmonyOS SDK 0.5.0#27
Fiona2016 merged 6 commits into
publishfrom
main

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

Syncs publish with main for the 0.5.0 release.

Contents

PR Change
#24 Bound upload bursts; align batching configuration with the Android/iOS/Flutter SDKs
#26 Version bump to 0.5.0 across the five packages, with changelogs

Release note

Breaking: ConfigurationBuilder.setBatchUploadFrequencyMs is removed. Upload
pacing now uses UploadFrequency, BatchSize and BatchProcessingLevel — the
same enums, case names and values as the other platform SDKs.

// before
.setBatchUploadFrequencyMs(5000)
// after
.setUploadFrequency(UploadFrequency.RARE)

Two defaults changed for apps that never set them: upload cycle interval 5 s → 2 s,
batch roll window 5 s → 10 s. Both now match the other platforms.

Also fixes three delivery defects found in review: a force-flush could cancel the
intake retry backoff, the deferred-upload process could claim a batch the main
process was still appending to, and BatchProcessingLevel was ignored by the
deferred and flushAndWait drains.

After merge

Publishing is triggered by tagging the merged commit:

git tag harmony-sdk-v0.5.0 <merge-sha> && git push origin harmony-sdk-v0.5.0

The workflow validates that the tag version matches flashcat-core's package
version (0.5.0) and that the tagged commit is contained in publish.

Verification

  • ./scripts/ci-check.sh on the merged tree — ALL CHECKS PASSED (148 tests, HAR
    build, demo HAP build, ArkTS unit-test type check).
  • Not verified on a physical device.

Event uploads share the uplink with the app's own requests. Two properties of
the drain loop decided how much they interfered with it, and neither was
reachable from configuration:

- The batch roll window was a fixed 5 s constant, so events could not be packed
  into fewer, better-compressed requests.
- The drain loop had no bound at all: one successful upload immediately claimed
  the next batch, so a backlog accumulated while offline went out as a single
  uninterrupted burst.

Add setBatchWindowMs and setMaxBatchesPerCycle to ConfigurationBuilder. These
mirror Android's BatchSize and BatchProcessingLevel, as continuous values rather
than enums, following setBatchUploadFrequencyMs which predates them. The
per-cycle bound defaults to 10, matching BatchProcessingLevel.MEDIUM.

Enforce the bound at every scheduling path, not only the timer. triggerNow()
re-enters the drain directly on each force-flushed error or crash write, so a
scheduler pacing only its own timer would drop the bound under exactly the load
that needs it. A cycle that spends its budget records cycleYieldUntilMs, and both
triggerNow() and the coalesced-retrigger path floor their delay at it. The first
force-flush of a cycle with budget left is still immediate, which is what the
call exists for.

batchWindowMs also gates the cross-process claim guard for batches created by
the deferred-upload process, so both processes must be built from the same
Configuration. Noted on the field and in the README.
The Android, iOS, and Flutter SDKs all express upload pacing through the same
three enums — UploadFrequency, BatchSize, BatchProcessingLevel — with identical
case names and identical values. HarmonyOS was the only platform that did not,
exposing a millisecond setter instead, so tuning advice written for one platform
had to be translated by hand for this one.

Adopt the shared vocabulary: add the three enums with the values the other SDKs
use, and drop setBatchUploadFrequencyMs. Defaults now match the Android
DEFAULT_CORE_CONFIG exactly (AVERAGE / MEDIUM / MEDIUM), so the same setting
produces the same behaviour on every platform.

This removes the range clamping the millisecond setters needed: an enum cannot
carry an out-of-range value, so the checks had nothing left to guard. A test
pins the enum values against the other SDKs, since silent drift there would
invalidate cross-platform tuning advice without failing anything else.

Also fixes the deferred-upload pipeline, which built its FilePersistenceStrategy
without a batch window and so used the module fallback rather than the
configured one. The cross-process claim guard is derived from that window: with
the main process on a longer window, the deferred process would consider a batch
claimable while the main process was still appending to it. Both pipelines now
take the configured value, and the module fallback is defined as the configured
default so an omitted argument cannot silently change behaviour.

BREAKING CHANGE: setBatchUploadFrequencyMs is removed. Replace with
setUploadFrequency(UploadFrequency.RARE) for the previous 5 s default, or drop
the call to take the new AVERAGE default.
- UploadScheduler: floor every scheduling path at the retry backoff via a
  single scheduleAt choke point. A force-flush (an error/crash write, a
  manual flush, or backgrounding) can no longer cancel an in-progress
  backoff and retry a failing intake at the app's error rate.
- Backgrounding and manual flushes waive the cycle budget: the process is
  about to freeze (a frozen process never fires the timer the budget would
  impose), or the app explicitly asked to ship now. The backoff is never
  waived.
- flushForWork and flushAndWait default to the configured
  BatchProcessingLevel instead of a hard-coded 20, so the configured level
  bounds the deferred-upload and flush drains too.
- FilePersistenceStrategy: the foreign-batch claim guard floors at the
  largest supported batch window, so independently configured processes
  can no longer claim a batch another process is still appending to.
- Keep the new public enums and their setters in the obfuscation keep
  lists so release builds resolve them.
- Document the removed setter, the migration path, and the two default
  changes in the changelog.
Bound upload bursts and align batching config with the other platform SDKs
Bumps the five SDK packages to 0.5.0 and records the changes shipped since
0.4.0.

The minor rather than the patch position: this release removes
`ConfigurationBuilder.setBatchUploadFrequencyMs` and changes two defaults that
apps inherit without asking for them. A patch number would hide both from anyone
who upgrades without reading the changelog.

Version numbers live in three places — the oh-package manifests with their
inter-package pins, Version.ets, and the test fixtures carrying the version
string — and all three move together here.
release(harmony): SDK 0.5.0 — cross-platform batching configuration
@Fiona2016
Fiona2016 merged commit 9ef12fc into publish Aug 18, 2026
6 checks passed
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