{"record":{"id":"7dbad1ca0e783408","repo":"unicity-aos/aos-ce","slug":"env-key-sets-scope-shared-which-is-silently-ignored","errorCode":null,"errorMessage":"[env].{key} sets scope = \"shared\", which is silently ignored.","messagePattern":"\\[env\\]\\.(.+?) sets scope = \"shared\", which is silently ignored\\.","errorType":"validation","errorClass":"Finding","httpStatus":null,"severity":"warning","filePath":"capsules/capsule-forge/src/checks.rs","lineNumber":184,"sourceCode":"                .and_then(Toml::as_str)\n                .is_some_and(|f| !f.is_empty())\n        })\n    });\n    if !has_file {\n        out.push(Finding::err(\n            \"No [[component]] with a `file` was found.\",\n            \"Add a [[component]] table with `id`, `file = \\\"my_capsule.wasm\\\"`, `type = \\\"executable\\\"`.\",\n        ));\n    }\n}\n\nfn check_env(root: &Toml, out: &mut Vec<Finding>) {\n    let Some(env) = root.get(\"env\").and_then(Toml::as_table) else {\n        return;\n    };\n    for (key, val) in env {\n        if val.get(\"scope\").and_then(Toml::as_str) == Some(\"shared\") {\n            out.push(Finding::warn(\n                format!(\"[env].{key} sets scope = \\\"shared\\\", which is silently ignored.\"),\n                \"Remove `scope`; shared/operator-only env scope is not honoured from the manifest.\",\n            ));\n        }\n    }\n}\n\n/// Collect the `[publish]` and `[subscribe]` topic keys, warning if a table is\n/// empty (fail-closed: the capsule then can't publish/subscribe at all).\nfn collect_topics(root: &Toml, out: &mut Vec<Finding>) -> (Vec<String>, Vec<String>) {\n    let pub_keys = table_keys(root, \"publish\");\n    let sub_keys = table_keys(root, \"subscribe\");\n    if pub_keys.is_empty() {\n        out.push(Finding::warn(\n            \"[publish] is empty or missing — the capsule cannot publish any event.\",\n            \"Add the tool-bus publish keys `tool.v1.execute.*.result` and `tool.v1.response.describe.*`.\",\n        ));\n    }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/capsules/capsule-forge/src/checks.rs#L166-L202","documentation":"check_env inspects each [env] entry in the manifest and warns when an entry sets scope = \"shared\". Manifest-declared env scope is silently ignored by the host — the field has no effect — so forge warns authors to remove it rather than rely on a no-op setting.","triggerScenarios":"validate_manifest -> check_env finds any env table entry whose `scope` sub-value is the string \"shared\"; e.g. `[env.MY_VAR]\\nscope = \"shared\"`.","commonSituations":"Authors assuming manifest env can be shared with the operator or other capsules; copying an env block from an old manifest format where scope was honored; cargo-culting config from a different capsule system.","solutions":["Remove the `scope` key from the [env] entry; it is never honored from the manifest.","If sharing is required, configure shared/operator env scope through the host/operator configuration, not the manifest.","Keep only plain value entries under [env] (e.g. `[env.MY_VAR]\\nvalue = \"x\"`)."],"exampleFix":"# before\n[env.API_URL]\nvalue = \"https://api.example.com\"\nscope = \"shared\"\n# after\n[env.API_URL]\nvalue = \"https://api.example.com\"","handlingStrategy":"validation","validationCode":"# fail CI if any env entry carries a scope key\ngrep -n 'scope' capsule.toml && echo \"manifest env scope is ignored; remove it\" && exit 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep [env] entries to plain key/value pairs only","Configure shared env at the host/operator layer, not the manifest","Run forge validate before every capsule release"],"tags":["manifest","env","validation","config"],"backgroundTag":"unsupported-config-value","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}