Repository navigation
Live tenancy check in CI, setting-ownership fix, full tool guards, complete rewind, working ESLint - #158
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Escape JSX text (react/no-unescaped-entities), replace the 8 explicit `any`s with real types (RollResult, generated-entity id guard, Error in mutation onError, unknown query params, role union), and rewrite the 4 ternary side-effect expressions as if/else. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…warnings Drop dead imports (lucide icons, types, hooks), unused destructured props (ConflictCard index, MiniGraph/SaveModal/RelationshipCreateModal props), unused state values (keep the setter where it is called), and unused local bindings. Replace the rest-omission `_i`/`_q` patterns with an explicit stripIncluded helper and query/timeout deletion so no binding is left behind. Delete the dead duplicate graph canvas block in forge/worlds/page.tsx (GraphTab renders ./GraphCanvas). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Truncates a ConversationSession's durable turn history to its first N turns so a rewound exchange disappears from context assembly too. The session stays ACTIVE; only the turn list is rewritten. Registered in AUTHORITY_MATRIX for NPCVoice (DL-20). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Stabilize `?? []` fallbacks (stories/universes/packs/proposals/filter) with useMemo so hook deps keep identity; copy Map refs into locals in the SSE unmount cleanup; depend on notesQuery.data and the stable upsertNotes.mutate. The remaining fetchModels case gets a justified eslint-disable (adding it would refetch on every render). Also drop six unused eslint-disable directives. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add an ESLint step to the frontend job with --max-warnings=2 (the two pre-existing @next/next/no-img-element warnings), so errors and any new warnings fail CI. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signup is invite-only by default and never grants admin, so a fresh deployment had no operator. scripts/create_admin.py creates or promotes an admin through PostgresClient using the same UserCreate validation and Argon2id hashing as /api/auth/signup; idempotent, --promote-existing for existing accounts, password read from --password or getpass and never printed. Hermetic unit tests with FakePostgres; documented in env.example, docs/SETUP_LOCAL.md and the MULTI_TENANCY_PLAN runbook. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Extend e2e/pages.spec.ts with /forgot-password and /reset-password landmark smokes plus targeted tests for /admin (operator tabs render), /settings/account (local-mode hides credential cards) and /gm (Prep -> Run -> Wrap-up stepper visible), matching the existing spec style for the weekly MONITOR_AUTH_DISABLED=true run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
scripts/smtp_sink.py speaks minimal SMTP over asyncio streams (no smtpd,
no new dependencies) and appends each accepted message to a file as one
JSON line {to, subject, body}. STARTTLS/AUTH are not advertised — pair it
with MONITOR_SMTP_STARTTLS=false. Unit tests drive it with stdlib
smtplib over loopback (enable_socket marker) covering dot-stuffing,
multiline bodies and JSON-lines-only output.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each completed step() pushes a pre-exchange snapshot (turn transcript, pending proposals, NPC social context, lorebook overrides, counters, buffered memory writes); trim pops the newest snapshot so repeated rewinds walk back exchange by exchange. The persisted ConversationSession turn list is truncated through the data-layer mongodb_trim_conversation_turns tool (best-effort — a store failure logs and keeps the in-memory trim). The conversation stays open: no close, no status change, no proposal staging. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
scripts/live_tenancy_smoke.py drives an auth-enabled backend end to end: admin login, invite-only signup (no-invite and invite-reuse refused), A creates multiverse/universe/chat/character/lorebook/note through the API, B gets 404/403 on every A-owned resource with scoped lists/search/ graph and 403 on /api/llm/* and /api/admin/*, forgot-password 202 equivalence plus the SMTP-sink reset flow (single-use token, sessions revoked), and admin reset/revoke/ban/unban for B. Every step prints PASS/FAIL; exit is non-zero on any failure. CSRF mirrors the frontend (GET /api/auth/config then X-CSRF-Token from the monitor_csrf cookie). Clients come from an injected factory, so the hermetic tests run the Postgres-only stages against the FastAPI app with FakePostgres and TestClient (5 tests, green). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add a Weekly Integration step after the auth-disabled backend start and before Playwright: start scripts/smtp_sink.py on :2525, launch a second backend on :8002 with MONITOR_AUTH_DISABLED=false, invite-only signup, AUTH_COOKIE_SECURE=false, a fresh MONITOR_PROVIDER_KEY_ENCRYPTION_KEY, MONITOR_SMTP_* pointed at the sink (STARTTLS off) and MONITOR_PUBLIC_URL; bootstrap the first admin with create_admin.py (--promote-existing for idempotency); run scripts/live_tenancy_smoke.py against :8002. On failure the step prints the :8002 backend log and the sink file. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ndary Add assert_*_write helpers (conversation, session entry, resolution, visual-identity anchor, party) and apply them to the seven families MULTI_TENANCY_PLAN §4 still listed as HTTP-only: visual identities, conversation sessions/turns, session-recorder entries, resolutions, GM notes, parties (Neo4j nodes + Mongo inventory/splits), and tone libraries. No owner in context keeps behavior byte-identical; a foreign owner is refused with OwnerViolationError before any write. Tests: test_tenancy_write_guards_remaining.py (foreign refused / owner allowed / no owner unchanged per family); fakes gain the new tool modules, a cursor-shaped find(), party→story resolution, and a Neo4j write counter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
monitor_data.server.call_tool re-raises OwnerViolationError (still logged as a failed call) instead of flattening it into an "Error executing tool: ..." string; every other tool error keeps the pre-existing string contract, so BaseAgent.call_tool needed no control flow change — it already re-raises exceptions and now passes the typed tenancy refusal on to callers. ConversationLoop's memory flush failure now propagates typed, which matches its documented keep-the-buffer-for- retry contract (test updated to expect the typed error; both original asserts kept and a buffer-retention assert added). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ilies Record the seven families now guarded at the tool boundary, the tone-library global-row exception, the remaining deferred breadth (documents, transcripts, templates, Neo4j content tools, Qdrant, ...), and the typed OwnerViolationError contract across server.call_tool / BaseAgent.call_tool with its test pointers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rim, in-flight end-scene/wrap-up (UX-6) - POST .../rewind now rolls the scene's MongoDB LangGraph checkpoint back before a scene_turn exchange via SceneLoop.backtrack (agents API; no raw DB access from the router), refusing 409/503 before any transcript mutation when the rollback can't complete. - Active NPC ConversationLoops are trimmed in place via ConversationLoop.trim_last_exchange for conversation_turn exchanges; a trim failure keeps the loop (popping would end the conversation). - end-scene and wrap-up now hold the turn in-flight mark for their whole run, so rewind answers 409 while they mutate the transcript/session. - Rewind docstring documents all of the above. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…are unseeded The weekly integration job carries no LLM credentials, so this test has failed every run since 2026-11-16 on a missing precondition, not a defect. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ote (UX-6) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…st read-back Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
_create_setting and _ensure_universe_for_multiverse only wrote Neo4j, so with auth on a user's own uploaded setting or pack-applied world had no Postgres ownership row and was invisible/unwritable to them. Upload, rescan and pack apply/new-world now register the new multiverse and universe under the caller (no-op in local mode; an existing universe row is left untouched so its bindings are never reset). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
documents, book records, foreshadowing, generated assets, merge candidates/proposals, GM profiles, world snapshots and transcripts now assert the acting owner (foreign refused, owner passes, no owner unchanged; 67 parametrized tests). Tone profiles and tag definitions stay shared: global registries, admin-only over HTTP and written by CanonKeeper during pack apply. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
assert_multiverse_write mirrors require_multiverse_owner against the multiverses registry (multiverse_id is a Postgres root, not a Story node); universe_of_agenda/assert_agenda_write resolve an Agenda through its IN_UNIVERSE link before asserting. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
character templates (direct owner_id), GM prep bundles, world profiles, prompt collections and random tables (universe-bound rows; global/builtin rows stay shared like tone libraries), scene rewind, world-snapshot restore, commit webhooks (universe scope + multiverses registry), working state (entity), world clock/deadlines (universe), and universe fork (source and destination) now assert the acting owner; no owner in context keeps behavior unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
state tags (entity), archetype links, character relationships (both endpoints), entity→ability links, and the agenda tools (universe / agenda → universe) assert the acting owner at the tool boundary. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
One parametrized Case per tool (foreign refused + zero writes, matching owner passes + registry consulted, no owner never consults the registry) for the 29 universe-bound tools; character templates get the direct-owner contract, webhooks a multiverse-registry pair, plus global-row and fail-closed edge pins. Fakes gain the new tool modules, the multiverse registry, and agenda→universe resolution. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The old bullet listed families that earlier FU-guards commits and this final batch have since guarded. Split §4 into a closed-by-final-bullet batch note and an accurate still-HTTP-only list with per-family reasons (Neo4j content CRUD, deferred Mongo writers, Qdrant, shared registries, non-tool writes). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Follow-up to #157: closes the gaps that PR listed as not verified, and fixes bugs found along the way.
What changed
scripts/live_tenancy_smoke.pyruns in the Weekly Integration workflow against a second backend on a real stack (Postgres/Mongo/Neo4j/Qdrant/Redis) with auth on. It covers invites, signup refusal, cross-tenant read/write/delete on real resources, list/search/graph scoping, rewind, admin/LLM 403s, email password reset through a local SMTP sink (scripts/smtp_sink.py), the admin reset link, session revocation, and ban/unban. 42/42 on run 45560911321.scripts/create_admin.py. Signup is invite-only by default, and before this nothing created the first admin.OwnerViolationErrornow crosses the MCP boundary typed. Tone profiles and tag definitions stay shared: they are global, admin-only over HTTP, and written by CanonKeeper during pack apply. The remaining exceptions are listed in MULTI_TENANCY_PLAN §4.eslint-config-next15 used as a flat config). Fixed with FlatCompat; the 30 errors and the unused-var/hook warnings are fixed; CI now gateseslint --max-warnings=2. Playwright page smokes added for /admin, /settings/account, /forgot-password, /reset-password, /gm, /play.test_knowledge_correction_liveskips when default LLM providers aren't seeded. The job has carried no credentials and failed on that since 2026-11-16.Verification
uv run pytest packages tests -n 4: 10,820 passed, 236 skipped.tsc, vitest (783), and ESLint are clean.🤖 Generated with Claude Code