Skip to content

fix(api): return stored timestamps from repository, document and asset writes - #1152

Merged
ericfitz merged 6 commits into
mainfrom
fix/1150-subresource-timestamps
Nov 11, 2026
Merged

ericfitz merged 6 commits into
mainfrom
fix/1150-subresource-timestamps

Conversation

@ericfitz

Copy link
Copy Markdown
Owner

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 verify OK; make test-integration-pg 99 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

ericfitz and others added 6 commits November 10, 2026 16:24
…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
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
@ericfitz
ericfitz merged commit 6d4c5ff into main Nov 11, 2026
18 checks passed
@ericfitz
ericfitz deleted the fix/1150-subresource-timestamps branch November 11, 2026 02:44
ericfitz-version-bump Bot added a commit that referenced this pull request Nov 11, 2026
Folds 1 merged commit(s):
- 6d4c5ff fix(api): return stored timestamps from repository, document and asset writes (#1152)
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.

fix: repository, document and asset writes return missing timestamps

1 participant