Repository navigation
feat(http): the reviewer check reads the principal's kind - #785
Merged
Merged
Conversation
ajianaz
force-pushed
the
feat/principal-aware-policy
branch
2 times, most recently
from
December 5, 2026 01:28
db16e81 to
c7b9ad3
Compare
ADR-0022, slice 14. Who may set a review state and who may make or read a checkpoint is the kind of the principal: a person may, an agent never may, whatever its actor is called. The setter's refusal and the list route's canReview are one rule, and the checkpoint create and state routes read the same kind, so meldframe-http no longer holds a reviewer list. MELDFRAME_REVIEWERS moves into the development-token adapter. It lists the development actors that are people (DevPersons, DevTokens::with_persons in meldframe-auth); every other development token is an agent. It is read in one place in the server binary, keeps its parser and its limits, and composes with MELDFRAME_DEV_TOKEN_KINDS, which is the client kind. scripts/dev.sh gets the two lines that name the dev identity from scripts/dev-env.sh, so the editor of just dev is a person. Tests: the parser and ADR-0021's table of actors as development tokens, the table over REST on the real server, the real binary with good and bad lists, the dev script in a clean shell and the server on what it exports, and the review setter for a person and for an agent. Docs say "a person" where the reviewer rule said a listed actor. Signed-off-by: Anaz S. Aji <12648688+ajianaz@users.noreply.github.com>
ajianaz
force-pushed
the
feat/reviewer-by-kind
branch
from
December 5, 2026 08:16
e0a5f09 to
14e31a4
Compare
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.
What
ADR-0022, slice 14: the reviewer check moves to the kind. Who may set a review state of a batch, and who may make or read a checkpoint, is now the principal's kind: a person may, an agent never may, whatever its actor string says.
MELDFRAME_REVIEWERSis no longer read bymeldframe-http; it lives in the development-token adapter and lists the development actors that are people.Stacked on #783 (slice 15a,
feat/principal-aware-policy): the base of this pull request is that branch, so the diff holds this slice only. If #783 merges first, this branch is rebased ontodevelopand the base is changed by its owner.Why
ADR-0021 denied by default and let only actors named in
MELDFRAME_REVIEWERSreview, becausePrincipalhad no kind and an actor string cannot be trusted (claude,Agent:x,person:x). The kind exists since slice 2 andPrincipal::policyreads it since 15a, so the check can say what it means. An agent that holds every tier and carries a person's actor string is still an agent, which a test of the real server shows. The sign-in session (slice 11b) will decide the kind by its own authenticator, and nothing in this slice has to change for it.One logical change: the rule, the adapter that now owns the list, and the script and docs that name the dev identity.
Changes
meldframe-auth:DevPersons(dev_persons.rs, the parser of the oldReviewers: trimmed, empty entries ignored, a bad entry or more than 32 an error that names the entry's number and never its text) andDevTokens::with_persons, which makes a token whose actor is listed aPersonand leaves every other token anAgent(exact, case-sensitive match of the whole actor; the client kind ofMELDFRAME_DEV_TOKEN_KINDSis kept in either order).meldframe-http:Setter::can_reviewisas_person()plus the registry's policy forbatch_review; the setter'sforbiddenand the list'scanRevieware that one rule. The checkpoint create and state routes read the kind the same way (canCreateagrees).activity/reviewers.rsand the checkpointMayclosure are gone, andService::with_reviewtakes only the policy.apps/server:dev_persons_from_envreads the variable once, before anything opens, serving or not. A list that names no token's actor prints a warning that names the variable only.scripts/dev-env.sh(new) andscripts/dev.sh:dev_export_identitylists the dev actoragent:devfirst and keeps a list already in.env, so the editor ofjust devis a person.docs/epics.md, GLOSSARY Review,AGENTS.md(the variable's meaning and a slice 14 entry),docs/architecture.md,docs/collab-ux.md,docs/error-codes.md,docs/quickstart-agent.md,.env.example, thejustfilecomment, two feature comments and the header ofm1-demo.mjs.canReviewis still a bool), sotools/check-protocol.shwas not needed and the web client is unchanged.Decided where the ADR was silent: the variable keeps its name and means "development actors that are people"; it is orthogonal to
MELDFRAME_DEV_TOKEN_KINDSand the two compose; a listed actor that no token has is a warning, not an error; the kind rule also covers the checkpoint routes, because their closure was built from the same list; a person still needs the registry's policy forbatch_reviewto let the call through; two tokens with one listed actor in two workspaces are two people. I found no sentence in ADR-0021 or the epic that worded the reviewer rule as "owner"; the rule said "a person" and "an actor listed inMELDFRAME_REVIEWERS", and both are corrected. The "owner" of GLOSSARY Approval and Policy and ofdocs/error-codes.mdis the answer to an Ask, which slices 17 and 21 change.Testing
New tests:
crates/core/meldframe-auth/tests/dev_persons.rs, 15 tests, native and under WASM (cargo test --target wasm32-unknown-unknown --tests -p meldframe-auth, 15 passed there): the parser, ADR-0021's table of actors (a person's name,agent:,claude,Agent:x,person:x) as development tokens, near misses, workspace, actor and tiers kept, the client kind kept in both orders, a person's Ask read as Auto.apps/server/tests/reviewer_kind.rs, 5: over REST on the real server, no agent sets a review whatever tiers it holds or what it is called, an agent that borrows a person's actor is judged by its credential, a person sets, flags and clears and the same state sends no frame, a refused agent writes nothing and sends no frame, andcanReviewreaches the app layer.apps/server/tests/reviewer_binary.rs, 8: the real binary: listed means person, other means agent, exact match, an unset or empty list, a list that names no token (warning, no entry or token echoed), the list and the client kinds compose, a bad list (cap, malformed actor, hidden characters, not text) stops the start serving or not and repeats no entry.apps/server/tests/dev_script.rs, 3:scripts/dev-env.shrun in a clean shell and the real binary started on what it exports: the dev editor may review and make a checkpoint, an agent with a token of its own may not, a list from.envis kept.scripts/dev-env-test.sh, 10 checks, added tojust check.setter.rs,probing.rs,checkpoint_routes.rs,principal_routes.rsand the activity and checkpoint worlds;reviewers.rsis replaced byreviewer_kind.rs.Hand mutants, each of which fails at least one test (and each file restored): the setter reading the actor string, the setter letting an agent through,
with_personslisting nobody,with_personslisting every token, the checkpoint create gate reading the actor string,dev-env.shnot listing the dev actor (this one failsdev_script.rsanddev-env-test.sh).Commands run, all green on the head commit:
cargo fmt --all --check;cargo clippy --workspace --all-targets -- -D warningscargo test --workspace: 4707 passed, 0 failed (684 test binaries);cargo test -p meldframe-server: 762 passed, 1 ignored (112 binaries); the Postgres tests skip withoutDATABASE_URL, as everywherecargo test -p meldframe-server --no-default-features: 356 passed; with--features activityonly: 520 passed;cargo buildofmeldframe-httpandmeldframe-serverwith no default features, withactivityand withcheckpointscargo xtask deps-check,mm-check(also--base),size-check(also--base),toolkit-swap --graph-only,portable-check;sh scripts/ci/principal-mint.sh;sh scripts/ci/selftest.sh;bash scripts/portable-shell-test.sh;bash -nof the three scriptsNot run:
packages/web-panels/scripts/activity-e2e.mjsand the other browser scripts (they need Playwright, a server and two tokens; their command lines still hold because the variable is read as before),just checkas a whole,just wasm-testbeyondmeldframe-auth,cargo xtask build-matrixand the Postgres tests. Not covered by this slice: a sign-in session is not a person yet (slice 11b), there is no role field, and thecheckpointsfeature still listsactivitythough the checkpoint code no longer reads it.Cora (agent, local): the deterministic pass only,
cora review --base feat/principal-aware-policy --no-llm, no issues after two false positives on comments (a "hardcoded secret" match ontoken:workspace:actorwording) were reworded; the agent review (cora mcp,review_prepareandreview_finalize) was not run, because no independent reviewer was available to the session that wrote this change, so no independent review is claimed.