feat: include developer orgs with Runtime feature in console org commands#257
feat: include developer orgs with Runtime feature in console org commands#257
Conversation
…ands
`aio console org list` and `aio console org select` previously filtered
out every organization that was not `entp` (enterprise). App Builder
trial orgs are provisioned with `type: developer`, so trial users could
not see or select their own org from the CLI and were forced to download
a workspace.json from the Console UI as a workaround.
This change keeps enterprise orgs as-is and additionally includes
`developer` orgs that have the `RUNTIME` feature enabled, which is the
flag the Console sets on App Builder-eligible single-user orgs. The
feature flags are fetched per-org from
`/console/api/organizations/{orgId}/features`, with the base URL derived
from the active CLI environment (prod / stage).
- add `getOrgFeatures`, `hasRuntimeFeature`, and `getSelectableOrgs`
helpers on the base `ConsoleCommand`
- route `org list` and `org select` through `getSelectableOrgs`
- add unit tests + fixtures covering the developer-org path,
non-OK feature responses, and unknown-env URL fallback
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
/review |
There was a problem hiding this comment.
🤖 PR Reviewer
The diff introduces developer org support by filtering orgs based on a Runtime feature flag fetched from an external API. The implementation is clean and well-tested. A few minor issues worth noting: the URL construction via string replacement is fragile, network errors in getOrgFeatures are silently swallowed at the HTTP level (non-ok responses return [] without logging), and sequential awaits in getSelectableOrgs could be parallelized for performance.
📝 3 suggestion(s) - Please review inline comments below.
💡 How to re-trigger
Comment /review or /pr-reviewer on this PR
- add CONSOLE_API_URLS constant in src/config.js so getOrgFeatures reads the base URL directly instead of stripping '/console/projects' off OPEN_URLS - log non-ok feature responses at debug level so failures (401/403/500) are diagnosable instead of silently producing an empty list - parallelize the per-org RUNTIME feature checks in getSelectableOrgs with Promise.all so list/select latency does not scale linearly with the number of developer orgs
There was a problem hiding this comment.
🤖 PR Reviewer
All three previously raised suggestions have been addressed: CONSOLE_API_URLS is now stored directly in config (no fragile string replacement), non-ok HTTP responses are logged at debug level before returning [], and org feature checks are parallelized with Promise.all. The implementation is clean, well-tested, and follows existing patterns. No significant issues remain.
✅ LGTM! This PR looks good to merge.
💡 How to re-trigger
Comment /review or /pr-reviewer on this PR
Summary
aio console org listandaio console org selectpreviously filtered organizations down totype: 'entp'only. App Builder trial orgs are provisioned astype: 'developer', so trial users could not see or select their own org from the CLI and had to fall back to downloading aworkspace.jsonfrom the Console UI.This PR keeps enterprise orgs as-is and additionally surfaces
developerorgs that have theRUNTIMEfeature enabled — the same flag the Developer Console uses to gate App Builder access on single-user orgs. Feature flags are looked up per-org from/console/api/organizations/{orgId}/features, with the base URL derived from the active CLI environment (prod/stage), matching the existingOPEN_URLSconfig.Changes
src/config.js: addORG_TYPE_DEVELOPERandORG_FEATURE_RUNTIMEconstantssrc/commands/console/index.js: addgetOrgFeatures,hasRuntimeFeature, andgetSelectableOrgshelpers on the baseConsoleCommandsrc/commands/console/org/list.js: route the org list throughgetSelectableOrgssrc/commands/console/org/select.js: route interactive org selection throughgetSelectableOrgstest/__fixtures__/org/list.{json,txt,yml}: add adeveloper-type org rowtest/commands/console/index.test.js: cover the three new helpers, including non-OK feature responses, an unknown-env URL fallback, and a feature-lookup failuretest/commands/console/org/{list,select}.test.js: stubfetchfor the features endpoint and add coverage for the developer-org pathVerified
npm test(full suite, 100% coverage retained)npm run lint(no new warnings)AIO_CLI_ENV=stage ./bin/run console org list --json— the trialdeveloperorg now appears alongside enterprise orgsTest plan
npm testpassesaio console org listagainst a stage trial account shows thedeveloperorg withRUNTIMEfeatureaio console org listagainst adeveloperorg without theRUNTIMEfeature does not surface itaio console org selectinteractive prompt includes the same set of orgs asorg list