Skip to content

The docs say that memory.apply refuses an unknown key inside target or an action block - #2302

Merged
zlareb1 merged 2 commits into
mainfrom
docs/apply-refuses-nested-keys
Dec 5, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
docs/apply-refuses-nested-keys

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Related: #2155
Related: #2171

Changelog category (leave one):

  • Documentation (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

memory.apply refuses a key it has no field for inside target, target.filter, target.search and the expire, lock, label and demote blocks: the seven nested models set extra="forbid" (server/memory/api/models_apply.py). The change that added the refusal touched no page, and the pages stated one rule for every input model: an unknown key is ignored and named in ignored_args. A reader of those pages expects a misspelt predicate such as target.filter.tag_any to be served and reported, and it is a 422.

Page What it says now
docs/reference/http-api.md, "Unknown and removed fields" The rule is scoped to top-level keys. One bullet states the refusal: 422 VALIDATION_FAILED, an entry in detail.errors of type extra_forbidden whose loc is the key's path, with dry_run on or off, and the reason (a filter the caller did not write must not select rows). A field removed from one of these objects is refused, not served and named in ignored_args.
docs/features/memory/writing.md The memory.apply row names the refusal and links to that section.
docs/architecture/system-overview.md "Unknown arguments" has the same scope and one sentence on the refusal.
docs/architecture/rolling-upgrades.md A rule for the rollout: the build before drops such a key and runs the call on what is left, so the same call is refused by one replica and run by another, and a client sends only documented keys. Rule 12 does not hold inside these objects: a field a later build adds to one of them is refused by the build before, and a removed field is refused from then on.

Each statement was read in the code and its tests first. Where they say something narrower than a plain reading of the issue, the pages follow them:

  • The suggestion for a near miss is part of the MCP refusal only (server/transport/arg_feedback.py: unknown maps target.filter.tag_any to target.filter.tags_any, with a corrected example call). The HTTP 422 names the path and the type and carries no suggestion. The HTTP page says so and links to the MCP page, whose "Errors" section already covers nested keys.
  • A top-level unknown key of memory.apply keeps the general rule: served and named in ignored_args, or 422 UNKNOWN_ARGUMENT for a near miss. The pages do not restate it for this op.

Scope and risk

Touches four pages under docs/: 32 lines added, 6 removed. No code, no test and no generated page changes.

Left alone:

  • docs/reference/operations/memory.md (generated): no model comment changed, and python -m scripts.codegen.docs_reference --check reports every page current.
  • docs/reference/mcp.md and docs/reference/errors.md: their text on validation failures already holds for a nested key.
  • The nested objects of other ops. Those of knowledge.source.add, knowledge.source.update, knowledge.source.worker_preview, knowledge.source.worker_register and namespace.register that set extra="forbid" refuse as before; the rest ignore an unknown key, and ignored_args lists top-level keys only. Refusing there is a change of behaviour, not of text.
  • i18n/: the translation workflow reads the English pages after the merge.

What could break: a statement that is wrong. The rolling-upgrade rule is written as rule 88, the next after the last on main at this head. The list is sequential, so the formatter renumbers it when this lands after another change that adds a rule; no other text refers to its number.

Compatibility, rollout and rollback

  • Wire: no op, field, table, column, migration or setting is added, changed or removed.
  • Operator steps: none.
  • Rollback: a revert restores the previous text and leaves nothing behind.

Tests

No new test: the change is prose. The behaviour's tests are on main (tests/unit/test_memory_apply.py, tests/unit/test_arg_feedback.py), and the docs tests cover links, anchors and public copy.

What ran, with pytest -n 2. The branch merges main once, to resolve a conflict in the rule list of rolling-upgrades.md. The docs tests and Prettier on that page ran again on the merged head; the other lines ran before the merge:

  • tests/unit/test_doc_links.py tests/unit/test_public_copy.py: 306 passed.
  • tests/unit/test_memory_apply.py tests/unit/test_arg_feedback.py -k "nested or unknown", the cases the pages describe (the refusal over HTTP and MCP with dry_run on and off, the path in loc, the suggestion and the example over MCP, a top-level key still served or refused as before): 19 passed.
  • The repository scans (test_package_contracts.py, test_op_transport_contract.py, test_tunable_constants.py, test_store_names_refused.py, test_degraded_unnoted.py, test_agent_instructions.py) and tests/analyzer: 307 passed, 12 skipped (the analyzer cases that need a ClickHouse).
  • npx prettier@3.9.9 --check on the four pages: pass. In the table of writing.md only the memory.apply row differs.
  • python -m scripts.codegen.docs_reference --check: every page current, docs/reference/http-api.md included (the edit is outside its generated region).
  • make typecheck: pass.
  • .claude/skills/loom-writing/scripts/check_prose.py on the four pages, the commit message and this description: no hit.

One reading of the code backs the scope sentence: no registered op's top-level input model sets extra to forbid or allow, so "an op's input model ignores a top-level key it has no field for" holds for every op.

Not run:

  • make lint and make format-check as a whole: make lint runs the Rust SDK generator's check, which needs rustfmt, and make format-check needs shfmt; this machine has neither. No Python, shell, TOML or frontend file changed.
  • The documentation site build, the full unit suite and the integration suite: CI runs them. No server and no ClickHouse were started for this change.

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 wrote the text, read each statement in the code and its tests, and ran the checks listed under Tests.

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

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

Unticked: this change has no generated file, no migration, no shipped plugin file and no frontend file, so those four checks do not apply; the CLA line is the committer's to confirm. The first box is ticked with the two gaps named under "Not run": make lint and make format-check stop on tools this machine lacks.

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only edits to four markdown files; no wire, code, or migration changes.

Overview
Documentation now matches existing server behavior: memory.apply nested payloads are not covered by the general “unknown top-level key → ignored_args” rule.

Updates clarify that target, target.filter, target.search, and the expire, lock, label, and demote blocks reject any unrecognized key at validation with 422 VALIDATION_FAILED (HTTP details include extra_forbidden and the key path in loc; MCP may suggest a near miss). The http-api “Unknown and removed fields” section is scoped to top-level keys; removed fields inside those nested objects are refused rather than ignored.

writing.md links memory.apply to that section. system-overview.md notes the exception so readers do not expect misspelled filter predicates to widen selection silently.

rolling-upgrades.md adds rule 88: during mixed N/N-1 fleets, older builds strip unknown nested keys and still run the call—so the same request can 422 on N and execute on N-1; rule 12 does not apply inside these objects for forward-added fields.

Reviewed by Cursor Bugbot for commit ba787be. Bugbot is set up for automated code reviews on this repo. Configure here.

zlareb1 and others added 2 commits December 5, 2026 18:06
…r an action block

The nested objects of memory.apply refuse a key they have no field for
with 422 VALIDATION_FAILED and the key's path, so a misspelt predicate
cannot widen a filter. The pages stated one rule for every input model:
an unknown key is ignored and named in ignored_args.

- docs/reference/http-api.md: "Unknown and removed fields" scopes that
  rule to top-level keys. One bullet states the refusal, its entry in
  detail.errors, that it holds with dry_run on or off, and that a field
  removed from one of these objects is refused, not served.
- docs/features/memory/writing.md: the memory.apply row names the refusal.
- docs/architecture/system-overview.md: the same scope, and one sentence
  on the refusal.
- docs/architecture/rolling-upgrades.md: a rule for the rollout. The build
  before drops such a key and runs the call on what is left, so a client
  sends only documented keys while both builds serve, and rule 12 does
  not hold inside these objects.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Both sides added a rule at the end of the list in
docs/architecture/rolling-upgrades.md. The stewardship rule keeps its
number and the memory.apply rule follows it.

Signed-off-by: Mohammad Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 5, 2026 6:12pm UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 6:12pm UTC

Request Review

@zlareb1
zlareb1 merged commit aeb4257 into main Dec 5, 2026
78 checks passed
@zlareb1
zlareb1 deleted the docs/apply-refuses-nested-keys branch December 5, 2026 18:24
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