Repository navigation
feat(serve): record approve and decline from the browser (#347) - #364
Open
shunsuke-shimomura wants to merge 1 commit into
Open
shunsuke-shimomura wants to merge 1 commit into
shunsuke-shimomura wants to merge 1 commit into
Conversation
`inka serve --as <approver>` turns recording on. A decision taken on the review surface appends the record `inka review` writes, through the same core operation; without `--as` no route writes and the Web UI stays read-only. The server enforces the conditions rather than trusting the page: - the approver and key id are fixed at startup; a request cannot name them; - a recording server refuses to start off a loopback address; - the API answers only requests addressed to this server, and a decision must carry the session token and, where the browser states one, this server's origin; - a decision names the view hash that was on screen and is refused, writing nothing, when the target's current hash differs. The review surface shows who decisions are recorded as and offers approve, decline (a reason is required) and skip under a local view shown in full, for targets that can take a decision. After a decision the page is read again. The end-to-end tests record against a throwaway copy of the aocs fixture. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014DUhbQ16uSDG5M4Lt9o3NM
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
shunsuke-shimomura
marked this pull request as ready for review
November 26, 2026 07:22
Member
Author
|
@coderabbitai review |
Action not completed
|
This branch has not been deployed
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.
Description
Closes #347. Part of #340. Stacked on #363.
The Web UI stops being strictly read-only: a decision taken on a local view appends the record
inka reviewwrites, through the same core operation (
review::decide, from #351).Server
inka serve --as <approver>(and--key-id) turns recording on and adds one route,POST /api/decisions.Without
--asthat route does not exist and every route is aGET, as before.GET /api/sessionsays who the server records as (reviewer: nullon a read-only server).for them.
--aswith a non-loopback--hostis refused at startup.Hostis one of theserver's loopback names, which defeats a foreign name resolved to the loopback address. A decision must also
carry the session token — 32 random bytes, new each run, readable only by a same-origin page — and, where the
browser sends
Origin, it must be this server.wire::decidereads the projectagain and records only if that is still the target's hash; otherwise it answers
changed(409) and writesnothing.
PUT,PATCHandDELETEare 405 everywhere.inka_core::wire, and their TypeScript types are generated like thepage's.
Page
recording as <approver>orread-only.Decline. Decline is disabled until the comment is non-blank. Skip stays where it was.
changedanswerreloads and stays on the target, saying nothing was recorded. A refusal is shown with its reason.
Test results
cargo test --workspace: all pass;cargo clippy --workspace --all-targets -- -D warnings: clean.npm run typecheck;npm test: 21 files, 138 tests;npm run e2e: 20 passed.--as; refusal off loopback; refusal of a missing orwrong token, of another site's
Origin, of another port's, and of a foreignHost(for reads too); refusal ofa stale hash with nothing written; a request that tries to bring its own approver; the record's form.
inka serve --ason a throwaway copy of the aocs fixture, so nothing is written into the repository.
Impact
inka serve --as,--key-id. A server started without them behaves as before.getrandombecomes a direct dependency ofinka-cli(it was already in the lock file).the page is the dev server's and a recording server would otherwise refuse it. While it runs, the dev server
is therefore an unguarded relay to a recording server; this is development only.
Supplementary information
The server records any decision the CLI's single-target form would: it does not refuse an approval on a
declined target, for instance. The page does not offer one; counting is eval's job, as in the CLI.
🤖 Generated with Claude Code
https://claude.ai/code/session_014DUhbQ16uSDG5M4Lt9o3NM