Repository navigation
fix(api): return stored timestamps from repository, document and asset writes - #1152
Merged
Merged
Conversation
…t writes Repository Create/Update/BulkCreate, document Update/BulkCreate and asset BulkCreate returned (and cached) structs without the created_at and modified_at the database holds. Updates now read both back inside the update transaction; creates and bulk creates copy the inserted values onto the API structs. Every create/update timestamp mirrored onto a response (including threat create/update/bulk update and triage note create) is now truncated to microseconds, the resolution TIMESTAMP(6) and timestamptz store, so the response equals a later GET. Fixes #1150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Every DB-served repository GET and list omitted created_at and modified_at: modelToAPI never copied them, unlike the document and asset stores. Found by the #1150 integration test. Refs #1150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Asset Update left modified_at to GORM's autoUpdateTime, whose NowFunc carries nanoseconds on Linux, so the returned value did not match what TIMESTAMP(6)/timestamptz store (CI failure on #1152; macOS clocks stop at microseconds, which hid it locally). Set it explicitly, truncated, keyed by the Go field name so the hooks-enabled autoUpdateTime injector skips it on Oracle (a lowercase key would emit MODIFIED_AT twice: ORA-00957). Tests: the timestamp test DB clock now carries nanoseconds on every OS, and a guard test asserts a single MODIFIED_AT assignment under an Oracle-style uppercase column namer. Refs #1150 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
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.
Create/update/patch on repositories, documents and assets now return the timestamps actually stored, and repository model-to-API conversion maps created_at/modified_at.
Verification:
make verifyOK;make test-integration-pg99 pass / 0 fail / 9 skipped; scoped Oracle integration pass on live ADB; oracle-db-admin APPROVED WITH NOTES (nothing blocking); security-review no findings.Fixes #1150
🤖 Generated with Claude Code
https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP