Repository navigation
feat(packs): add config pack for settings, secrets and vaults - #650
Merged
Merged
Conversation
The first independent pack, packs/config (metaobjects-config, 0.1.0 preview, unpublished, TypeScript only): - object.settings: a settings group whose fields are the settings (scalar field subtypes only); no source, so no table, query or route. - @secret, @envName and @phase (runtime | build): optional attributes on every field subtype, read on settings. - vault.infisical at the document root, with scope.env children (@project, @env) and an optional @DefaultScope. - Generators: envExampleFile (.env.example), keyManifestFile (keys.manifest.json) and keysAxiTomlFile (.keys-axi.toml). Names only: the model holds no secret value. Problems the loader cannot see (a variable name used twice, a malformed @envName, a secret with a default, an array setting, a bad default scope, two scopes on one store environment, a vault with no scope) fail the run, all listed. The provider registers metamodel/config.json through the public provider contract; a test holds that lowering to core's own. Pinned vocabulary leaves core alone; five load fixtures run through the TypeScript pack-conformance entry point. check-pack-boundary: a pack id followed by a file extension is a file name, not the id (core's metaobjects-config.ts is not the config pack), with a test.
- An abstract settings group is a base: read through the groups that extend it, never emitted under its own name. - Vaults are read inside the project's scope, as settings are. - Setting attributes put on a non-settings field warn once per run, from whichever config generator runs first. - keys-axi-toml problems are ConfigModelErrors like the model's others. - scope.env declares min 1 (the generators enforce it; the loader does not count child rules). - Reuse core's FIELD_ATTR_* / DOC_ATTR_DESCRIPTION constants and GENERATED_EDIT_NOTE: hand edits are three-way merged, so the header no longer says "do not edit". - check-pack-boundary: a file-name tail (.test.ts, .schema.json) after a pack id is a file stem; an id followed by another dotted word still trips.
…t the config pack in packs/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
packs/configpack (@metaobjectsdev/pack-config, providermetaobjects-config, version0.1.0, preview, private and unpublished). It declaresobject.settings(scalar field settings only), the optional field attributes@secret,@envNameand@phase(runtime|build), andvault.infisicalat the document root withscope.envchildren (@project,@env) and an optional@defaultScope. Core gains no vocabulary and no version change. This PR is the TypeScript port only.envExampleFile()(.env.example),keyManifestFile()(keys.manifest.json) andkeysAxiTomlFile()(.keys-axi.toml, in the formatkeys-axireads). No secret value reaches their output. Model problems the loader cannot see (env name collisions, malformed@envName, secrets with@default, array settings, bad@defaultScope, vaults with no scope, and similar) fail the run as oneConfigModelErrorthat lists every problem. The pack carries its own conformance fixtures, vocabulary pin,CHANGELOG.mdand README, andpacks/README.mdgains a row for it. The lockfile gains the workspace entry.scripts/check-pack-boundary.tsso a core file stem such asmetaobjects-config.ts(core's own config module, and its.schema.jsonand.test.tsfiles) no longer matches the config pack id. That is the only change to the gate. Any other dotted word after the id still fails. A new test inscripts/packs.test.tscovers it.Known limitations
ERR_UNKNOWN_SUBTYPEorERR_UNKNOWN_ATTR.meta genskip fingerprint (gen-fingerprint.ts) does not hash a non-engine@metaobjectsdev/*config import. A generator edit in a source-linked pack can therefore leave stale output. This is a separate core task, not fixed here. It must land before the first in-repo or source-linked pack consumer.meta genruns no generator over a model with no objects, so a vault-only model writes no.keys-axi.toml. The pack README documents this.No-mistakes gate runs for this PR: 2.
Validation
Risk Assessment
✅ Low: Self-contained, unpublished preview pack with no core vocabulary or version change; earlier-round fixes are in the current code, and the only core-side edit (the pack-boundary file-stem exemption) is narrow and covered by a new test.
Testing
Baseline command passed at the target commit. This turn drove the README wiring live through the real
meta genCLI in disposable scratch projects. S1 passed: .env.example, keys.manifest.json and .keys-axi.toml land at the project root, with secrets by name only and nothing under src/generated. S2 passed: a model with six settings and vault problems fails once, exit 1, listing all six, with no files written. S3 passed: a misplaced @secret on object.value warns once per run naming Token.value, not the settings field, and the unextended abstract base's bad @envName is rejected. S4 (keys-axi wiring) is untested: a single read-onlykeys-axi whereprobe reached the operator's configured keystore with a synthetic project name and returned PROJECT_NOT_FOUND, which indicates the toml's default environment and scope were read, but no disposable keystore was available for a full run; no further keys-axi calls were made. Scratch projects were removed; evidence copied to the evidence directory.gen[3]: .env.example,new / keys.manifest.json,new / .keys-axi.toml,new, exit 0; no src/ directory createdgen failed: [env-example] config pack: 6 problem(s), exit 1, output directory emptyacme::app::Token.value: @secret only mean something on a field of an object.settingswarning, no warning for settings field Api.key…keys-axi runneeds no project flagEvidence: S1 generated .env.example from README wiring
Evidence: S1 generated .keys-axi.toml from README wiring
Evidence: S1 generated keys.manifest.json from README wiring
Evidence: S2 adversarial model gen output (fail closed, one error)
Evidence: S3 misplaced-attribute warning gen output
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
🔧 **Test** - 1 issue found → auto-fixed ✅
scripts/ci-local.sh --affected --strict-toolchainsbuilt meta CLI gen against scratch synthetic projects🔧 Fix applied.
✅ Re-checked - no issues remain.
gen[3]: .env.example,new / keys.manifest.json,new / .keys-axi.toml,new, exit 0; no src/ directory createdgen failed: [env-example] config pack: 6 problem(s), exit 1, output directory emptyacme::app::Token.value: @secret only mean something on a field of an object.settingswarning, no warning for settings field Api.key…keys-axi runneeds no project flagscripts/ci-local.sh --affected --strict-toolchainsbun {run-worktree}/server/typescript/packages/cli/dist/bin/meta.js genin a scratch project (under /mnt/scratch) with metaobjects.config.ts copied from packs/config/README.md Wiring, a settings + vault model, linked @metaobjectsdev packages (S1)Adversarial model viameta genwith secret @default, derived invalid env name, bad @envName, array setting, duplicate env name, and unknown @defaultScope (S2)Misplaced @secret on object.value field plus settings @secret viameta gen, and an unextended abstract settings base with bad @envName (S3)bun teston packs/config/typescript/test/generators.test.ts (11 pass, includes the README-wiring runGen test and the once-per-run warning test)Read-onlykeys-axi --helpand onekeys-axi where DATABASE_URLprobe in the scratch project (S4, partial; see reason)Broad regression: configuredscripts/ci-local.sh --affected --strict-toolchainsbaseline, which passed at target commit; no source changed this turnpacks/README.md:11- The pack.json field table omitsdescription. All four pack.json files (config, systems, delivery, railway) carry it, and scripts/check-pack-manifests.ts does not reject it. Previously declined in document round 1 (packs-readme-stale); still true in current code. Not fixed here, per that decision.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.