Skip to content

fix(api): return stored timestamps from survey creates; remove SEM markers - #1157

Merged
ericfitz merged 6 commits into
mainfrom
fix/1153-1154-survey-timestamps-sem-cleanup
Nov 12, 2026
Merged

ericfitz merged 6 commits into
mainfrom
fix/1153-1154-survey-timestamps-sem-cleanup

Conversation

@ericfitz

@ericfitz ericfitz commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

#1153: survey timestamps. POST /admin/surveys and POST /intake/survey_responses returned GORM-generated timestamps with nanosecond precision. The database stores microseconds, so the create response disagreed with a later GET. Both stores now set microsecond-truncated UTC created_at/modified_at before insert. Update paths already re-read the row.

#1154: remove SEM markers. Removes every SEM@ intent-marker comment line (6,623 in 670 files), the SEM section of .claude/CLAUDE.md, and .local/sem.db. Comment-only otherwise.

Lint. Fixes the ruff findings in the 9 Python scripts that the marker removal touched.

#1158: credential headers in debug logs (CodeQL alert 1308). The request/response debug logger logged Authorization, Cookie, Set-Cookie and API-key header values in the clear when logging.redact_auth_tokens was off. These headers now always log as [REDACTED], using a shared list that RedactHeaders() also uses. The unused RequestTracingMiddleware, which logged every header unredacted, is deleted. New tests fail on the old code and pass on the fix.

Go toolchain go1.27.4. Fixes GO-2026-6859, a reachable net/http crash that govulncheck reported. The advisory is newer than main's last green run.

Verification

  • New unit tests (api/survey_timestamps_test.go) fail without the fix and pass with it. A NowFunc with 761 ns of extra precision makes the bug show on every OS.
  • New integration test TestSurveyCreateReturnsStoredTimestampsIntegration passed against a throwaway Oracle ADB, together with TestSurveyCRUD and TestSurveyResponseWorkflow. The ADB was deleted afterwards. The oracle-db-admin review approved the change.
  • make verify passes on this branch.
  • make test-dev-scripts: 218 tests pass, and every touched script's --help runs.

Follow-ups

Fixes #1153
Fixes #1158
Closes #1154

🤖 Generated with Claude Code

https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP

ericfitz and others added 3 commits November 11, 2026 16:40
…eate

Survey and survey-response Create echoed the created_at/modified_at that
GORM's autoCreateTime/autoUpdateTime generated (nanosecond precision on
Linux), while PostgreSQL timestamptz and Oracle TIMESTAMP(6) store
microseconds, so the create response disagreed with every later GET. Set
microsecond-truncated UTC timestamps on the model before the insert, as
the note, document, repository and asset stores already do. Update paths
are unaffected: their handlers re-read the row.

Tests: unit tests with a nanosecond NowFunc fail before the fix (761ns
residue) and pass after; a new integration test compares the create
responses with a GET.

Verification: `make verify` OK; scoped `make test-integration-oci` on a
throwaway Always Free ADB: TestSurveyCRUD, TestSurveyResponseWorkflow and
TestSurveyCreateReturnsStoredTimestampsIntegration pass; oracle-db-admin
APPROVED. The remaining same-pattern instances are tracked in #1155.

Fixes #1153

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Strip every `SEM@` marker comment line (6,623 lines in 670 files) with one
scripted pass, dropping a bare `//` separator left orphaned above a removed
marker. Historical plans under docs/superpowers/plans/ keep their prose
with `SEM@` rewritten to `SEM-`, so `rg SEM@` over tracked files is empty.
Remove the sem-markers block from .claude/CLAUDE.md. api/api.go carried no
markers, so no regeneration was needed. No CI, Makefile, script or hook
automation referenced the markers. Also gofmt wstest/main.go (pre-existing
extra blank line).

Verification: `make verify` OK; `git grep SEM@` empty.

Closes #1154

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Drop unused E402 noqa directives, sort imports, use datetime.UTC, pass
check= explicitly to subprocess.run, collapse nested if/with blocks,
narrow a blind except, and mark shebang scripts executable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
ericfitz and others added 3 commits November 11, 2026 17:08
net/http HTTP/1 server crash from a MaxBytesReader header race, fixed in
go1.27.4; govulncheck reports it reachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
logRequestDetails/logResponseDetails logged Authorization, Cookie,
Set-Cookie and API-key headers in the clear when redact_auth_tokens was
off. Credential headers now always log as [REDACTED] via a shared
credentialHeaders list (also used by RedactHeaders). Delete the unused
RequestTracingMiddleware, which logged all headers unredacted.

Resolves CodeQL alert 1308.

Fixes #1158

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
Default-deny: request/response debug logs keep values only for known-safe
headers (Content-Type, Accept, User-Agent, X-Request-Id, ...); every other
header, credentials and custom ones such as webhook signatures included,
logs as [REDACTED].

Refs #1158

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011fnCFtPzfvJmmkCSfXZgqP
@ericfitz
ericfitz merged commit d6129ee into main Nov 12, 2026
18 checks passed
@ericfitz
ericfitz deleted the fix/1153-1154-survey-timestamps-sem-cleanup branch November 12, 2026 03:03
ericfitz-version-bump Bot added a commit that referenced this pull request Nov 12, 2026
Folds 1 merged commit(s):
- d6129ee fix(api): return stored timestamps from survey creates; remove SEM markers (#1157)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant