Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 139c681 The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Dismissed by the repository admin (phandpau) because soberm is out of office and all six findings from this review are fixed, answered and verified at the current head.
This review was submitted against 01042d7; the head is now db07a0b, which rebased onto main ac4d4a1 and addressed every item: the README command table and the --output json note, both registry entries marked aws: true (soberm was right that the flag never demands a Region, and the PR body has been corrected), the corrected mutating-routes and /api wording, --allow-origin validation with a canonical pass-through, the isRunnable prefix-fallback guard with a negative case, and the split of the two pending dashboard changesets.
Each thread carries an individual reply naming what changed, and the four new behaviours are mutation-checked. Nothing here is unanswered; the dismissal is about soberm being unavailable to re-review, not about setting the findings aside. Review is still sought from xyos.
The dashboard shipped as a core function with no caller: it was documented in a changeset and in core, but no task and no template script could run it. - `npm run dashboard` serves the Admin UI for the app it is run from, as a long-running child like the dev server, and `npm run dashboard:doctor` prints a diagnosis instead. Both go through a runner, so they use the app's own tsx like every other lifecycle command. - The runner passes core's flags in `DashboardOptions.argv`, because the runner's real argv carries the options JSON and `--telemetry-file`, which are not dashboard flags. The subcommand travels there too: core reads it as a leading positional. - `--port`, `--no-open` and a repeatable `--allow-origin` are the task's own options. `--profile` and `--region` are the runner's globals, which already reach the child as AWS_PROFILE and AWS_REGION, and the project root is the one the runner resolved, so core's `--project` is not re-exposed. - `--allow-origin` is checked here and passed on as a canonical origin. The dashboard compares against parsed origins and drops what it cannot parse, so `*`, a bare hostname or a value with a path would otherwise trust nothing silently and leave a proxied dashboard failing its mutation guard with no hint why. - Both entries are `aws: true`: the dashboard reads credentials and the stages the app has deployed, so it wants the inherited-AWS_REGION check and the warning that `--profile` blanks exported access keys. - Neither task has a structured result, so `--output json` is refused for both by the existing rule; the doctor's JSON report is not wired through. - A run that may not prompt (no TTY, `--no-input` or `CI`) spawns the runner with stdin ignored, so core's offer to install @aws-blocks/admin-ui takes its non-TTY branch and reports the manual install instead of waiting for an answer nobody can give. The runner cannot enforce that in a child otherwise: core decides by its own `process.stdin.isTTY`, which inherited stdio reports as a terminal. - Ctrl-C at that prompt exits 130 rather than 1. readline in raw mode rejects with an `AbortError` instead of raising SIGINT, so the runner maps that to the `operatorSignal` path `fail.ts` already turns into the documented interruption code. - `dashboard doctor` gets a `TASK_NAMES` entry, so every message naming it says `npm run dashboard:doctor`. Without it the rendering is `npm run dashboard doctor`, which npm passes to the `dashboard` script as an argument. - The default template gains `dashboard` and `dashboard:doctor`, and migrate renames a prerelease `blocks dashboard[ doctor]` script the way it renames the others. migrate adds no dashboard script to an app that has none, as with `config`. A new test holds every template's task script to a command the runner registers, so a script cannot again promise a command that does not exist. It keys on the `@aws-blocks/blocks/run` import rather than the invocation's exact spelling, and asserts its own detection still matches: a guard that silently selects no scripts asserts nothing, which is the failure this file exists to prevent. Its prefix fallback only shortens to a command that can take the leftover tokens, so a misspelled subcommand (`sandbox deplyo`) fails the guard rather than passing it and then exiting `unknown command`. The still-unreleased core changeset is narrowed to core's `dashboard()` script API, so the next changelog does not carry two conflicting descriptions of one feature. `parsePort` is exported from config.ts rather than duplicated for `--port`.
db07a0b to
139c681
Compare
dashboard in the cdk-blocks CLIdashboard as an app task
What
Registers
dashboardas an app task, and gives the default template thedashboardanddashboard:doctorscripts that make it reachable.Rebased onto #1610, which replaced the
cdk-blocksbin with@aws-blocks/blocks/runtask scripts. That was not a textual rebase: every user-facing string here named the removed bin, andtemplates-parity.test.tsdetected template commands by the literalcdk-blocks, so under #1610 it would have passed while asserting nothing. Details in the last section.#843shipped the Blocks Admin UI and core'sdashboard()entry point, but nothing could call it: no CLI command, no template script..changeset/dashboard-command.mdalready describesblocks dashboardand annpm run dashboardscript, so the released docs promise a command that does not exist. This closes that gap.Commands
npm run dashboardnpm run dev.npm run dashboard:doctorFlags on the command itself:
--port,--no-open, and a repeatable--allow-origin.--profileand--regionare the CLI's own global flags and already reach the child asAWS_PROFILE/AWS_REGION, and the project root is the one the CLI resolves, so core's--projectand its private copies of profile/region are deliberately not re-exposed.Notes for review
argv. Core parses the dashboard's flags fromDashboardOptions.argvand takesserve/doctoras a leading positional, so the runner passesargv: []orargv: ['doctor']. It must be explicit: the runner's real argv holds the options JSON and--telemetry-file, which are not dashboard flags, and core would otherwise read them as one.--output jsonis refused for both tasks by the existing rule (--output json is not supported for "npm run dashboard": it prints text only.), since neither has a structured result. The doctor's machine-readable report exists in core but is not wired through; happy to add it if you want it in this PR.aws: true. Corrected after review: an earlier version of this description claimed the flag "makes the CLI demand anAWS_REGION", which is wrong. Incontext.tsit gates only the shape check on an inheritedAWS_REGIONand the warning that--profileblanks exported access keys; it never requires a Region. The dashboard reads credentials and deployed stages, so it wants both."dashboard": "blocks dashboard"script is renamed like the others (RENAMED_ALIASES). migrate still adds no dashboard script to an app that has none, which is howconfigalready behaves, and the parity test'somitlist records that.parsePortis exported fromconfig.tsinstead of duplicating port validation for--port.New guard
templates-parity.test.tsholds every task script in every create-blocks-app template to a command the runner actually registers. That is the check that was missing here, and it fails on exactly this class of drift.It keys on the
@aws-blocks/blocks/runimport rather than on the invocation's exact spelling, and asserts that its own detection still matches something: a guard that silently selects no scripts asserts nothing, which is precisely what #1610 would have done to the previous version. Mutation-checked by pointingRUNNER_ENTRYat a name no template uses, which fails the vacuity assertion.Verification
npm run build,lint,lint:deps,check:api,check:exports-consistency,check:client-user-agent,check:packed-assets,check:runtime-guard,sync-docs:check: all pass.changeset-guardcommands,keywords-guard verify-discovery-tag, sink guards 35/35: all pass.npm run test:unit: 12835 tests, 12822 pass. The 3 remaining failures arebb-agent's Bedrock user-agent cases failing onCredentialsProviderErrorwith no credentials in the environment;packages/bb-agentis untouched here.migrate.test.ts57/57.argv: []fails the doctor test, and pointing the template script at a command that does not exist fails the parity test.Not verified: the dashboard was not started end to end from the CLI on this branch, since that needs
@aws-blocks/admin-uiinstalled in a scaffolded app. The tests assert the spawn, its options and its lifetime, not a live browser session.Rebase onto #1610
#1610deleted thecdk-blocksbin (packages/blocks/package.jsonnow exposes onlyblocks-generate-clientandblocks-vendorize, plus a./runexport). Converted here:operation:strings, the--output jsonrefusal, the runner docstring, the README rows and the changeset now namenpm run <task>.dashboard doctorneeded aTASK_NAMESentry inerrors.ts, following feat(blocks)!: run app tasks through package scripts instead of cdk-blocks #1610's convention for a two-word command (dev stop->dev:stop). Without it,blocksCommand('dashboard', 'doctor')rendersnpm run dashboard doctor, which npm passes to thedashboardscript as an argument. This was unverified until a mutation test showed removing the entry changed nothing, so the--output jsontest now asserts both messages and bothTry:lines.migrateneeded a second alias.RENAMED_ALIASESgainedcdk-blocks dashboard doctoras well: main's own round-trip test rewrites each template script into the prereleaseblocks <cmd>form and asserts migrate restores it, andblocks dashboard doctorwas not being renamed. That was caught by main's test, not predicted.help.test.tshardcodes the runnable task list, so both tasks were added to it; root help lists them underDevelopafterdev:stop.dashboard:doctoras well, andmigrate.test.ts'somitlist covers both, since migrate adds neither to an app that has none (as withconfig).