Skip to content

Resolve #2746: Validate explicit Cron distributed owner IDs#2758

Merged
ayden94 merged 1 commit into
mainfrom
issue-2746-validate-cron-distributed-owner-ids
Jul 14, 2026
Merged

Resolve #2746: Validate explicit Cron distributed owner IDs#2758
ayden94 merged 1 commit into
mainfrom
issue-2746-validate-cron-distributed-owner-ids

Conversation

@ayden94

@ayden94 ayden94 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Cron normalized user-provided distributed ownerId without validation, so invalid or empty owner IDs could enter Redis lock ownership state despite the distributed-lock contract. This PR validates explicit distributed.ownerId at the module configuration boundary before scheduler or Redis lifecycle setup.

Linked context: #2746

Changes

  • packages/cron/src/module.ts: Add normalizeDistributedOwnerId(...) that trims an explicit ownerId and rejects blank, empty, or non-string values during module option normalization, before scheduler or Redis lifecycle setup. Mirrors the existing normalizeRedisClientName(...) and assertValidDistributedLockTtlMs(...) boundary-validation pattern.
  • packages/cron/src/module.test.ts: Add regression tests covering blank, empty, and non-string explicit ownerId rejection during normalization, before Redis probe I/O, and during bootstrap; plus trim and valid-ownerId preservation tests.
  • packages/cron/README.md and packages/cron/README.ko.md: Document that fluo trims and validates explicit distributed.ownerId before scheduler or Redis lifecycle setup so invalid or empty owner identifiers cannot enter Redis lock ownership state.
  • .changeset/cron-validate-distributed-owner-ids.md: Patch changeset for @fluojs/cron because README documents distributed.ownerId and this is a behavior change at the module configuration boundary.

Testing

  • pnpm vitest run packages/cron — 92 tests passed (4 test files), including the new ownerId validation regression tests.
  • pnpm build — succeeded.
  • pnpm typecheck — succeeded.
  • pnpm lint — exited 0; no new diagnostics in changed files.

Release impact

  • This PR has consumer-visible release impact and includes a changeset.

Public export documentation

  • Changed public exports include a source-level summary. (normalizeCronModuleOptions already documented; no new public export added.)
  • Changed exported functions document matching @param / @returns tags where applicable.
  • Source @example blocks and README scenario examples still play complementary roles.

Behavioral contract

  • No documented behavioral contracts were removed without migration notes.
  • New behavioral contracts are documented in the affected package README.
  • Intentional limitations are explicitly stated (not silently removed).
  • Runtime invariants are covered by regression tests.

Platform consistency governance (SSOT)

  • SSOT English/Korean mirror structure remains synchronized for changed governance docs. (README.md and README.ko.md both updated.)
  • If platform contract docs changed, companion updates include discoverability/docs index, tooling or CI enforcement, and regression-test evidence. — Not applicable; no platform contract docs changed.
  • Any package README alignment/conformance claims are backed by the applicable platform harness tests. — Not applicable; no platform harness claims changed.

Closes #2746

Cron normalizes user-provided distributed ownerId without validation,
so invalid or empty owner IDs could enter Redis lock ownership state
despite the distributed-lock contract. Trim and validate explicit
ownerId during module option normalization, rejecting blank, empty,
or non-string values before scheduler or Redis lifecycle setup.

Closes #2746
@ayden94
ayden94 merged commit dedaf71 into main Jul 14, 2026
19 of 20 checks passed
@ayden94
ayden94 deleted the issue-2746-validate-cron-distributed-owner-ids branch July 14, 2026 01:37
This was referenced Jul 14, 2026
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.

[audit][area:infra-messaging] Validate explicit Cron distributed owner IDs (priority:p1)

1 participant