Skip to content

[7065] Typescript: Phase 2 — Domain Types#7067

Merged
n-lark merged 14 commits into
mainfrom
7065-typescript-2-domainTypes
Apr 20, 2026
Merged

[7065] Typescript: Phase 2 — Domain Types#7067
n-lark merged 14 commits into
mainfrom
7065-typescript-2-domainTypes

Conversation

@n-lark
Copy link
Copy Markdown
Contributor

@n-lark n-lark commented Apr 10, 2026

Description

See #7065

See comment here around some issues with optional properties

TLDR: Generated types mark every field as optional because the backend schemas don't specify which fields are required. Workaround: manually override the worst offenders in index.ts. Real fix: add required arrays to forge/db/views/*.js and regenerate.

Related Issue(s)

Resolves #7065

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@n-lark n-lark requested a review from cstns April 10, 2026 19:30
@n-lark n-lark self-assigned this Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.29%. Comparing base (7fc8fdf) to head (13d70be).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7067   +/-   ##
=======================================
  Coverage   76.29%   76.29%           
=======================================
  Files         405      405           
  Lines       20348    20348           
  Branches     4895     4895           
=======================================
  Hits        15525    15525           
  Misses       4823     4823           
Flag Coverage Δ
backend 76.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from 7018-typescript-1-tooling to main April 14, 2026 13:15
@cstns cstns linked an issue Apr 15, 2026 that may be closed by this pull request
6 tasks
Copy link
Copy Markdown
Contributor

@cstns cstns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see questions/issues raised below.

It's a good starting point for type defs but we're building on shaky ground.

I'm very keen on getting this in btw!

Comment thread frontend/src/types/generated.ts
Comment thread frontend/src/types/index.ts
Comment thread frontend/src/types/generated.ts
Comment thread frontend/src/types/generated.ts
Comment thread frontend/src/types/generated.ts
Comment thread frontend/src/types/generated.ts
Comment thread frontend/src/types/generated.ts
Comment thread scripts/dump-openapi.js
@cstns
Copy link
Copy Markdown
Contributor

cstns commented Apr 16, 2026

@n-lark, @ppawlowski was gracious to lend a hand and setup the ci step to check for TS spec drift we can work off that

Copy link
Copy Markdown
Contributor

@cstns cstns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an additional thing, the ci action is throwing an error due to diff's being detected in the /frontend/src/types/generated.ts file. For some reason this is not happening locally.

You can check the new ci action logs for more details

Comment thread scripts/dump-openapi.js Outdated
Comment thread scripts/dump-openapi.js
@n-lark
Copy link
Copy Markdown
Contributor Author

n-lark commented Apr 16, 2026

Hey @cstns @ppawlowski - First Piotr thank you for setting up the test 💪

Second, the test is failing and I think this is why, please advice on what you all think is best.

CI Drift Failure — EE Schema Problem

What's happening

dump-openapi.js boots the full app via forge() to grab the OpenAPI spec. During boot, forge/ee/index.js checks app.license.active() — without a valid EE license, the entire EE module is skipped. This means Pipeline, FlowBlueprint, MCP, DatabaseCredentials, and DatabaseTable schemas are never registered and don't appear in the generated types.

The committed generated.ts was produced with an EE license active, so it has all the types. When CI (or a dev without an EE license) regenerates, those types are missing — drift detected.

Solution

forge() accepts a programmatic config object (same pattern used by the test suite). Updated dump-openapi.js to boot with:

  • An enterprise-tier dev license (from test/unit/forge/ee/routes/mcp/index_spec.js) — unlocks all EE routes including MCP
  • tables: { enabled: true } — unlocks DatabaseCredentials/DatabaseTable schemas
  • In-memory SQLite + stub driver — no external DB or config file needed, works identically in CI and locally

Comment thread scripts/dump-openapi.js Fixed
Comment thread scripts/dump-openapi.js Fixed
@cstns cstns self-requested a review April 16, 2026 15:02
Copy link
Copy Markdown
Contributor

@cstns cstns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

@n-lark n-lark merged commit 3e7a2d6 into main Apr 20, 2026
38 of 40 checks passed
@n-lark n-lark deleted the 7065-typescript-2-domainTypes branch April 20, 2026 13:25
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.

Typescript: Phase 2 — Domain Types

4 participants