M1, M2 and M3 complete * M1, M2 and M3 complete * review changes * docs * docs
8.1 KiB
Mutable Metadata Progress Review
Scope: this is a file-state review only. Q reported that task fullsuite:ci is now passing; I did not rerun it. I reviewed the current tracking doc, journal, docs, and mutable-metadata implementation files.
Findings
-
High: the progress artifacts are still contradictory enough to mislead the next handoff. The tracking file marks Milestone
0-INTasCOMPLETEat plans/mutable.metadata.plan.combo.v4.tracking.md, but the same section still contains unchecked “What remains” items at plans/mutable.metadata.plan.combo.v4.tracking.md. More importantly, the detailed Milestone 3 checklist is still entirely[ ]at plans/mutable.metadata.plan.combo.v4.tracking.md, even though reset query/service/handler work already exists in internal/customschema/service_reset.go and api/queryAPI/customschemas_reset.go. The journal is also stale: it still saysapi/queryAPI/customschemas_reset_test.go“does NOT exist yet” at journals/implement_mutableMetadata.md, but that file now exists and contains reset endpoint tests at api/queryAPI/customschemas_reset_test.go. There is also a naming mismatch: the tracking checklist still refers toResetDocumentMetadataResponseat plans/mutable.metadata.plan.combo.v4.tracking.md, while the actual spec/code useDocumentMetadataResetResponseat serviceAPIs/queryAPI.yaml. The codebase has moved forward; the handoff documents have not. -
Medium-High:
SetDocumentMetadatastill does not implement the documented retry-on-unique-violation fallback. The tracking file marks this complete at plans/mutable.metadata.plan.combo.v4.tracking.md, but the implementation in internal/customschema/service_metadata.go computesnextVersion, performs a singleCreateDocumentCustomMetadatacall, and returns immediately on insert error. I could not find a23505/uq_doc_custom_metadata_versionbranch or retry loop. The test file also has happy-path, validation, and pagination coverage in internal/customschema/service_metadata_test.go, but no injected unique-violation retry case. So this is still both an implementation gap and a tracking-doc overstatement. -
Medium: Milestone 3 coverage is still materially short of the planned test surface, even if the suite is green. The plan/tracking expect a full upgrade flow, schema-version concurrency, and reset/version authorization-matrix coverage at plans/mutable.metadata.plan.combo.v4.tracking.md. The current reset test file covers only the reset endpoint’s direct status paths: missing subject, not found, legacy conflict, happy path, and idempotent clean-doc in api/queryAPI/customschemas_reset_test.go, api/queryAPI/customschemas_reset_test.go, api/queryAPI/customschemas_reset_test.go, api/queryAPI/customschemas_reset_test.go, and api/queryAPI/customschemas_reset_test.go. I found no current tests for the planned “bind v1 -> write -> create v2 -> reset -> rebind -> write” flow, no end-to-end schema version concurrency test, and no reset/version auth-matrix test in the checked
api/queryAPItest files. A green suite here means “no current regressions detected,” not “Milestone 3 is fully proven against its own checklist.” -
Medium: the human-facing docs still stop at Milestone 2 even though the OpenAPI spec now exposes reset-metadata. The source-of-truth spec contains
POST /super-admin/documents/{id}/reset-metadataandDocumentMetadataResetResponseat serviceAPIs/queryAPI.yaml and serviceAPIs/queryAPI.yaml. But the summary doc’s quick-reference table stops atPATCH /super-admin/documents/{id}/schemaplus the four/custom-metadataroutes at docs/ai.generated/queryapi.summary.md, and the service description section likewise ends with schema assignment at docs/ai.generated/queryapi.summary.md. The API documentation authorization table also listsPATCH /super-admin/documents/{id}/schemaand the four/custom-metadataroutes, but not reset-metadata, at docs/ai.generated/03-api-documentation.md. This is now a real user-facing drift, not just a future-doc TODO. -
Medium-Low: the new metadata audit events still emit an empty
client_id, which weakens the audit trail.AuditRecordcarriesClientIDin internal/customschema/audit.go, butSetDocumentMetadatahardcodesClientID: ""at internal/customschema/service_metadata.go even though it already loaded the bound schema row earlier at internal/customschema/service_metadata.go.ResetDocumentMetadatasimilarly recordsmetadata.resetwithout populatingClientIDat internal/customschema/service_reset.go.schema.assigndoes populate client id correctly at internal/customschema/service_metadata.go, so the inconsistency is limited to the newer metadata/reset write paths.
Overall Read
The codebase is in a materially better state than the previous review: reset-metadata now exists in the spec and code, and there is at least direct endpoint coverage for the reset path. The remaining problems are mostly about truthfulness and completeness rather than obvious compilation/runtime breakage: the tracking/journal state is behind the code, the planned retry fallback in SetDocumentMetadata still has not landed, Milestone 3’s full planned test surface is not yet present, and the human-facing docs have not caught up with the new reset endpoint.