feat(web): Add the web setup and usage pages - #112
Merged
Merged
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Second and last implementation wave of the web console spec (#108), on top of #111: tasks T10 to T13 and T15 to T19. After this,
codedeck setupandcodedeck usage --webrun in the browser.What changes:
src/web/setup-page.tsandsrc/web/setup-routes.tsadd the browser setup: role bindings, efforts, orchestrator mode, sandbox and autocompact, prefilled from the current config. Routes:GET /api/setup/state,GET /api/setup/catalog,POST /api/setup/catalog/refresh,POST /api/setup/dry-run,POST /api/setup/apply. The config is read through the same batch path assetup --json(invalid config answers code 14, unreadable 15) and never replaced by defaults. Bodies are capped at 64 KiB. Off-catalog models only save with a per-role confirmation. Responses reuse thesetup --jsonenvelope (proposta,validacoes,mudancas,resultado).src/web/usage-page.tsandsrc/web/usage-routes.tsadd the usage page andGET /api/usage. The query goes throughbuildUsageQueryParams, so the page andcodedeck usagebuild identical parameters for the same filters.codedeck setupon an interactive terminal opens the web page.--tuikeeps the terminal wizard. Without a TTY it still exits 1 with the existing message, and--json,--dry-run,--non-interactivenever start a server. New flags:--port,--no-open.codedeck usage --webopens the usage page.usage <run-id>and--runkeepusage.get, with or without--web.codedeck uinow lists Review, Setup and Usage on the home.src/web/server.tsdrops the duplicate Host check noted in feat(web): Add the web console server, security and setup planner #111. The check now lives only incheckWebRequest..specs/features/web-console: 66 traceability rows moved to Implemented, and the coverage matrix points the page tests attests/setup-page.test.tsandtests/usage-page.test.ts.Verification on this branch (scoped batches, never the full suite):
Smoke test of the built
codedeck ui --no-open --port 3197with curl: the token URL answers 303 with an HttpOnly, SameSite=Strict cookie. Every page and GET API answers 200 with the cookie. A foreign Host answers 403, and so does a POST without the cookie or with a foreign Origin. A no-change dry-run answersunchanged, saved:false, and the config file hash stays the same.Mutation probes. Each fault was injected in place, then the file was restored and checked identical with
cmp:byOriginas requiredusage <run-id> --webskipsusage.getcodedeck uiinitReview: two read-only review rounds (claude opus) over the whole scope. Round one found that the catalog refresh button sent GET to the POST-only route, so the button and
setup --refreshwere broken. That is fixed and now asserted in both the controller test and the node:vm test, and both revert probes are killed. Round two confirmed the fix, found no other method mismatch, and mapped every P4 and P5 criterion to code and a test. WEB-82 now cites the README sections instead of line numbers.Known leftovers:
setup --refreshinjects a small script into the/setupresponse to trigger the catalog refresh after load. With the duplicate check gone, a bad Host combined with a malformed URL now answers 400 instead of 403. Both still refuse the request. Withusage --web --days 14, the Since date input shows empty because it receives a full ISO timestamp, but the query still applies it.