Skip to content

memory.inspect's integration test expects a writer token to be refused the extraction policy with auth off - #209

Merged
zlareb1 merged 4 commits into
mainfrom
fix/inspect-test-writer-policy
Nov 3, 2026
Merged

zlareb1 merged 4 commits into
mainfrom
fix/inspect-test-writer-policy

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 3, 2026

Copy link
Copy Markdown
Member

Related: #186

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Not required.

Why

tests/integration/test_memory_inspect.py::test_inspect_splits_own_from_others_and_changes_nothing fails on main's auth-off integration job with assert None == ''.

Failing case: the test inspects with a writer token. With auth off, the anonymous probe gets 200, and the test then expects the writer's settings.extraction_policy to be "".

Pattern: the HTTP transport checks any bearer token it is sent, even with auth off (_extract_auth). row_in_scope(org, ns, Role.ORG_ADMIN) therefore refuses the writer, and memory.inspect answers extraction_policy: null with "only an org admin reads the operator extraction policy". Only the tokenless probe has no auth context, and it reads "". The test checked the probe's answer against the writer's response. A local run against an auth-off server showed exactly this: the writer got None with that reason, and the anonymous call got ''.

Fix: the code is correct, so the test is the thing that changes. It asserts that the writer is refused the policy in every auth mode. When auth is off, it also asserts that the anonymous answer's policy is "". No assertion is loosened.

Scope and risk

Test only. No server code changes.

Compatibility, rollout and rollback

  • Wire: none.
  • Operator steps: none.
  • Rollback: reverting brings back the failing assertion.

Tests

  • Against a local ClickHouse and a server with LOOM_AUTH_REQUIRED=false (CI's integration posture), pytest tests/integration/test_memory_inspect.py failed before the change with assert None == '' at the policy assertion, and passes after it (1 passed, 1 skipped: the second test skips without auth enforced).
  • make format lint pass.

Other failures on main that this PR does not fix and that may show red on its head:

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. It reproduced the failure on a local server and checked which authz branch the server took.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand (none affected).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited (none).
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version (none).
  • The frontend builds, if frontend/ changed (unchanged).
  • Docs under docs/ describe the system as it now is (unchanged).
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off (git commit -s).

🤖 Generated with Claude Code

zlareb1 and others added 4 commits November 3, 2026 11:24
…d the extraction policy with auth off

The server checks a bearer token it is sent even with auth off, so the
writer token the test inspects with never reads the operator extraction
policy. The test asserted the anonymous probe's answer against the
writer's response. It now asserts the writer's refusal in every auth
mode, and the empty policy on the anonymous answer when auth is off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
… the policy

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…ed or refused for a missing token

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
…the policy check fails

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 317164a into main Nov 3, 2026
16 of 18 checks passed
@zlareb1
zlareb1 deleted the fix/inspect-test-writer-policy branch November 3, 2026 12:44
@pufit pufit mentioned this pull request Nov 4, 2026
9 tasks done
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.

1 participant