Skip to content

Local review loop without re-pinning; plan-feature ignores incidental words; booking and credits recipes (#932) - #942

Merged
jimhoyd merged 3 commits into
mainfrom
claude/local-loop-932
Sep 29, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/local-loop-932

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #932

1. The local edit loop needs no new pin (--local-review)

validate, test, routes and audit accept --local-review. It applies only when the operator gave no pin: no --policy, URLCODE_POLICY or PROJECT_SHA256. Then the CLI:

  • computes the project's current revision (prepareFunctionSnapshot, the same value urlcode permissions prints) and passes it to loadOperatorHost as the host's pin, the same way a verified --policy revision is passed;
  • defaults --origin to http://localhost;
  • prints {"event":"local_review","revision","origin","note"} on stderr, so the output shows the run was not a reviewed one.

The generated npm scripts (validate, test, routes, audit) and the starter Makefile pass the flag. dev and start do not. The loop is documented in docs/EXTENSIONS.md "The local review loop", with notes in TOOLING, LOCAL-DEVELOPMENT, AI-AUTHORING, FRAMEWORK, MONITORING/OBSERVABILITY (the new event), the starter README/AGENTS.md and llms.txt.

Why the approval boundary holds

  • Serving refuses it. Only the four non-serving commands accept the flag. serve, dev, benchmark, explain and every other command refuse it with local-review-unsupported. A served runtime is still pinned only by the operator, and dev's start is still strict.
  • Nothing is persisted. The derived pin lives in the process for one run. No policy, environment variable or file is written, so the next serve refuses until the operator pins a revision.
  • An operator pin wins. If --policy, URLCODE_POLICY or PROJECT_SHA256 is present, the flag does nothing. A stale policy still gives revision-pin-mismatch, and a stale PROJECT_SHA256 still gives Extension revision pin mismatch. Both are tested.
  • No grants. A local review reads no policy, so permissions is undefined, the same as a run without a policy. Env, secret and egress grants are all denied. A test shows a proxy route refused with Egress denied by revision-pinned operator policy under --local-review, and passing with the reviewed policy that grants it. That policy's pin applies unchanged, and no local_review event is printed. The only grant is the test harness's own URLCODE_DATA_DIR grant, which exists with or without the flag.
  • No new code runs. The host activates the extensions the operator's host.mjs already composes. These are the same ones the manual workaround PROJECT_SHA256=<current revision> activates, and the one the trial used. The published CI action already computes PROJECT_SHA256 from the checkout for its non-serving checks.

The MCP runners (run_validate/run_test/run_audit) are unchanged: they forward only the operator's own flags. Whether they should pass the flag is filed as #940.

2. plan-feature ignores incidental words

A surface matched by a single goal word no longer makes its extension required. For example, the store's membership surface matched "Notify the team" through "team". An extension is required only through one of these:

  • a surface that matches two or more goal words;
  • a recipe that needs it;
  • the existing goal nouns.

A single-word surface is still listed when its extension is required for one of those reasons. Among equal recipes, the one needing fewer services ranks first. This keeps approvals on store-crud rather than store-booking.

Regression cases: "Notify the team", "send the team a welcome email", "move the old page to a new address" and "update the homepage copy" require no store. "Let users book a room" plans store-booking with the intervals surface. A credits goal plans store-credits.

3. Recipes: store-booking and store-credits

Both are declarative (no handler code), declare auth: true and store, and pass their tests.commands with --local-review:

  • store-booking: an owned bookings collection with an hour pattern and intervals {within: [room], when: {status: booked}}. A cancel transition frees the slot, and status is read-only.
  • store-credits: owned wallets. balance defaults to 0, is in readOnlyProperties and is never set by a transition (the Store: a transfers collection's sum never changes on delete or create (#928) #935 rule). pay never overdraws. Funding uses the issuer pattern: issue: {amount: balance, min: -1000000, members: issuers}.

The fixtures leave nothing behind (the credits wallets are paid back to 0 and deleted), so they rerun on the same database. recipes search booking and recipes search credits find them first.

The credits plan's outline names the issuer pattern. The store's transfers authoring surface now names it too (descriptor rebuilt), and its goals add issuer, issuers and mint.

The fixtures identify callers with Authorization: Bearer <id> through the stand-in principal host shown in the README, as the authenticated recipes already do. With the real Better Auth extension, each caller needs a sign-in steps fixture; the READMEs say so. core's test/recipes.test.ts skips every store recipe. packages/store/test/recipes.test.ts runs both through the CLI (validate --local, test twice, audit ready) with --local-review, the real store and no pin or origin. It adds the issuer member first with addMember.

Evidence (macOS, Node 26)

  • npm run verify passes.
  • npm run test:package passes (39 packaged example commands).
  • npm run test:addons passes (7). Its auth-site test now shows:
    • a bare npm run validate passing with the local_review event;
    • a bare npm start refusing with one complete command;
    • URLCODE_POLICY alone still refusing for the origin;
    • both values passing.
  • New tests:
  • Package budgets:
    • core measured 1018907 packed / 4016988 unpacked / 525 entries; raised to 999 KiB / 3927 KiB / 529;
    • store measured 488286 unpacked; raised to 481 KiB.

Limitations

  • Not an independent security review. The boundary argument above is the design rationale, backed by the tests listed.
  • --local-review pins to the current revision, so a local review still runs the project's trusted functions and the operator host with full Node access, as any validate or test does.
  • The new recipes' fixtures do not pass as written against real Better Auth sessions; that needs sign-in steps.
  • Creates still cannot be limited to a membership list (a trial gap, not addressed here).

🤖 Generated with Claude Code

…s incidental words, booking and credits recipes (#932)

- validate, test, routes and audit take --local-review: with no operator pin
  (no --policy, URLCODE_POLICY or PROJECT_SHA256) the run is pinned to the
  current revision, reads no policy (no grants) and defaults the origin to
  http://localhost; it prints a local_review event on stderr. serve, dev and
  every other command refuse the flag. An operator pin always wins. The
  generated npm scripts and the starter Makefile pass it for the checks only.
- plan-feature: a surface matched by one goal word no longer requires its
  extension ("Notify the team" no longer requires store); a surface needs
  two goal words, or its extension a matching recipe or noun.
- recipes store-booking (intervals, cancel transition) and store-credits
  (pay, and an issuer transfer with a negative min plus members), run by the
  store package through the CLI with --local-review; the credits plan and the
  store transfers surface name the issuer pattern.
- Docs: EXTENSIONS "The local review loop", TOOLING, RECIPES, STORE,
  AI-AUTHORING, LOCAL-DEVELOPMENT, FRAMEWORK, MONITORING, OBSERVABILITY,
  starter README/AGENTS, llms; package budgets raised.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 18:19
jimhoyd and others added 2 commits September 29, 2026 13:30
…-doc links, drop a duplicated store CHANGELOG entry

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd merged commit b3ce429 into main Sep 29, 2026
26 checks passed
@jimhoyd
jimhoyd deleted the claude/local-loop-932 branch September 29, 2026 18:50
jimhoyd added a commit that referenced this pull request Sep 29, 2026
jimhoyd added a commit that referenced this pull request Sep 29, 2026
--local-review and hermetic runs compose: the store-credits recipe seeds its issuer from tests/seed.json instead of
adding it to the live database, and the recipe tests assert nothing reaches the configured database.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local edit loop needs a new revision pin on every edit; plan-feature false positive on 'team' and no scheduling/credits recipes

1 participant