You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add subsystem-local docs for progressive-discovery refactor
Create three new topical docs that will absorb content currently
inlined in CLAUDE.md, so agents only pay the context cost for the
subsystem they're actually touching:
- katana_mcp_server/docs/prefab/README.md — DataTable mustache
binding, browser-test wire shape via make_tool_result,
register_preview_tool + meta=UI_META contract, help.py drift.
- katana_mcp_server/docs/typed_cache/README.md — archive/deleted
opt-in flags + derived bools, cross-entity ID collisions,
Cached<Name> siblings (don't pollute API spec).
- katana_public_api_client/docs/spec-authoring.md — OpenAPI 3.1
conventions, use-site descriptions, ListResponse schema,
generator/spec regen lockstep, privacy, fix-at-source rule.
Extend two existing docs with content that didn't have a topical
home yet:
- katana_public_api_client/docs/guide.md — new "Response Handling"
section with unwrap helpers, when-to-use table, anti-patterns,
and exception hierarchy. Also fix four stale status_code == 200
example blocks in this file to use unwrap_as / unwrap_data /
is_success per the rule we're now codifying.
- .github/agents/guides/shared/COMMIT_STANDARDS.md — add
First-Push Safety (HEAD:refs/heads/<name> form), Lockfile Drift
(uv.lock bundling), and Generator/spec regen lockstep sections.
No content is removed from CLAUDE.md yet; that move lands in the
next commit so the two halves of the refactor are reviewable
independently.
Co-Authored-By: Claude <noreply@anthropic.com>
## Don't pollute the API spec/models with cache-only fields
91
+
92
+
The OpenAPI spec at `docs/katana-openapi.yaml` and the generated pydantic models in
93
+
`katana_public_api_client/models_pydantic/_generated/*.py` reflect Katana's actual wire
94
+
contract. **Never** add fields to the spec or inject fields into the API pydantic
95
+
classes to satisfy cache-schema, MCP-tool, or other consumer needs.
96
+
97
+
Cache schemas live on sibling `Cached<Name>` classes emitted by the same generator pass
98
+
— the API class stays pure pydantic, the cache class carries `table=True`, foreign keys,
99
+
relationships, JSON columns, and any cache-only fields. See
100
+
`scripts/generate_pydantic_models.py::duplicate_cache_tables_as_cached_siblings` and
101
+
`katana_mcp_server/src/katana_mcp/typed_cache/sync.py::_attrs_<entity>_to_cached` for
102
+
the conversion pattern: attrs → API pydantic (via the registry) → cache pydantic (via
103
+
`model_dump`/`model_validate`), with relationship fields set after construction since
104
+
SQLModel `Relationship` descriptors don't accept input via `__init__`.
105
+
106
+
If a bug surfaces in `sync.py` but originates in generated client code (attrs, pydantic,
107
+
`from_attrs`, `Cached*` schemas), fix it at the generator/spec layer — not in `sync.py`.
108
+
See
109
+
[Fix bugs at the client/generator layer](../../../katana_public_api_client/docs/spec-authoring.md#fix-bugs-at-the-clientgenerator-layer-when-the-root-cause-lives-there)
0 commit comments