ryan
4e6209bf61
chore(autoresearch): log iter 2 (debt 100 -> 95)
2026-08-29 07:59:39 +08:00
ryan
37ad58699d
autoresearch iter 2: compare error sentinels with errors.Is
...
Five sites used == against sentinels (redis.Nil, ingest.ErrForbidden,
errs.ErrDatabaseUninitialized). The neighbouring not-found checks already
went through errors.Is helpers, so a wrapped error would silently downgrade
a 403 to a 400 and a 500 to a 400.
2026-08-29 07:58:59 +08:00
ryan
edf0c0e934
chore(autoresearch): log iter 1 (debt 102 -> 100, proven fix)
2026-08-29 07:57:10 +08:00
ryan
1c5731bf75
autoresearch iter 1: keep Using2/Using3 dependency causes reachable
...
Using2/Using3 flattened per-dependency injection failures with %v while
Using1 wrapped with %w, so errors.Is could not see ErrServiceNotFound
through a multi-dependency resolution failure.
2026-08-29 07:56:02 +08:00
ryan
5971e2a9ed
chore(autoresearch): re-baseline harness on pinned real-risk yardstick
...
The committed golangci gate now reports 0 issues, so the previous
lint_issues metric was saturated and could no longer measure progress.
Measure debt against an immutable .auto/lint.ref.yaml snapshot that adds
analyzers for genuine defects (panics, error unwrapping, dead stores,
missing enum cases, method ordering, suppression hygiene) while excluding
cosmetic churn (tagliatelle, wrapcheck). Guard enforces build, vet, tests,
the Cordis architecture gate, and anti-cheat floors: the yardstick cannot
be edited, the project gate may only be strengthened, nolint directives may
only shrink, and no test may disappear.
2026-08-29 07:52:03 +08:00
ryan
4f30e2d57b
fix(docker): repair embed packaging for backend/ module layout
...
The Dockerfiles and the release workflow still assumed the pre-refactor tree:
go.mod, go.sum and main.go now live under backend/, so `COPY go.mod go.sum`
failed outright, and the Go module is the bare `Wavelet`, so the buildinfo
ldflags pointed at github.com/Rain-kl/Wavelet and stamped nothing. The
frontend export was also overlaid onto ./plugins/... rather than the
driver_http path that `//go:embed all:dist` actually reads.
Repoint every packaging path at backend/, correct the ldflags module prefix,
and assert dist/index.html in both docker stages, in build-embedded and in the
release workflow, so a silently empty static export can no longer ship an
API-only binary. Also carry pnpm-workspace.yaml into the cached install layer.
2026-08-29 07:40:57 +08:00
ryan
f4975d6732
refactor(plugins): restructure admin and message_gateway into standard layered sub-packages
2026-08-28 22:33:26 +08:00
ryan
85b383a4e0
skills: autoresearch
2026-08-28 20:36:15 +08:00
ryan
b68060255f
docs(plugins): add plugin layered architecture spec and templates
2026-08-28 20:35:11 +08:00
ryan
0035e548a5
fix(risk_control,message_gateway): fix SQL LIKE escape syntax and use UserService contract
2026-08-28 20:19:24 +08:00
ryan
df351cbd33
refactor(core): decouple gin from pkg/util and reduce code duplication
2026-08-28 20:15:47 +08:00
ryan
c52b7c4abf
test(upload): move storage task fixtures to in-memory mock
2026-08-28 18:54:23 +08:00
ryan
4d6be2fa77
fix(drivers): propagate app-lifetime context through inproc cron/worker drivers
...
cron 触发与 worker 执行的任务现在继承应用生命周期 context(关闭时级联取消,带超时子上下文),
替代裸 context.Background()。contextcheck 清零。
lint_issues 26→24
2026-08-28 17:04:44 +08:00
ryan
02b93a3b20
chore(autoresearch): log iter 2-3
2026-08-28 16:53:51 +08:00
ryan
867fcb2288
refactor: revive cleanup — unused params to _, add missing doc comments
...
- admin/db_helper GetCache/GetUserService/GetAuthService: ctx -> _ (签名对称保留)
- validateMergedStorageConfig / ParseMigrationTargetConfig / MockStorageService.Put 未用参数 -> _
- SetDBServiceForTest、StorageDriver 常量组补充文档注释
lint_issues 33→26
2026-08-28 16:53:32 +08:00
ryan
6e12a7fd5d
fix(admin): propagate cache errors in FlushTaskExecutionLog
...
缓存故障(非 ErrCacheMiss)不再被静默吞掉:上抛包装错误,避免缓冲任务日志丢失并误报持久化成功;
ErrCacheMiss 仍视为无日志的正常路径。附 3 个回归测试(故障/未命中/持久化+清理)。
lint_issues 34→33 (nilerr 清零)
2026-08-28 16:50:03 +08:00
ryan
cf85a56aa7
refactor: eliminate string/magic-number literals (goconst, mnd) and fix const-type grouping (SA9004)
...
- upload/task: taskCategoryUpload/taskQueueDefault 常量替代 8 处字面量
- admin: 复用既有 logDBNameSQLite 常量替代 3 处 "sqlite" 字面量
- pkg/cache/disk: defaultCleanupInterval 命名常量
- driver_asynq_worker/executor: 分离 contextKey 类型常量组
lint_issues 45→34, tests 44/44
2026-08-28 16:38:18 +08:00
ryan
528240026d
chore(lint): unify formatting on golangci-lint fmt (gofumpt), uncap issue reporting, fix gofumpt drift
...
- make format 现在与 code-check 使用同一格式化器(golangci-lint fmt),消除 goimports -local 与 gofumpt 的格式拉锯
- .golangci.yml 关闭默认 50/3 截断,完整上报所有问题(只增强不弱化)
- 全库 gofumpt 规范化(203 files, 纯格式无行为变更)
2026-08-28 16:31:53 +08:00
ryan
078ad9b2f3
chore(autoresearch): init cordis-quality session files
2026-08-28 16:21:34 +08:00
ryan
3a61c38dc5
fix(core): delegate driver and task extension lookups to root context and improve test reliability
2026-08-28 16:09:18 +08:00
ryan
7fca53823a
feat(cmd): restore startup banner display in CLI entrypoints
2026-08-28 15:46:58 +08:00
ryan
3df621637f
fix(db): ensure sqlite data directory exists before opening database
2026-08-28 15:42:24 +08:00
ryan
692b4b4851
feat(db): split migrations into dialect-specific sqlite and postgres packages
2026-08-28 15:36:03 +08:00
ryan
06508b6f13
refactor(drivers): decouple inproc cron from inproc worker and satisfy linter
2026-08-28 15:17:11 +08:00
ryan
0ff117da47
feat(cmd): support dynamic zero-redis pluggable assembly in app bootstrap
2026-08-28 15:15:26 +08:00
ryan
e434e6dc0a
feat(drivers): provide TaskService implementation in inproc worker
2026-08-28 15:14:27 +08:00
ryan
f048dc528e
fix(docs): move swagger generated docs.go into backend/docs module directory
2026-08-28 15:13:34 +08:00
ryan
25647df3cf
feat(drivers): implement in-process cron scheduler driver plugin
2026-08-28 15:13:24 +08:00
ryan
d8e69bb31b
feat(drivers): implement in-process async worker driver plugin
2026-08-28 15:12:42 +08:00
ryan
98d2c1cbd0
feat(infra): implement zero-dependency pure in-memory cache plugin
2026-08-28 15:11:46 +08:00
ryan
acad091127
docs: add implementation plan for zero-redis pluggable architecture
2026-08-28 15:11:03 +08:00
ryan
299ac30ee4
refactor(core): align with cordis spatiotemporal composability architecture
...
- Purify core micro-kernel by removing context hardcoded helpers and reverse dependencies
- Eliminate init() side effects in infra plugins with reversible lifecycle disposal
- Completely isolate plugins by removing cross-plugin imports and using core/contracts
- Introduce TaskService and RiskControlService contracts for unified cross-plugin APIs
- Regenerate Swagger documentation and update developer guide matrix
- Achieve 0 violations in check_cordis_architecture.sh and 100% test pass
2026-08-28 15:05:31 +08:00
ryan
fc7fae7b0e
docs: add design spec for zero-redis pluggable architecture
2026-08-28 14:02:28 +08:00
ryan
48211fa587
chore: code-check
2026-08-28 13:42:49 +08:00
ryan
9213ee79b3
refactor(core): finalize context test and standalone repository fallback
2026-08-28 13:38:22 +08:00
ryan
a296818922
refactor(user): decouple repository from direct database infra import
2026-08-28 13:37:13 +08:00
ryan
3570ccd5c3
feat(core): implement plugin fiber state machine and reactive dependency reconciler
2026-08-28 13:35:43 +08:00
ryan
33294b3fae
feat(core): implement scoped revertible effects for context extpoints
2026-08-28 13:34:07 +08:00
ryan
0b4e928d1a
docs(core): add cordis architecture alignment implementation plan
2026-08-28 13:32:55 +08:00
ryan
0bc19e34cb
docs(core): add cordis architecture alignment design spec
2026-08-28 13:32:05 +08:00
ryan
b92ba54707
docs(core): update developer guide and white paper with cordis composability standards
2026-08-28 13:30:47 +08:00
ryan
e19bf36580
refactor(core): align architecture with cordis spatiotemporal composability
2026-08-28 13:28:58 +08:00
ryan
9f8890d159
refactor(module): simplify module name to Wavelet and standardize import paths
...
- Declared module Wavelet in backend/go.mod
- Replaced github.com/Rain-kl/Wavelet/ with clean Wavelet/ import paths across backend codebase
- Updated architecture guards, Makefile, swagger, and build tests
- 100% passed all tests, lint checks, and binary compilation
2026-08-28 13:10:30 +08:00
ryan
f2ab94501c
refactor(layout): relocate go.mod to backend/ and clean import paths to module root
...
- Relocated go.mod and go.sum into backend/ root directory
- Stripped redundant backend/ segments from all Go imports (github.com/Rain-kl/Wavelet/...)
- Unified Makefile, swagger, and build-test to execute in backend/ module context
- Ensured 100% build-test, code-check, format, and swagger pass
2026-08-28 13:01:51 +08:00
ryan
43dc97e48c
refactor(layout): consolidate backend codebase into backend/ package and clean root directory
...
- Moved cmd/, core/, plugins/, pkg/, downstream/, and main.go into backend/ directory
- Batch updated all Go source files to import github.com/Rain-kl/Wavelet/backend/...
- Updated Makefile, scripts/swagger.sh, architecture guards, and platform skills
- Passed all quality gates (100% tests, 0 lint issues, clean build)
2026-08-28 12:56:02 +08:00
ryan
33b38f8687
docs(migration): update docs and skills for new migration architecture
...
Update all relevant documentation and skills to reflect:
- w_schema_versions shared version table with plugin_id discriminator
- Single 00001_initial.sql per plugin (merged from multi-file approach)
- gooseEngine uses goose.NewProvider with goose.WithStore(sharedStore)
- pkg/migrator deleted, all 26 global SQL files moved to per-plugin
- DDL/DML single-file approach (merged seed + schema)
Files updated:
- .agents/skills/database-migration/SKILL.md (full rewrite)
- docs/WAVELET_WHITE_PAPER.md (table matrix + migration check)
- docs/WAVELET_DEVELOPER_GUIDE.md (scenario 9)
- docs/superpowers/specs/2026-08-27-cordis-plugin-architecture-design.md
- docs/superpowers/specs/2026-08-27-cordis-downstream-developer-guide.md
2026-08-28 12:45:58 +08:00
ryan
9bd012a271
fix(migration): use single w_schema_versions table with plugin_id discriminator
...
Replace per-plugin goose version tables with a single shared table
shared across all plugins, discriminated by plugin_id.
Implementation:
- Implement custom goosedb.Store (sharedStore) that uses a single
w_schema_versions(plugin_id, version_id, applied_at) table
- Each store instance binds to a specific pluginID, filtering all
CRUD operations by that plugin_id
- Goose provider created via goose.WithStore(store) instead of
WithTableName, eliminating per-plugin goose_version_* tables
- Placeholder formatting (PostgreSQL vs SQLite ?) handled by
sharedStore.placeholder() based on dialect
This means:
SELECT * FROM w_schema_versions ORDER BY plugin_id, version_id;
shows the complete migration state of every plugin at a glance.
2026-08-28 12:39:28 +08:00
ryan
65c7c282f5
refactor(migration): merge per-plugin SQL into single initial migration
...
Each plugin now has exactly one migration file (00001_initial.sql)
containing its complete table schema and seed data, replacing the
multi-file approach with split ALTER/INSERT steps.
Changes per plugin:
- auth: w_auth_sources, w_external_accounts, w_access_tokens + login session seed
- user: w_users + system user seed (removed w_access_tokens — belongs to auth)
- admin: w_system_configs, w_templates + all 32 config seeds + 2 template seeds
(removed w_schedules, w_task_executions — belong to driver plugins)
- upload: w_upload_stats + indexes + access_mode + backfill
- message_gateway: all w_message_*, w_push_*, w_push_channels, w_push_histories
- risk_control/logstore: w_user_access_logs (PG + ClickHouse)
- driver_asynq_cron: w_schedules + cleanup seed
- driver_asynq_worker: w_task_executions
All CREATE TABLE use IF NOT EXISTS, all INSERT use ON CONFLICT DO NOTHING.
go:embed patterns remain 'migrations/*.sql' — unchanged.
2026-08-28 12:28:37 +08:00
ryan
530a9dd3ee
refactor(migration): delete pkg/migrator, move SQL to per-plugin embed
...
BREAKING: pkg/migrator/ deleted entirely. Migration SQL files are now
owned by each plugin in its own migrations/ directory.
Architecture:
- Delete pkg/migrator/ (26 global SQL files + ClickHouse migration)
- Move global SQL to per-plugin migrations/ with go:embed + Register()
- Rewrite cmd/app.go gooseEngine: uses Inject[DBService] for DB, iterates
all plugin-registered MigrationEntry, runs goose.Up per entry
- core.MigrationEngine.Migrate signature changed: *Context instead of
context.Context, so engine can resolve services via IoC
Per-plugin migration ownership:
auth/ → w_access_tokens, w_auth_sources, w_external_accounts
user/ → w_users (seed system user)
admin/ → w_system_configs, w_templates (seeds)
upload/ → w_uploads, w_upload_stats
message_gateway/ → w_push_*, w_message_*
risk_control/ → w_user_access_logs (PG + ClickHouse)
driver_asynq_cron/ → w_schedules
driver_asynq_worker/ → w_task_executions
Dependencies:
- cmd/banner.go: removed migration report display (migrations are automatic)
- cmd/reset_passwd.go: removed PreRun migrator.Migrate() call
- go.mod: clickhouse-go kept (used by plugins/infra/database/clickhouse.go)
2026-08-28 12:19:25 +08:00
ryan
c9b702d234
refactor(core): fix cross-domain auth imports, unify migration, add downstream scaffold
...
Architecture:
- Move GetFromContext/SetToContext from plugins/domain/auth to pkg/util
- Move auth context key constants to core/contracts (AuthUserObjKey, AuthTokenAuthKey, etc.)
- Add AuthUserIDKey, AuthUserNameKey, GetCurrentUserID, RevokeToken to contracts.AuthService
- All 4 domain plugin Apply() methods now resolve AuthService via core.Using IoC
- Plugin route middleware uses authSvc.RequireAuthMiddleware() cast to gin.HandlerFunc
- DisallowTokenAuth added to AuthService contract
Migration:
- Replace cmd/app.go SetMigrationRunner bridge with gooseEngine implementing core.MigrationEngine
- Remove cmd/root.go PreRun migration hooks and runMigrations() function
- Migrations now run via core.App.Start() → RunMigrations()
Events:
- Add complete domain event topic catalog and payload DTOs to core/contracts/events.go
- 15 event topics across auth, user, admin, upload, message_gateway, risk_control
Downstream:
- Create downstream/ directory with README and custom_example plugin scaffold
CI:
- Update Makefile code-check architecture guards for Cordis layering
- Enforce: core no gin/gorm/asynq, contracts no plugins/, pkg no plugins/, domain no cross-domain
2026-08-28 11:51:48 +08:00