Commit Graph
58 Commits
Author SHA1 Message Date
zhangwenjian 0a629e2f3f docs📝(checksilent): describe the two passes the code actually makes
The comment claimed bindings were collected as the body was walked so that a
registration only saw definitions above it. That is the single-pass design this
started as. The code does two passes - one to collect, one to report - and a
registration therefore sees every binding in the function.

That is the point rather than an accident: a `.Use` written below a route is
still part of the chain, because the chain is assembled before anything is
served. The price is that a name reused for two different things in one
function resolves to the last assignment, which the comment now says instead of
promising an ordering the code does not keep.
2026-09-05 21:51:51 +08:00
zhangwenjian 6966f14dd4 feat(checksilent): report a route whose handler reads a data permission nobody supplies
GetPermissionFromContext cannot fail. When no middleware put a *DataPermission
in the context it returns the zero value, and the zero value's DataScope is the
empty string - which is not one of the five scopes Permission recognises, so it
takes the default branch and fails closed. The query is handed `1 = 0` and
matches nothing.

The endpoint then reports "not found" or "no permission" for rows that plainly
exist, and only where enabledp is true. With data permissions off - the
repository default - Permission returns the query untouched and the missing
middleware costs nothing at all. A test suite and a CI that run on the default
cannot see it.

That is what happened to /api/v1/getinfo: it read the permission on a group
carrying only the JWT middleware, so every login on a deployment with data
permissions enabled ended in a 401 from the endpoint the browser calls
immediately after signing in, and went back to the login page. Three /sys-api
routes had the same shape.

The check matches a handler to the group it is registered on, through the AST
rather than through the text - a scratch grep for the same thing reported four
false positives from a comment that happened to contain the function's name,
and before that, a dozen from matching handler names across packages. Handlers
are keyed by package, type and method, so two SysUser types are two handlers.
Subgroups inherit their parent's chain, as gin does, and a `.Use` written below
a registration still counts, because the chain is assembled before anything is
served.

Either half is a fix and the message says both, because which one is right
depends on the route. A handler reading other people's rows wants the
middleware. A handler reading the caller's own row - id from the token - wants
no scope at all: DataScopeSelf matches on create_by, so scoping a self-read
rejects every user who did not create their own account. Reporting only "add
the middleware" would have turned /getinfo from broken into worse.

Five tests: the mistake, both fixes, subgroup inheritance, and a same-named
handler in another package. TestThisRepositoryIsClean covers the real tree, and
it is what fails on the commit before this one - four findings, all real.
2026-09-05 21:31:45 +08:00
zhangwenjian e0132db1b9 docs📝(checksilent): retire a comment that predates the lowering
The note explained the empty-shim summary as the expected state "until the
contract packages are lowered into core". They are lowered, and the shims
exist - so a count of zero now means they stopped being aliases, or stopped
being here, which is the interesting case rather than the ordinary one.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 11:23:31 +08:00
zhangwenjian 7c3f55a873 fix🔧(checksilent): suggest the fix with the qualifier the file uses
The contract-shim-alias message built its suggested line from path.Base of
the import path, so it told the author to write

    type ControlBy = models.ControlBy

in a file whose import is `contractmodels "…/sdk/contract/models"`. Every
shim in this repository aliases that import, so the suggestion never
compiled as written - in the one message whose whole job is to be pasted in.

qualifiedType already read the in-source identifier to resolve the import;
it now returns it.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 11:23:31 +08:00
zhangwenjian f7c0247394 fix🔧(checksilent): stop the seeded-value checks reporting their own tests
Widening menu-sort-overflow to see a contract MenuSpec made it fire on
app/admin/service/seed_test.go, on the case that asserts SeedMenus rejects
a sort of 900. The check was reading the proof that it works as a defect.

That is not specific to this one guard: menu-sort-overflow,
config-value-truncation, menu-id-collision and modeltime-mix are all about
a value that reaches a real database through a migration, a test fixture
reaches none, and every one of those guards needs a test that writes the
value it rejects. Skip _test.go in all four.

The two import and alias checks keep scanning tests - those are about the
dependency graph, where a test file's import is as real as any other, and
TestContractImportBoundaryCoversTestFiles already pins that.

Both directions are covered: a fixture is ignored, a real seed is still
reported.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 11:16:53 +08:00
zhangwenjian 71d6211c61 fix🔧(checksilent): see a menu written as a contract MenuSpec
The sort-overflow check recognised a SysMenu literal from this repository's
model packages and nothing else. An application installed from outside cannot
reach that type - it describes the same row as a seed.MenuSpec and hands it to
the host's Seeder - so the check went quiet for exactly the author furthest
from the schema it protects.

Not hypothetical: this repository's own reference application shipped a Sort
of 200, past the tinyint sys_menu.sort is built as, and this check passed it.
sqlite ignores the width, so it would have surfaced first on a real install,
as Error 1264 partway through a migration with everything after it unapplied.

The check still cannot see an application in the module cache; that half is
the Seeder's runtime validation. This closes the half that is in the tree.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 11:14:01 +08:00
zhangwenjian 55866682ae feat(checksilent): require a contract shim to be a type alias
A shim of a core contract type written as `type X pkg.Y` instead of
`type X = pkg.Y` keeps the fields and drops the method set, so anything
embedding it stops satisfying the interfaces it satisfied before.

The compiler catches that only where the method set is actually
exercised. This repository exercises some of the contract types through
an interface and some not at all, so the ones it does not exercise
compile here and break in a fork or a third-party application - which
is the half nobody is watching.

The trigger is the right-hand side of the declaration rather than a
list of package names, so it covers whatever the lowering ends up
shaping without a list to keep in step. Until the contract packages
land in core there is nothing here to guard, and the summary says so
rather than letting the silence read as a pass.

Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx
2026-09-05 11:14:01 +08:00
zhangwenjian b836945eea feat: add checksilent, for the failures that do not report themselves
Six checks, five at ERROR and one - the cross-repository menu-name comparison -
at WARN, because it can only match by regular expression across two modules and
a false positive that fails CI teaches people to silence the tool.

The summary names which contract roots were actually scanned: core/ is a
separate module with no directory here, and a check that quietly covers less
than it claims is worse than no check.
2026-09-01 17:45:41 +08:00
linwenxiang 25d8364bf4 修改,兼容go-admin sdk方案 2021-03-09 19:12:49 +08:00
lwnmengjing c541d09076 升级版本号 2021-03-08 22:53:02 +08:00
linwenxiang 75711922b4 调整log代码,兼容zap扩展支持fields 2021-03-05 15:13:36 +08:00
linwenxiang 39dd1ee6f8 兼容casbin2.24.0版本log
迁移脚本编译时不打包
2021-03-05 13:23:21 +08:00
linwenxiang e2952fa393 调整整体架构写法
调整db用法
调整日志用法
调整模版
2021-03-04 23:45:16 +08:00
linwenxiang 734a48dbb8 兼容代码生成 2021-02-25 14:24:09 +08:00
linwenxiang 5ff282c23d feat :添加资源管理中的需要开放的必开接口 2021-02-25 01:32:06 +08:00
linwenxiang deeb82048b 数据库连接初始化优化
权限部分修改
2021-02-21 14:06:13 +08:00
linwenxiang 981e992f28 不全多删除的部分 2021-02-05 10:30:48 +08:00
linwenxiang 7ce090af38 删除多余打印 2021-02-05 10:24:11 +08:00
linwenxiang f67e653abe 整理requestId入口,兼容istio的header返回 2021-01-29 14:53:52 +08:00
linwenxiang 128739f097 优化response结构
优化日志writer
2021-01-20 00:31:52 +08:00
zhangwenjian e1f15bcff1 添加返回log输出 2021-01-11 09:34:53 +08:00
zhangwenjian 0db2e8ef13 Merge branch 'dev' of https://github.com/go-admin-team/go-admin into go-admin-team-dev 2020-12-21 23:01:37 +08:00
zhangwenjian 746123c888 refactor🎨 : 修改文件操作函数 2020-12-21 22:02:40 +08:00
linwenxiang 0c170fe1c6 config setup配置提到外面 2020-12-10 10:24:06 +08:00
linwenxiang 5f873914e0 config重构 2020-12-08 20:28:26 +08:00
zhangwenjian 52be3f6153 feat oss 文件上传 2020-11-12 20:18:53 +08:00
linwenxiang 2399824d35 fixme: 优化初次启动日志文件创建 2020-11-04 11:26:41 +08:00
linwenxiang 4b5b0507e9 增加链路追踪,熟悉的朋友可以将go-admin作为微服务的网关使用😄 2020-10-30 14:52:49 +08:00
zhangwenjian 93feb4779e 修改验证码为4位数字 2020-10-17 18:54:40 +08:00
linwenxiang faa8de7dc2 修改日志初始化值,level值不被覆盖 2020-10-09 16:15:51 +08:00
zhangwenjian bc648c3f2f test 2020-09-29 08:41:20 +08:00
linwenxiang c0ac9a6397 支持view自定义返回 2020-09-23 00:35:07 +08:00
linwenxiang 8460b3f385 修改action和模版,使用log打印日志,修复job删除问题,已经所有删除问题 2020-09-22 22:04:29 +08:00
linwenxiang 2fe2c96e82 语法规范 2020-09-21 13:07:41 +08:00
linwenxiang a8d5846483 优化casbin接口鉴权问题,不再重复查询数据库 2020-09-21 11:39:19 +08:00
linwenxiang 6bc3e6c00b 优化模版生成 2020-09-16 22:42:13 +08:00
zhangwenjian 2d15f91f2e feat:update gen 2020-09-12 01:07:35 +08:00
zhangwenjian fa07a57d22 feat : update actions gen 2020-09-10 02:14:48 +08:00
linwenxiang 01ea376015 修改文件目录 2020-09-04 00:21:52 +08:00
linwenxiang 41b06c806a 修改createBy和updateBy为uint类型 2020-09-03 22:14:34 +08:00
linwenxiang 4b8c372038 1、action中各动作添加数据权限
2、修改jwt中key为常量
2020-09-03 10:49:31 +08:00
linwenxiang 4e39e915ea 调整indexAction路径,允许用户自定义接收的slice,配合gorm只能搜索 2020-08-31 21:56:29 +08:00
zhangwenjian b98997a69f feat:update userinfo 2020-08-31 21:18:14 +08:00
linwenxiang 61451d149a Merge branch 'dev' of github.com:wenjianzhang/go-admin into table/dev 2020-08-29 23:29:42 +08:00
zhangwenjian 671291d024 update: used gormv2 to handle permission process 2020-08-29 23:25:53 +08:00
linwenxiang 562e61cf4f 使用action代替api单个操作
改写job
2020-08-29 22:22:52 +08:00
linwenxiang 8817f02038 修改core仓库名称 2020-08-29 15:15:03 +08:00
linwenxiang 486a77762c 修改通用search语法结构 2020-08-28 21:01:56 +08:00
zhangwenjian 87edf1099c feat:update search 2020-08-28 00:52:16 +08:00
zhangwenjian 1dffcb7199 Merge branch 'dev' of https://github.com/wenjianzhang/go-admin into dev 2020-08-28 00:06:55 +08:00