fix: use Harper @createdTime instead of hand-rolled created_at - #169
Merged
Conversation
Four oauth tables hand-wrote a created_at that Harper can populate itself via @createdtime, and the unit differed per table (ms vs seconds) — a latent 1000x footgun for whoever next reads one assuming the other convention. Annotate created_at with @createdtime on csrf_tokens, mcp_auth_codes, and mcp_refresh_families (all informational / not computed on) and stop hand-writing it in app code. harper_oauth_mcp_keys keeps its manual, seconds-based field — keyStore deliberately mutates created_at to reorder GC/signer selection, which @createdtime cannot express — now documented in the schema. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Author
|
Reviewed; no blockers found. |
Contributor
|
Reviewed; no blockers found. Suggestions (non-blocking)
|
Merged
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.
Summary
created_atwith Harper's@createdTimedirective oncsrf_tokens,mcp_auth_codes, andmcp_refresh_families, and stop hand-writing the field in app code — Harper now assigns it on insert (epoch ms) and retains it across rotation writes.created_atfrom the app DTOs (MCPAuthCodeRecord,MCPRefreshFamilyRecord), their encode/decode paths, and the manualDate.now()/nowSeconds()writes (CSRFTokenManager,mcp/callback.ts,mcp/token.ts). These fields were write-only / informational, so nothing reads them for logic.harper_oauth_mcp_keys.created_atas a hand-managed seconds field —keyStoredeliberately mutates it to reorder GC/signer selection, which@createdTime(pinned to original insert time) cannot express. Added a schema comment documenting why it's the exception and why it's seconds.This resolves the unit footgun called out in #168 (ms in two tables, seconds in three):
created_atis now Harper-owned everywhere it's just informational, and the one place it's app-logic is explicitly documented.Test plan
npm run build(tsc)npm run lint(0 errors)npm run format:check(only untracked.harper-skills/flagged)npm test— 840 pass, 0 failbun test— 840 pass, 0 failCSRFTokenManager/OAuthProvider/callbackassertions to requirecreated_atis not hand-written (fails before this change, passes after).Closes #168