Repository navigation
Standardize log levels + broaden local dev/CI config - #17
Merged
Merged
Conversation
1. pre-commit 钩子缺失构建目录守卫 (Medium) - .claude/settings.json: 在 cd build/tests 前添加目录存在性检查 - 缺失时输出构建引导而非误导性的 'Tests failed' 2. MCP 配置明文凭据已被版本控制跟踪 (Medium) - 将 .mcp.json 从 git 跟踪中移除,加入 .gitignore - 新建 .mcp.json.example 使用环境变量引用 3. 迁移 Skill 引用过时版本号 (Low) - .claude/skills/create-migration/SKILL.md: 移除硬编码 V018 版本号 - 改为动态 ls 检查命令,从根本上消除版本号漂移
Normalize the six-level logging scheme (trace/debug/info/warn/error/fatal) end to end: port, call sites, config defaults, ctest output, and docs. Framework: - Add LogLevel::Trace to the ILogger port (ILogger.h) and route it through DrogonLogger (LOG_TRACE). Previously Trace was absent from the enum and silently dropped by the adapter, yet 39 LOG_TRACE call sites (generated ORM model headers) already existed -- the "no LOG_TRACE in scope" premise was stale. Add a FakeLoggerTest.CapturesTraceLevel regression guard. Call-site audit (~22 misclassified sites, non-generated code only): - Recoverable failures that still succeed: error -> warn (AuthService role-assign/default-role, PostgresIdentityRepository same, MfaController pending-clear, OAuth2CleanupService background failures, ControllerRegistration plugin-not-found fallback). - Operations that fail outright with no fallback: warn/debug -> error (AuthService validate-user/get-user-info DB exception paths, reset-login- counter write, PostgresTokenRepository introspect-count & revocation-audit writes). - DB-exception paths blended into not-found branches: debug -> warn (Postgres/Redis grant & token get-or-not-found). - Audit-worthy business successes: debug -> info (token revocation, consent save/revoke, cleanup-cycle start, RedisRepositoryBase init). Config defaults: - config.prod.json: WARN -> INFO (per the "production defaults to info+" rule). - config.dev.json: revert the stray WARN back to DEBUG (dev = debug). config.json/config.ci.json already DEBUG, unchanged. CTest minimal output: - Drop -V from test.bat and CI (_build-test.yml, _sdk-smoke.yml) so only failed tests print their logs plus the pass/fail/total summary. - -q/--quiet now maps to ctest -Q (summary only); --output-on-failure stays the default. test.sh was already minimal. Docs: - observability.md §3.2: full six-level table, conventions, dynamic log_level adjustment, and the Domain-via-ILogger / Adapter-via-LOG_* layering rule. - testing-guide.md: document the minimal-output ctest strategy. - CONTRIBUTING.md: new "Logging" section with a quick-decision table and a note on the deliberately-deferred policy-call sites (audit residue). Verified: windows-msvc build clean; ctest -C Release --output-on-failure => 299/299 passed, 0 failed (incl. the new Trace regression test).
… stub Align the local-development and CI runtime configs with the ports the frontends/tooling actually use, and stub out the GitHub external-auth provider mirroring the existing wechat placeholder. - cors.allow_origins: drop the redundant http://127.0.0.1:5173 (the localhost form already covers it) and add localhost:5174/8080/8081 so the alternate Vite dev port and the backend/swagger ports are accepted. - vue-client.redirect_uri: also accept http://localhost:8080/callback alongside the 5173 callback. - external_auth.github: add a placeholder block (YOUR_GITHUB_CLIENT_ID / YOUR_GITHUB_CLIENT_SECRET) matching the existing wechat placeholder pattern; real credentials are supplied via env-var overrides at runtime. Applies to config.json, config.dev.json, and config.ci.json.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The LogLevel::Trace addition in ILogger.h is a public SDK header change (under include/authforge/**), so the api-diff guard flags it as additive drift on CI. Per the tool's own guidance (and CONTRIBUTING.md), additive changes are ratified by regenerating the baseline -- no version bump is required for pure additions. Regenerated via: python tools/api-diff/api_diff.py --update-baseline Verified: the only delta is the single "Trace," enum line; the guard now reports "OK (164 headers match baseline)".
wangrh0909
approved these changes
Aug 4, 2026
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).
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
Two related
chorecommits bundled here for review.1.
chore(logging): standardize log levels across the codebaseNormalizes the six-level logging scheme (trace/debug/info/warn/error/fatal) end to end: port, call sites, config defaults, ctest output, and docs.
Framework
LogLevel::Traceto theILoggerport and routes it throughDrogonLogger(LOG_TRACE). Previously Trace was absent from the enum and silently dropped by the adapter, yet 39LOG_TRACEcall sites (generated ORM model headers) already existed — the "no LOG_TRACE in scope" premise was stale.FakeLoggerTest.CapturesTraceLevelregression guard.Call-site audit (~22 misclassified sites, non-generated code only)
error→warn(AuthService role-assign/default-role, PostgresIdentityRepository, MfaController pending-clear, OAuth2CleanupService background failures, ControllerRegistration plugin-not-found fallback).warn/debug→error(AuthService validate-user/get-user-info DB exception paths, reset-login-counter write, PostgresTokenRepository introspect-count & revocation-audit writes).debug→warn(Postgres/Redis grant & token get-or-not-found).debug→info(token revocation, consent save/revoke, cleanup-cycle start, RedisRepositoryBase init).Config defaults
config.prod.json: WARN → INFO (per the "production defaults to info+" rule).config.dev.json: revert stray WARN → DEBUG (dev = debug).config.json/config.ci.jsonalready DEBUG, unchanged.CTest minimal output
-Vfromtest.batand CI (_build-test.yml,_sdk-smoke.yml) so only failed tests print their logs plus the pass/fail/total summary.-q/--quietnow maps to ctest-Q(summary only);--output-on-failurestays the default.Docs
observability.md §3.2: full six-level table, conventions, dynamiclog_leveladjustment, Domain-via-ILogger/ Adapter-via-LOG_*layering rule.testing-guide.md: document the minimal-output ctest strategy.CONTRIBUTING.md: new "Logging" section with quick-decision table + note on deliberately-deferred policy-call sites (audit residue).2.
chore(config): broaden local dev/CI CORS origins and add GitHub OAuth stubcors.allow_origins: drop redundanthttp://127.0.0.1:5173, addlocalhost:5174/8080/8081.vue-client.redirect_uri: addhttp://localhost:8080/callback.external_auth.github: placeholder block (YOUR_GITHUB_CLIENT_ID/YOUR_GITHUB_CLIENT_SECRET) mirroring the existingwechatplaceholder — real creds via env-var overrides at runtime.config.json,config.dev.json,config.ci.json.Verification
windows-msvcpreset — clean (C4819 warnings are pre-existing UTF-8/codepage noise, unrelated).ctest -C Release --output-on-failure→ 299/299 passed, 0 failed (incl. the newCapturesTraceLevelregression test).Notes / out of scope
LOG_*macro call sites to theILoggerport (design.md §5.6 Task-14) is not included — that's a separate mechanical PR.[METRIC]log-based metric emissions at info, routine 401/403 denials at warn) are intentionally left for a deliberate follow-up; documented in CONTRIBUTING.md as audit residue.libs/storage-postgres/{src/models,include/.../models}/) correctly uses fatal/trace — untouched.