Skip to content

fix(channels): make seed runnable + widen platform (unblocks DEV channel data load) - #2159

Merged
jung-thomas merged 1 commit into
DEVfrom
fix/channels-seed-normalize-cjs-and-platform-width
Sep 5, 2026
Merged

fix(channels): make seed runnable + widen platform (unblocks DEV channel data load)#2159
jung-thomas merged 1 commit into
DEVfrom
fix/channels-seed-normalize-cjs-and-platform-width

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Make the external-channels seed actually runnable + fix two dataset-vs-schema defects

Surfaced while loading the 238-channel research dataset into DEV so the P1–P3 channels surfaces can be tested. Three fixes, all needed before the seed completes.

1. Seed crashed under raw node — CJS file named .js under an ESM package

srv/lib/channels/normalize.js used require/module.exports but the package is "type":"module", so Node parsed it as ESM → ReferenceError: require is not defined. Vitest masked it (own loader) so tests were green while the seed had never run. Renamed to normalize.cjs; updated the 3 importers (scripts/seed-channels.cjs, test/channels-normalize.test.js, test/channels-seed.test.js).

2. Approximate GitHub-star counts into Integer columns

github_stars in the dataset is human-readable (~1.4K, ~3.2K, ~520) but githubStars/subscribers are IntegerSqlError: invalid number: not a valid number string '~1.4K'. Added parseApproxCount() (strips ~/commas, handles K/M/B) and applied to both count fields.

3. platform column too narrow for the data

platform : String(40) but 3 channels have legitimate 56-char values (Multi-Platform (LinkedIn / Bluesky / GitHub / X)) → inserted value too large. Widened to String(80). Regenerated com.sap.developers.ims.Channels.hdbmigrationtable to version=2 (non-lossy ALTER (platform NVARCHAR(80))) via the documented single-hana-task workaround, then a canonical two-task rebuild for db/last-dev/csn.json ordering.

Verification

  • channels-normalize + channels-seed + channel-submission-service13 passed.
  • Dry-run seed against DEV HANA: inserted=238.
  • Migration table: version=2, platform NVARCHAR(80), one ALTER in migration=2.

Deploy note

Widening platform needs the db module redeployed to DEV (applies migration v2) before the last ~69 rows — incl. the 3 wide-platform rows — can load. Per policy, deploy from fresh origin/DEV after merge, not this branch. 169/238 rows are already in DEV from the pre-fix partial run; the seed is idempotent, so the post-deploy re-run finishes the set.

Draft — targets DEV per branching policy. Not deployed.

…ion, widen platform

The channel seed script crashed under raw node: srv/lib/channels/normalize.js
used CommonJS (require/module.exports) but sat under a "type":"module"
package, so Node parsed it as ESM (ReferenceError: require is not defined).
Vitest masked this with its own loader, so tests passed while the seed never
ran. Renamed to .cjs and updated the 3 importers.

Two dataset-vs-schema defects surfaced while seeding DEV:
- github_stars values are human approximations ("~1.4K", "~3.2K") but
  githubStars/subscribers are Integer columns → SqlError 'not a valid number'.
  Added parseApproxCount() (handles ~, commas, K/M/B suffixes) and applied it
  to both count fields.
- platform : String(40) is too narrow for legitimate 56-char values
  ("Multi-Platform (LinkedIn / Bluesky / GitHub / X)") → widened to String(80).
  Regenerated the hdbmigrationtable (version=2, non-lossy ALTER) via the
  documented single-hana-task workaround, then canonical rebuild for last-dev.

Tests: channels-normalize/seed + channel-submission-service — 13 passed.
@jung-thomas
jung-thomas marked this pull request as ready for review September 5, 2026 08:20
@jung-thomas
jung-thomas merged commit 57089a5 into DEV Sep 5, 2026
6 checks passed
@jung-thomas
jung-thomas deleted the fix/channels-seed-normalize-cjs-and-platform-width branch September 5, 2026 08:20
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