Skip to content

Give every gate finding a stable error code and a one-line fix - #219

Open
tyreseluo wants to merge 1 commit into
OctoSense-org:mainfrom
tyreseluo:feat/error-codes-main
Open

tyreseluo wants to merge 1 commit into
OctoSense-org:mainfrom
tyreseluo:feat/error-codes-main

Conversation

@tyreseluo

Copy link
Copy Markdown

What

Every refusal and warning the admission gate prints now carries a stable machine code and a one-line fix, so a tool (an agent repairing its own bundle, a CI job) can act on a failure without parsing English.

  • Finding gains optional code / hint, serialized in hub check --json only when set (additive; existing JSON consumers are unaffected).
  • The text report adds one fix [code]: … line under each coded finding. The human message line above it is byte-identical to today's; uncoded findings (reviewer notes such as what a component reaches) print exactly as before.
  • 53 codes cover the whole gate: structural admission, digest and signing, identity, contents, external references, secrets, storage, the listing, the agent/tools review, grants, history, the app's own functions, shared components, component releases and RustSec advisories.
  • docs/ERROR-CODES.md is the table, linked from PUBLISHING.md's gate rules, both READMEs and hub usage. A printed code never changes meaning; new codes may be added. hub-host-undeclared is listed as retired-and-reserved, since HTTPS destinations are now declarations rather than refusals.

Example

  [refused] digest: the bundle hashes to e785…, the manifest claims 4b46…
    fix [hub-digest-mismatch]: run `hub stamp <bundle>` after every edit (tools/octo check stamps first), then check again

Why

OctoBuddy runs coding agents that build OctoSense apps and loop on hub check until a bundle is admitted. With a code per finding, the agent gets an exact fix instead of guessing from the prose, and the same codes are usable from CI.

Testing

  • cargo test -p octosense-app-contract -p octosense-app-policy -p octosense-app-hub --all-targets: 26 suites, 336 passed, 0 failed (new test a_refusal_names_its_code_and_one_line_fix)
  • cargo test … --doc: pass
  • cargo clippy -p octosense-app-contract -p octosense-app-policy -p octosense-app-hub --all-targets --no-deps -- -D warnings: clean
  • Every code used in the source appears in docs/ERROR-CODES.md, and every active code in the table is used.

Out of scope (present on main before this change): Cargo.lock is two lines behind Cargo.toml, so --locked refuses; workspace-wide clippy reports type_complexity in crates/app-host and compile errors in crates/appstore from the sibling makepad checkout. This PR does not touch them.


中文摘要:为准入检查(gate)报告里的每一条拒绝 / 警告加上稳定的错误码和一行修复建议。文本报告在原消息下新增一行 fix [code]: …,原有消息逐字不变;--json 新增可选的 code / hint 字段。共 53 个错误码,覆盖当前 main 上的全部检查项(含 wasm 函数、共享组件和组件发布);docs/ERROR-CODES.md 为码表,错误码一经发布含义不变。

Every refusal and warning the gate prints now carries a stable machine
code and a one-line fix, so a tool (an agent repairing its own bundle,
a CI job) can act on a failure without parsing English:

- Finding gains optional code and hint, serialized in --json when set;
  the text report adds a "fix [code]: …" line under each coded finding.
  The human messages are unchanged, and uncoded findings (notes for a
  reviewer, such as what a component reaches) print as before.
- Codes cover the whole gate: structural admission, digest and signing,
  identity, contents, external references, secrets, storage, the
  listing, the agent and tools review, grants, history, the app's own
  functions, shared components and component releases.
- Codes from the first printing keep their meaning; hub-host-undeclared
  is retired (HTTPS destinations are declarations, not refusals) and
  stays reserved.
- docs/ERROR-CODES.md is the table, linked from PUBLISHING.md's gate
  rules, the READMEs and hub's usage. A code, once printed, never
  changes what it means; new codes may be added.

This branch has not been deployed

No deployments
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.

1 participant