Skip to content

feat: email-first authentication + build/tooling hardening - #6

Merged
voidvec merged 24 commits into
masterfrom
feat/email-first-auth-and-tooling
Jul 1, 2026
Merged

voidvec merged 24 commits into
masterfrom
feat/email-first-auth-and-tooling

Conversation

@voidvec

@voidvec voidvec commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Bundles the local master work ahead of origin/master into one reviewable PR. Two themes: (1) email-first authentication, and (2) build/script/docs/tooling hardening.

Email-first authentication

  • feat(db): make username optional (migration V020__username_optional.sql)
  • feat(auth): validate + normalize email on registration (EmailNormalizer, RuleSet rules, migration V019__email_validation.sql, unit tests)
  • feat(auth): accept email or username at login; username optional (AuthService, OAuth2StandardController, RuleSet)
  • chore(model): regenerate Users ORM for optional username
  • feat(frontend): email-first login + registration UI (admin, user frontend, login.csp)
  • docs(design): email-first auth design + implementation plan

Build / scripts / docs / tooling

  • feat(deploy): SMTP email config in docker stack + ops docs + verification checklist
  • docs: consolidate design docs under docs/design
  • fix(scripts): full_test.bat robust under bash/MSYS (replace shadowed timeout/find)
  • feat(scripts): friendly prerequisites hint when build.sh CMake configure fails
  • docs(scripts): document full-test.sh Linux/macOS prerequisites
  • chore(config): workspace tooling settings (deny .env* reads, fix cmake source dir, wechat-notify skill)
  • fix(.vscode): correct workspace config after OAuth2Backend rename
  • docs(graphify): refresh GRAPH_REPORT.md

Test plan

  • ./manage.sh full-test (Linux/macOS) passes — build + unit + API tests
  • ./manage.ps1 full-test (Windows) passes, incl. bash/MSYS path
  • ./manage.sh build-backend --debug configures cleanly (prereq hint triggers only on real failure)
  • Registration accepts email; rejects invalid emails; normalizes casing
  • Login works with email and with username (when provided)
  • Migration V019 + V020 apply cleanly on a fresh DB
  • docker compose up brings stack healthy with SMTP env wired

🤖 Generated with Claude Code

voidvec and others added 14 commits June 24, 2026 17:30
Email service ran in Console-only mode (emails logged, never sent) because
no SMTP env vars were wired into the compose files or documented. Add
OAUTH2_SMTP_* env passthrough to both dev and prod compose files, a SMTP
template block in the env example, and configuration guidance across the
three ops docs (production deployment, Windows Docker Desktop, verification
checklist) so verification/password-reset emails can be sent for real.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Registration accepted any non-empty string as an email and stored it
verbatim, so neither format nor uniqueness was enforced. Add W3C HTML5
email regex + RFC 5321 length guard (254) in a new RuleSet::registerUser
rule (replacing the misapplied login rule on /api/register), a partial
unique index on users.email (NULL exempt, email stays optional), Gmail
alias folding (dots/plus-tags for gmail.com and googlemail.com only) via
normalizeEmail, and extend users.email to VARCHAR(254). Unit tests cover
pattern accept/reject, normalization, and the length constant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
V020 migration evolves the users schema toward email as the primary
identifier:
- DROP NOT NULL on username (users may register with email only)
- Extend username VARCHAR(50) -> VARCHAR(100) to match USERNAME_PATTERN
- Relax CHECK constraint: NULL allowed; non-null must still be non-empty

UNIQUE constraint is intentionally kept: PostgreSQL exempts NULL from
uniqueness, so optional-but-unique works for those who set a username
while allowing multiple username-less accounts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Login now treats the identifier field as either email or username:
- AuthService::validateUser splits on '@': emails are normalized then
  looked up by email column, otherwise looked up by username.
  USERNAME_PATTERN forbids '@', so the two branches are mutually
  exclusive.
- RuleSet::login reads the 'username' param as a generic identifier and
  validates email format when an '@' is present (keeps the API param
  name for backward compatibility).
- RuleSet::registerUser makes email required and username optional
  (length-checked only when non-empty).

OIDC userinfo name claim now resolves to username preferred, falling
back to email when username is absent, so strict OIDC clients never see
an empty/missing name for email-first accounts:
- AuthService::getUserInfo (service path)
- OAuth2StandardController::userInfo (storage path; storage->getUserInfo
  returns {id, username?, email?} with no name field, so the claim is
  computed there rather than read from storage).

Registration no longer sets username when empty (CHECK constraint would
otherwise reject the empty string).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Regenerated via drogon_ctl against the V020 schema (full-test step 2),
reflecting the now-nullable username column: metadata marks it
not-null=0, length 100, and validation permits NULL in
validateJsonForCreation / validJsonOfField. setUsernameToNull is
generated alongside the existing setters.

EmailNormalizerTest.cc: whitespace alignment only (no logic change).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Login pages (user frontend, admin console, server-side CSP form):
  relabel the identifier field to "Email or Username" with an email
  placeholder.
- Registration page: make Email the primary/required field and mark
  Username as optional (non-required, no autocomplete constraint).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- email-first-auth-design.md: technical design covering email as primary
  identifier, optional username, @-split login dispatch, Gmail alias
  normalization, anti-enumeration, and the OIDC name-claim fallback.
- email-first-auth-implementation-plan.md: 6-stage implementation plan
  (db migration, backend auth, model regen, frontend, testing,
  integration/commits) with review decisions recorded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reorganize scattered design/analysis documents into the docs/design tree
and add explicit prefixes to frontend docs for clarity:
- docs/backend/*         -> docs/design/* (endpoint test analysis/plan)
- docs/frontend/*        -> docs/design/* (test coverage gap/exec plan)
                         + docs/frontend/oauth2_* (design/impl plan)
- superpowers/plans/*    -> superpowers/validation/*

Also remove the obsolete superpowers/migration-guide.md (no longer
applicable). Git detected the moves as renames, so history is preserved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- .claude/settings.json: deny Read on .env* files to keep secrets out
  of context.
- .vscode/settings.json: correct cmake.sourceDirectory to repo root.
- .claude/skills/wechat-notify/: add wechat notification skill.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Step 5 (server startup) and shutdown used 'timeout /t' and 'find /I /N',
both of which the Unix MSYS 'timeout'/'find' shadow when the .bat runs
via bash/MSYS (e.g. 'powershell -File manage.ps1 full-test' launched
from Git Bash). The shadowed commands misreport the server as not
running, so full-test falsely failed at Step 5 even though the server
started fine (confirmed in drogon.log).

Replace with MSYS-name-clash-free equivalents:
- 'timeout /t 8 /nobreak' -> 'ping 127.0.0.1 -n 9' (~8s wait; MSYS has
  no ping clash, resolves to Windows builtin)
- 'find /I /N' -> 'findstr /I' (MSYS has no findstr, always resolves to
  Windows builtin)

Verified: findstr/ping both resolve to C:/Windows/system32/ under MSYS,
and the detect logic behaves identically under cmd, PowerShell, and
bash/MSYS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a header comment noting the one-time setup required before the first
run: install system deps (--install-deps), build/install drogon
(--build-drogon), align OAUTH2_DB_* env, and ensure PostgreSQL + Redis
are running. Explains why: build.sh links against system packages on
Linux/macOS (no Conan), so drogon_ctl/jsoncpp must exist globally or
Step 2/3 fail.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When CMake configuration fails (e.g. "Could NOT find Drogon/Jsoncpp"),
build.sh now prints a friendly hint pointing to the one-time
prerequisites instead of only the raw CMake error. Reminds the user that
build.sh links against system packages (no Conan) on Linux/macOS and
should run --install-deps / --build-drogon first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- launch.json: remove non-existent OAuth2Backend path, use cmake.launchTargetPath
  and correct cwd to build/OAuth2Server/${buildType}
- c_cpp_properties.json: replace OAuth2Backend paths with OAuth2Plugin/OAuth2Server
- settings.local.json.example: convert to pure JSON, remove legacy OAuth2Backend refs

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Regenerated knowledge-graph audit report reflecting the current
email-first auth + tooling changeset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cae0d1d58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

)
{
auto errors = oauth2::validation::RuleSet::login(req);
auto errors = oauth2::validation::RuleSet::registerUser(req);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Parse JSON registration fields before inserting

When /api/register is called with Content-Type: application/json, this new validator reads and accepts username/password/email from the JSON body, but the controller still reads only req->getParameters() immediately afterward. For a valid JSON registration this means AuthService::registerUser receives empty strings; with V020 allowing nullable username/email, the request can insert a bogus account with no identifier and a hash of the empty password instead of the requested user.

Useful? React with 👍 / 👎.

Comment on lines 211 to +212
if (!email.empty())
newUser.setEmail(email);
newUser.setEmail(oauth2::utils::normalizeEmail(email));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize other email lookups before storing canonical emails

Storing the normalized email here changes the value persisted for inputs such as User+tag@gmail.com to user@gmail.com, but the password-reset flow still queries users with the raw submitted email (WHERE email = $1). Users who registered with a Gmail plus/dot alias or mixed-case address will not be found by password reset unless they guess the canonicalized address, so the same normalization needs to be applied to those lookup paths or the original address should be preserved separately.

Useful? React with 👍 / 👎.

-- Prerequisite: duplicate emails must be cleaned before applying.
-- The partial index (WHERE email IS NOT NULL) lets multiple users have no email.

ALTER TABLE users ALTER COLUMN email TYPE VARCHAR(254);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Widen verification-token emails with users.email

This migration starts accepting and storing users.email values up to 254 characters, but email_verification_tokens.email is still VARCHAR(100) in V010. Any newly valid address longer than 100 characters can be registered, but verification-token creation/resend will fail when it inserts the same email into the narrower table, preventing verification emails for those accounts.

Useful? React with 👍 / 👎.

@voidvec voidvec left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢提交这个 PR!整体代码架构设计良好,防枚举机制和 OIDC 的 name claim 兼容性设计非常周全。

在本地测试和代码走读过程中,我们发现了以下两个需要调整的关键问题:

1. 遗漏了关键的集成测试文件

设计文档与实施计划中明确提到将新建以下集成测试以覆盖核心场景:

  • EmailLoginTest (验证 Email 登录及 Gmail 别名逻辑)
  • RegistrationWithoutUsernameTest (验证仅 Email 注册场景)

但是在当前的提交中,并没有在 test/ 目录下找到这两个测试文件。为了避免后续迭代引入回归,建议补充这两个集成测试。

2. 注册校验层缺少对可选 username 的格式限制(安全/体验风险)

在 RuleSet::registerUser 中,当 username 非空时,仅校验了长度:

if (!username.empty() && username.length() > 100)
{
    errors.push_back("username exceeds maximum length of 100 characters");
}

由于登录分流逻辑是以是否含有 @ 符号来区分 email 与 username 的(identifier.find('@') != std::string::npos),如果注册时不对非空 username 执行 USERNAME_PATTERN 正则匹配,用户就可能注册带 @ 的 username(例如 user@name),这会导致其在登录时被误判为 email,导致此用户永久无法通过 username 登录。

建议修改:
在 RuleSet::registerUser 对非空 username 增加 USERNAME_PATTERN 的正则校验,保证不合法的字符(如 @ 等)在注册时被拦截。

voidvec added 9 commits July 1, 2026 12:24
…ames

Without this, a user could register username 'user@name'; login dispatch
(identifier.find('@')) would then treat it as an email, making the account
unreachable via username forever.
SessionController read getParameters() after RuleSet already parsed the
JSON body, yielding empty username/password/email for JSON clients. With
V020 making username optional this could persist a bogus account. Parse
the JSON body inline when Content-Type is application/json.
Registration persists normalizeEmail(email); the reset endpoint queried
users with the raw submitted email, so Gmail plus/dot-alias or mixed-case
registrants could never receive a reset link. Apply the same fold at
lookup time. Also lock the equivalence property (alias == canonical) the
fix depends on in EmailNormalizerTest.
…P2)

V019 widened users.email to 254 but email_verification_tokens.email stayed
at 100 (V010), so verification-token insertion failed for long-but-valid
addresses. Align to 254. password_reset_tokens has no email column.
AdminController::updateUser stored the raw admin-supplied email while
registration normalizes, so an admin setting a Gmail plus/dot alias or
mixed-case address would leave the user unable to log in or reset their
password (those paths look up the canonical form). Normalize on write.
…tion tests (PR #6)

Design docs promised EmailLoginTest and RegistrationWithoutUsernameTest;
they were missing. Add integration coverage for: email-only JSON
registration (username NULL, canonical email), login dispatch invariant
('@' => email), Gmail-alias folding, and canonical-email password-reset
lookup.
…eTest

Add the missing <oauth2/models/Users.h> include required by the ORM
insert that exercises the email-only registration contract.
clang-format normalization (line wrapping, alignment, trailing newline)
applied to RegisterRuleSetTest.cc and EmailLoginTest.cc.
Add docs/design/pr6-review-fixes-plan.md capturing the analysis and
implementation plan for the PR #6 review findings (JSON register body,
username pattern, password-reset normalization, email column width,
admin write normalization, plus missing integration tests).

Add .superpowers/ to .gitignore — it holds SDD scratch files (task
briefs, reports, progress ledger) that should not be version-controlled.
@voidvec

voidvec commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

All 5 review findings addressed + 1 additional gap surfaced by auditing every email-touching code path. Pushed in commits 474cc9d..2581611. Verified with Debug build + real PostgreSQL (storage_type=postgres): 3 unit + 3 integration tests pass.

Codex P1 — JSON registration body not parsed (SessionController.cc)

Fixed in ee3d62e. SessionController::registerUser now parses the JSON body inline when Content-Type: application/json (previously read getParameters(), yielding empty fields). Locked by Integration_Registration_EmailOnly_JsonBody.

Codex P2 — Password-reset lookup not normalized (AuthService.cc)

Fixed in 94ccb35. PasswordResetController::request now calls normalizeEmail() before the WHERE email = $1 lookup, so Gmail plus/dot-alias or mixed-case registrants are found. The equivalence property (alias == canonical) is locked in EmailNormalizerTest.

Codex P2 — email_verification_tokens.email too narrow (V019)

Fixed in 83146ce as a new immutable migration V021__widen_email_verification_tokens_email.sql (VARCHAR(100) → 254). Note: password_reset_tokens (V009) has no email column, so it is unaffected — only email_verification_tokens needed widening.

Owner ① — Missing integration tests

Added in cf6f5b0: RegistrationWithoutUsernameTest.cc (email-only JSON registration) and EmailLoginTest.cc (login dispatch invariant + Gmail-alias folding + canonical-email reset lookup).

Owner ② — username lacks USERNAME_PATTERN on register (RuleSet.cc)

Fixed in 474cc9d. Non-empty username now must match ^[a-zA-Z0-9_]{1,100}$, preventing e.g. user@name from registering and then being misrouted by login dispatch (identifier.find('@')). Locked by RegisterRuleSet_RejectsAtSignInUsername.

Additional (audit) — admin updateUser wrote raw email (AdminController.cc)

While auditing every users.email read/write path, I found AdminController::updateUser stored the raw admin-supplied email while registration normalizes — so an admin setting a Gmail alias would leave the user unable to log in or reset. Fixed in 94b5c47 (normalizeEmail on write).

Build note: the Release build fails to link due to a pre-existing drogon CRT mismatch (drogon.lib built MDd vs project MD) — unrelated to these changes. Debug build links and the full new test set passes.

The blanket `brew upgrade` upgraded every preinstalled Homebrew
package, including runner-image preinstalls like `xcodes` that
currently lack an arm64 bottle — failing the macOS job in ~12s
during dependency setup, before any project code built. `brew
update` only refreshes the formula index; explicit `brew install`
steps still pin what we actually need.
@voidvec
voidvec merged commit b850e57 into master Jul 1, 2026
3 checks passed
voidvec added a commit that referenced this pull request Jul 1, 2026
SessionController read getParameters() after RuleSet already parsed the
JSON body, yielding empty username/password/email for JSON clients. With
V020 making username optional this could persist a bogus account. Parse
the JSON body inline when Content-Type is application/json.
voidvec added a commit that referenced this pull request Jul 1, 2026
Registration persists normalizeEmail(email); the reset endpoint queried
users with the raw submitted email, so Gmail plus/dot-alias or mixed-case
registrants could never receive a reset link. Apply the same fold at
lookup time. Also lock the equivalence property (alias == canonical) the
fix depends on in EmailNormalizerTest.
voidvec added a commit that referenced this pull request Jul 1, 2026
…P2)

V019 widened users.email to 254 but email_verification_tokens.email stayed
at 100 (V010), so verification-token insertion failed for long-but-valid
addresses. Align to 254. password_reset_tokens has no email column.
voidvec added a commit that referenced this pull request Jul 1, 2026
AdminController::updateUser stored the raw admin-supplied email while
registration normalizes, so an admin setting a Gmail plus/dot alias or
mixed-case address would leave the user unable to log in or reset their
password (those paths look up the canonical form). Normalize on write.
voidvec added a commit that referenced this pull request Jul 1, 2026
…tion tests (PR #6)

Design docs promised EmailLoginTest and RegistrationWithoutUsernameTest;
they were missing. Add integration coverage for: email-only JSON
registration (username NULL, canonical email), login dispatch invariant
('@' => email), Gmail-alias folding, and canonical-email password-reset
lookup.
voidvec added a commit that referenced this pull request Jul 1, 2026
Add docs/design/pr6-review-fixes-plan.md capturing the analysis and
implementation plan for the PR #6 review findings (JSON register body,
username pattern, password-reset normalization, email column width,
admin write normalization, plus missing integration tests).

Add .superpowers/ to .gitignore — it holds SDD scratch files (task
briefs, reports, progress ledger) that should not be version-controlled.
voidvec added a commit that referenced this pull request Jul 29, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
voidvec added a commit that referenced this pull request Jul 29, 2026
…) + comment #4/#8/#9

P1 #6 (RFC 6749 §5.1): expires_in / id_token exp / device refresh TTL were
hardcoded 3600/2592000; now use configured access_token_ttl/refresh_token_ttl
(OAuth2Plugin getAccessTokenTtl()/getRefreshTokenTtl() accessors). 6 sites:
TokenService auth_code expires_in + id_token exp + refresh expires_in;
client_credentials + device_code issuance in TokenEndpointController.

P1 #5 (RFC 8628 §3.4): device_code redemption now authenticates by client_type
-- CONFIDENTIAL clients require a valid client_secret (validateClient); PUBLIC
clients keep the client_id-vs-device-row binding. Lookup wrapped in a local
lambda captured BY VALUE (not [&]) because it runs from getClient's async
callback after token() has returned -- [&] would dangle deviceCodeHash/dbClient.

P1 #3 (RFC 6749 §4.1.2 single-use): device-code redemption check-then-delete
was non-atomic (two concurrent redemptions both issued). Replaced with a
pre-issue atomic UPDATE...WHERE status='approved' RETURNING; affected-row gate
makes exactly one concurrent winner issue, loser gets invalid_grant (fail-
closed). UPDATE...RETURNING is a db-operations.md raw-SQL exemption.

Comment-only (#4 [this] capture, #8 validateAccessToken no-self, #9 JWKS empty
response): document existing-correct behavior, deter repeat review reports.

Tests (live-server integration, PG+Redis): TokenExpiryTtlConfigTest,
DeviceCodeClientAuthTest (conf no-secret rejects / conf secret ok / pub ok),
DeviceCodeRaceConditionTest (concurrent redemption -> exactly one wins).
All pass + no regressions (RFC6749 compliance 4504 assertions, auth_code E2E,
refresh rotation, authorize PKCE passthrough).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@voidvec
voidvec deleted the feat/email-first-auth-and-tooling branch July 31, 2026 06:17
voidvec added a commit that referenced this pull request Aug 12, 2026
… refs

Pre-existing working-tree edits from the design review pass:
- Qualify IdentityService.cc / ScopeDecisionEngine.cc paths to their
  post-refactor libs/ locations (libs/drogon/src/services/,
  libs/oauth2/src/access/).
- Correct finding #6: the third insufficient_scope emitter is the
  userinfo endpoint, not the token issuer; note its direct-HttpResponse
  bypass of ErrorResponder.
- Add V006 file:line evidence (V006__oauth2_scopes.sql:46-53) for the
  scope-catalog rows; clarify read/write are real seeded rows slated for
  removal in the V006 rewrite (decision #2, §10.1).
voidvec added a commit that referenced this pull request Aug 14, 2026
… fixes

Critical #1: soft-deleted users can no longer log in
- PostgresIdentityRepository: add deleted_at IS NULL filter to
  findByEmail, findByUsername, findById, findByPublicSub, getUserInfoWithRoles,
  getRoles(subject) — blocks login, userinfo, and token-issuance role resolution
- deleteUser: revoke all access + refresh tokens for the deleted user
  (introspection/refresh copy subject from token rows, never query users)

High #2: getUser now returns org_id in the response JSON

Medium #3: listUsers search escapes LIKE wildcards (%/_) in query param q

Medium #5: createUser/updateUser guard org_id/locked type coercion
  with isInt()/isBool() to prevent uncaught Json::LogicError in async callbacks

Medium #6: deleteUser rejects self-deletion (admin cannot delete own account)
voidvec added a commit that referenced this pull request Aug 14, 2026
… fixes

Critical #1: soft-deleted users can no longer log in
- PostgresIdentityRepository: add deleted_at IS NULL filter to
  findByEmail, findByUsername, findById, findByPublicSub, getUserInfoWithRoles,
  getRoles(subject) — blocks login, userinfo, and token-issuance role resolution
- deleteUser: revoke all access + refresh tokens for the deleted user
  (introspection/refresh copy subject from token rows, never query users)

High #2: getUser now returns org_id in the response JSON

Medium #3: listUsers search escapes LIKE wildcards (%/_) in query param q

Medium #5: createUser/updateUser guard org_id/locked type coercion
  with isInt()/isBool() to prevent uncaught Json::LogicError in async callbacks

Medium #6: deleteUser rejects self-deletion (admin cannot delete own account)
voidvec added a commit that referenced this pull request Aug 21, 2026
perf definitively blocked by stock WSL2 kernel (hardware PMU absent,
timer sampling delivers no user-space samples; evidence archived;
custom kernel = official path, out of scope). gdb route fixed with
three keys: (1) -fno-omit-frame-pointer -g build, (2) gdb 'set sysroot
/' — the target: prefix EPERM cross-container trap, (3) attach to the
forked worker PID 8, not supervisor PID 1. Full recipe in §3.2.

35 rounds x 26 threads under S6 c64 load: 74% epoll idle, 9% socket
writes (incl. libpq pqSendSome on-wire evidence), NEW finding ~4%
glibc tz-lock contention from a third-party localtime-class call
(first-party ruled out by grep; exact call site LTO-inlined), CPU
compute <2% — confirms RTT-dominance; lever #6 added to §4.
voidvec added a commit that referenced this pull request Aug 22, 2026
perf definitively blocked by stock WSL2 kernel (hardware PMU absent,
timer sampling delivers no user-space samples; evidence archived;
custom kernel = official path, out of scope). gdb route fixed with
three keys: (1) -fno-omit-frame-pointer -g build, (2) gdb 'set sysroot
/' — the target: prefix EPERM cross-container trap, (3) attach to the
forked worker PID 8, not supervisor PID 1. Full recipe in §3.2.

35 rounds x 26 threads under S6 c64 load: 74% epoll idle, 9% socket
writes (incl. libpq pqSendSome on-wire evidence), NEW finding ~4%
glibc tz-lock contention from a third-party localtime-class call
(first-party ruled out by grep; exact call site LTO-inlined), CPU
compute <2% — confirms RTT-dominance; lever #6 added to §4.
voidvec added a commit that referenced this pull request Aug 22, 2026
perf definitively blocked by stock WSL2 kernel (hardware PMU absent,
timer sampling delivers no user-space samples; evidence archived;
custom kernel = official path, out of scope). gdb route fixed with
three keys: (1) -fno-omit-frame-pointer -g build, (2) gdb 'set sysroot
/' — the target: prefix EPERM cross-container trap, (3) attach to the
forked worker PID 8, not supervisor PID 1. Full recipe in §3.2.

35 rounds x 26 threads under S6 c64 load: 74% epoll idle, 9% socket
writes (incl. libpq pqSendSome on-wire evidence), NEW finding ~4%
glibc tz-lock contention from a third-party localtime-class call
(first-party ruled out by grep; exact call site LTO-inlined), CPU
compute <2% — confirms RTT-dominance; lever #6 added to §4.
voidvec added a commit that referenced this pull request Aug 30, 2026
…loor, bootstrap self-heal, review cleanups

Address PR #141 review (1 must-fix, 8 should-fix, quick considers):

- #1 consent_csrf declared as a required query parameter in openapi.yaml
  and the C++ endpoint doc registration; apps/server/docs/api/openapi.json
  regenerated from a live server run; Python/Go clients regenerated.
- #2 nonce one-shot is now atomic: the find/verify/erase sequence is
  serialized by a process-wide mutex (consent traffic is tiny; in-process
  session storage).
- #3 identity AuthService no longer captures this in the async validateUser
  callback — the legacy-hash policy flag is value-captured
  (db-operations rule 4).
- #4/#12 AdminBootstrapper reworked as ensure-* steps: an existing admin
  user row is reused and role/mapping completed (partial failures self-heal
  on restart); the random password is printed only after the insert
  succeeded; a mapping failure no longer reports created=true.
- #5 POST /api/admin/users enforces auth.min_password_length
  (VALIDATION_PASSWORD_TOO_SHORT) — closing the admin bypass.
- #6 consent integration tests reworked: missing-nonce now drives the real
  authorize-minted slot (400), deny-to-unregistered-uri (400, no Location)
  and deny-to-registered-uri (302 access_denied) branches are covered.
- #7/#8 deployment.md: auto-bootstrap wording fixed, bogus ADMIN_SALT
  removed (PBKDF2 keeps salt empty); website i18n error table mirrored
  (3014/4007).
- #9 main.cc bootstrap probes with backoff (5 attempts) and LOG_WARN on
  failure instead of a single silent 2s probe.
- #13 unique-violation detection layered (SqlError 23505 -> constraint
  name -> english/zh localized text), mirroring the
  PostgresSocialAccountRepository pattern.
- #11 gate-4 comment corrected; #15 CHANGELOG duplicate Unreleased merged;
  #17 AGENTS.md consent.csp entry removed.

Considered-but-not-taken: #10 multi-slot nonces (tracked follow-up), #14
admin UI hardcode (server now enforces; hint stays), #18 MFA-pending
session through consent (pre-existing authorize behavior, tracked).
voidvec added a commit that referenced this pull request Aug 30, 2026
…loor, bootstrap self-heal, review cleanups

Address PR #141 review (1 must-fix, 8 should-fix, quick considers):

- #1 consent_csrf declared as a required query parameter in openapi.yaml
  and the C++ endpoint doc registration; apps/server/docs/api/openapi.json
  regenerated from a live server run; Python/Go clients regenerated.
- #2 nonce one-shot is now atomic: the find/verify/erase sequence is
  serialized by a process-wide mutex (consent traffic is tiny; in-process
  session storage).
- #3 identity AuthService no longer captures this in the async validateUser
  callback — the legacy-hash policy flag is value-captured
  (db-operations rule 4).
- #4/#12 AdminBootstrapper reworked as ensure-* steps: an existing admin
  user row is reused and role/mapping completed (partial failures self-heal
  on restart); the random password is printed only after the insert
  succeeded; a mapping failure no longer reports created=true.
- #5 POST /api/admin/users enforces auth.min_password_length
  (VALIDATION_PASSWORD_TOO_SHORT) — closing the admin bypass.
- #6 consent integration tests reworked: missing-nonce now drives the real
  authorize-minted slot (400), deny-to-unregistered-uri (400, no Location)
  and deny-to-registered-uri (302 access_denied) branches are covered.
- #7/#8 deployment.md: auto-bootstrap wording fixed, bogus ADMIN_SALT
  removed (PBKDF2 keeps salt empty); website i18n error table mirrored
  (3014/4007).
- #9 main.cc bootstrap probes with backoff (5 attempts) and LOG_WARN on
  failure instead of a single silent 2s probe.
- #13 unique-violation detection layered (SqlError 23505 -> constraint
  name -> english/zh localized text), mirroring the
  PostgresSocialAccountRepository pattern.
- #11 gate-4 comment corrected; #15 CHANGELOG duplicate Unreleased merged;
  #17 AGENTS.md consent.csp entry removed.

Considered-but-not-taken: #10 multi-slot nonces (tracked follow-up), #14
admin UI hardcode (server now enforces; hint stays), #18 MFA-pending
session through consent (pre-existing authorize behavior, tracked).
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.

2 participants