@feng0531/dsh-code-review 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.38.0
4
+
5
+ - protobuf/thrift/capnp/GraphQL/Prisma五类专用缺陷指导替换同泛化protocol提示,区分wire/JSON/生成API/迁移兼容方向,保留实际消费者/版本及反证前提;GraphQL不混wire/tag概念。
6
+ - 仅精确扩展名选取(大小写兼容),不匹配备份/伪后缀;原common与notice保持,指导不授读取或证据权限。主审/窗口/交互/复核指导继承与原输入预算验收,378全量测试通过,无新增调用;待固定标签原工件发布。
7
+
3
8
  ## 0.37.0
4
9
 
5
10
  - callerScopePaths接入SVN离线限定目录normal引用方扫描;正文及负匹配hash/node/index/probe复核,共享原30秒、128正文/1MiB、复核2MiB、20上下文/4MiB快照,字面导航不证明语义调用覆盖。
6
- - 祖先与节点真实路径/URL链/wcroot/UUID及属性校验,拒绝switched/external/special/keywords;竞争含本地未跟踪路径但无正文权限。真实SVN预览零发送、过期拒绝、满槽、二进制及超限验收,375项离线通过;待固定四矩阵与原工件发布,不宣称正式交付。
11
+ - 祖先与节点真实路径/URL链/wcroot/UUID及属性校验,拒绝switched/external/special/keywords;竞争含本地未跟踪路径但无正文权限。真实SVN预览零发送、过期拒绝、满槽、二进制及超限验收,375项离线通过;固定标签CI37933398779四矩阵通过;唯一npm发布37933848198成功但tarball传播404使核验超时,同原artifact11617224527恢复37935128694成功;99052字节npm/Release逐字节及双hash/清单匹配正式交付,无重新pack或npm publish。
7
12
 
8
13
  ## 0.36.0
9
14
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前正式版本为 0.36.0(固定标签四矩阵及npm/Release原工件字节双hash门禁通过)。JSON围栏兼容与有界窗口上下文已交付;实际项目审查效果仍需原报告和新预览执行验证。
7
+ 当前正式版本为 0.37.0(固定标签四矩阵及npm/Release原工件字节双hash门禁通过)。JSON围栏兼容与有界窗口上下文已交付;实际项目审查效果仍需原报告和新预览执行验证。
8
8
 
9
9
  Git历史预览新增oldContextPaths:最多20个显式仓库相对文件,与contextPaths/自动上下文共享20槽、256KiB每blob及4MiB快照。仅从baseline普通Git blob捕获,不checkout/fetch/读取工作树;根提交无baseline拒绝,working/SVN明确拒绝。旧侧条目携带oldRevision/oldBlobOid/oldHash,仅进入context-old;oldOnly表示仅批准旧侧,不证明target路径不存在。所选变更复用原changed-old,不重复上下文;excluded/blocked变更、链接/submodule、凭据路径不能重新进入。预览显示身份元数据、不显示正文,确认执行才按宿主正常权限发送。主审/综合/复核按侧提示,计入原输入预算,旧证据不能冒充新侧回归证明。
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -1,3 +1,4 @@
1
+ import {protocolGuidance} from './protocol-guidance.mjs';
1
2
  // Original defect checklists, not executable rules or proof of a defect.
2
3
  const common = ['Only report a concrete defect with trigger, impact and changed-code evidence.', 'Check before/after behavior and counterexamples; absent context means uncertainty, not an invented contract.'];
3
4
  const checklists = {
@@ -17,14 +18,14 @@ const checklists = {
17
18
  configuration: ['Check changed configuration keys against consumer/schema evidence, type/unit/default mismatches and compatibility.', 'Check exposed secrets, privilege expansion and unsafe interpolation only with concrete supported evidence.']
18
19
  };
19
20
  export function defectGuidance(filePath, sourceText = '') {
20
- const lower = filePath.toLowerCase();
21
+ const lower = filePath.toLowerCase(), protocol = protocolGuidance(filePath);
21
22
  const first = typeof sourceText === 'string' ? sourceText.slice(0,8192).split('\n').map(s=>s.trim()).find(Boolean) ?? '' : '';
22
23
  const sniffed = lower.endsWith('.m') ? (/^(?:#(?:import|include|pragma|if|define)\b|@(?:import|interface|implementation|class|protocol)\b|\/\/|\/\*)/.test(first) ? 'objc' : 'matlab') : null;
23
24
  const specialized = /\.(shader|hlsl|glsl|cginc|hlsli|compute)$/.test(lower) ? 'shader' : sniffed ?? (/\.mm$/.test(lower) ? 'objc' : /\.swift$/.test(lower) ? 'swift' : null) ?? (/\.java$/.test(lower) ? 'java' : /\.go$/.test(lower) ? 'go' : /\.(py|pyi)$/.test(lower) ? 'python' : /\.rs$/.test(lower) ? 'rust' : /\.(kt|kts)$/.test(lower) ? 'kotlin' : /\.(php|phtml)$/.test(lower) ? 'php' : null);
24
- const language = specialized ?? (/\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$/.test(lower) ? 'cpp' : lower.endsWith('.cs') ? 'csharp' : /\.(js|jsx|mjs|cjs|ts|tsx)$/.test(lower) ? 'javascript' : /\.(json|yaml|yml|toml|ini|xml|properties)$/.test(lower) ? 'configuration' : 'generic');
25
+ const language = protocol?.language ?? specialized ?? (/\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$/.test(lower) ? 'cpp' : lower.endsWith('.cs') ? 'csharp' : /\.(js|jsx|mjs|cjs|ts|tsx)$/.test(lower) ? 'javascript' : /\.(json|yaml|yml|toml|ini|xml|properties)$/.test(lower) ? 'configuration' : 'generic');
25
26
  const fileType = /^\.github\/workflows\/.+\.(yaml|yml)$/.test(lower) ? 'github-workflow' : /(?:^|\/)(package\.json|cargo\.toml|pom\.xml|build\.gradle|composer\.json)$/.test(lower) ? 'dependency-manifest' : undefined;
26
27
  const purpose = fileType ?? (/\.(ftl|ftlh|ftlx|hbs|mustache|jinja2|j2|pug|astro)$/.test(lower) ? 'template' : /\.(tf|hcl|tfvars|bicep|nix)$/.test(lower) ? 'infrastructure' : /\.(proto|thrift|capnp|graphql|gql|prisma)$/.test(lower) ? 'protocol-schema' : undefined);
27
- const purposeChecks = purpose === 'template' ? ['Check escaping for the actual HTML/attribute/URL/script context, untrusted raw output and template execution boundaries.', 'Check missing/null variables and changed conditional branches against captured callers; do not invent engine defaults.'] : purpose === 'infrastructure' ? ['Check privilege/network exposure, secret/state handling and untrusted interpolation against actual provider semantics.', 'Check replacement/deletion, dependency order and changed defaults for concrete data loss or service disruption; configuration is not an applied plan.'] : purpose === 'protocol-schema' ? ['Check field identifier reuse, removed/renamed fields, type/nullability/default changes and wire/client compatibility against actual consumers.', 'Check resolver authorization, data exposure, migration constraints and referential integrity using captured implementation evidence; schema alone does not prove enforcement.'] : [];
28
+ const purposeChecks = purpose === 'template' ? ['Check escaping for the actual HTML/attribute/URL/script context, untrusted raw output and template execution boundaries.', 'Check missing/null variables and changed conditional branches against captured callers; do not invent engine defaults.'] : purpose === 'infrastructure' ? ['Check privilege/network exposure, secret/state handling and untrusted interpolation against actual provider semantics.', 'Check replacement/deletion, dependency order and changed defaults for concrete data loss or service disruption; configuration is not an applied plan.'] : purpose === 'protocol-schema' ? protocol.checks : [];
28
29
  const typeChecks = fileType === 'github-workflow' ? ['Check event trust boundaries, token permissions and fork/PR-controlled inputs before privileged commands or secret exposure.', 'Check expression interpolation into shell commands, checkout/ref provenance, artifact/cache trust and required job dependency gates.'] : fileType === 'dependency-manifest' ? ['Check changed dependency versions/features against consumers, lock/resolution evidence and runtime compatibility; do not invent a vulnerability from a package name.', 'Check executable install/build hooks, publish/export entry points and platform constraints for concrete changed behavior.'] : [];
29
- return { version:4, language, ...(sniffed ? {selection:'bounded-first-nonblank-line-hint'} : {}), ...(purpose ? {fileType:purpose} : {}), checks:[...common,...(checklists[language] ?? []),...typeChecks,...purposeChecks], notice:'Guidance is not evidence, a semantic parser, a style rule or permission to read outside the snapshot.' };
30
+ return { version:5, language, ...(sniffed ? {selection:'bounded-first-nonblank-line-hint'} : {}), ...(purpose ? {fileType:purpose} : {}), checks:[...common,...(checklists[language] ?? []),...typeChecks,...purposeChecks], notice:'Guidance is not evidence, a semantic parser, a style rule or permission to read outside the snapshot.' };
30
31
  }
@@ -0,0 +1,24 @@
1
+ // Original, bounded review hints; no parser, I/O, schema enforcement or defect proof.
2
+ const checks={
3
+ protobuf:[
4
+ 'Check numeric tag/enum value reuse and removed field reservations against persisted messages and actual consumers; additive fields alone are not defects.',
5
+ 'Check oneof, presence, defaults and type changes for the deployed syntax/edition/runtime; distinguish binary wire compatibility from JSON names and generated API compatibility.'
6
+ ],
7
+ thrift:[
8
+ 'Check field IDs/types, requiredness and defaults against the actual protocol and old/new consumers; declaration order is not identity and Thrift has no reserved keyword.',
9
+ 'Check method names, oneway/reply semantics, exceptions and include/namespace bindings against generated clients; additive optional fields alone do not prove breakage.'
10
+ ],
11
+ capnp:[
12
+ 'Check ordinals, explicit type IDs, fixed-width storage and default XOR encoding against existing data and deployed readers; do not infer identity from declaration order.',
13
+ 'Check union/layout evolution and generated API consumers separately from wire compatibility; same-ordinal rename alone usually does not break wire data.'
14
+ ],
15
+ graphql:[
16
+ 'Check input non-null/default changes, removed fields/arguments and operation compatibility using actual clients; GraphQL has no numeric field tags.',
17
+ 'Check output null bubbling, enum consumers and resolver authorization using captured implementation; absent auth directives or additive fields/enum values alone do not prove a defect.'
18
+ ],
19
+ prisma:[
20
+ 'Check provider, relationMode, relation actions, constraints and nullability against the deployed database, migration and generated-client consumers; schema is not an applied migration.',
21
+ 'Check concrete data loss, migration order and client rollout counterexamples; do not require indexes or tenant fields from names alone or invent database enforcement in emulated relations.'
22
+ ]
23
+ };
24
+ export function protocolGuidance(filePath){const lower=filePath.toLowerCase();const language=/\.proto$/.test(lower)?'protobuf':/\.thrift$/.test(lower)?'thrift':/\.capnp$/.test(lower)?'capnp':/\.(graphql|gql)$/.test(lower)?'graphql':/\.prisma$/.test(lower)?'prisma':undefined;return language?{language,checks:[...checks[language]]}:undefined;}