Repository navigation
fix(schema): add missing stack property to depends_on_manifest - #2835
thejrose1984 wants to merge 8 commits into
Conversation
`settings.depends_on` entries set `additionalProperties: false`, so any key not modeled in the JSON Schema is reported as invalid. `stack` was never declared, even though it is documented, honored by the dependency parser (`internal/exec/dependency_parser.go`), and carried on `schema.Dependent`. Editors using the published schema flagged valid manifests as errors. Adds `stack` to the `depends_on_manifest` definition in the embedded manifest schema, the stack-config schema, and the test fixture copy, and fills in descriptions for the sibling context keys so hover text matches the docs. The website copy is generated from the embedded schema, so it picks this up automatically. Adds `pkg/datafetcher/schema_depends_on_validation_test.go`, which asserts every schema copy accepts `stack` (literal, templated, and alongside context vars) at both the top level and component level, and still rejects unknown keys and entries with no `component`/`file`/`folder` target. Fixes cloudposse#2104 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011AJ2k1LnZaAi6XaetwpBTa
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe dependency schemas now support the ChangesDepends-on schema alignment
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/datafetcher/schema_depends_on_validation_test.go`:
- Around line 62-69: Update the component-context loop in the schema validation
tests so it skips component cases for the unsupported stack-config schema, while
continuing to run top-level cases and component cases for supported schemas. Use
the existing schemaName and validEntries iteration around assertSchemaValid to
apply this exclusion without changing schema definitions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a7e37a4e-f84e-4819-9c6c-d7367419c9fb
📒 Files selected for processing (4)
pkg/datafetcher/schema/atmos/manifest/1.0.jsonpkg/datafetcher/schema/stacks/stack-config/1.0.jsonpkg/datafetcher/schema_depends_on_validation_test.gotests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
|
CodeRabbit (@coderabbitai) Note |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Existing deprecation metadata and depends_on references =='
rg -n -i -C 3 '"deprecated"|depends_on_manifest|"depends_on"' \
pkg/datafetcher/schema/atmos/manifest/1.0.json \
pkg/datafetcher/schema/stacks/stack-config/1.0.json \
tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json \
pkg/datafetcher/schema_depends_on_validation_test.go
echo
echo '== Relevant changed-file structure =='
for f in \
pkg/datafetcher/schema/atmos/manifest/1.0.json \
pkg/datafetcher/schema/stacks/stack-config/1.0.json \
tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json \
pkg/datafetcher/schema_depends_on_validation_test.go
do
echo "-- $f"
if [[ "$f" == *.go ]]; then
ast-grep outline "$f" --items all --type function
else
jq -r '
.. | objects
| select(has("depends_on_manifest"))
| .depends_on_manifest
| {description, deprecated, properties: (.properties // {} | with_entries(select(.key == "depends_on")))}
' "$f" 2>/dev/null || true
fi
doneLength of output: 14931
Preserve
|
`settings.depends_on` is deprecated in favor of `dependencies.components` but
still supported. The call sites that `$ref` the `depends_on` definition already
carried `deprecated: true` / `x-atmos-replacement`, but the `depends_on` and
`depends_on_manifest` definitions themselves did not — so the marker did not
travel with the definition, and the fixture schema's `settings.depends_on` call
site was missing it entirely.
Annotates both definitions in the embedded manifest schema, the stack-config
schema, and the fixture copy, and names the replacement in each description so
editors without `deprecated` support still surface it. Adds the missing
annotation on the fixture schema's call site.
Adds two guards to the depends_on schema test:
- every schema copy marks both definitions deprecated with the replacement;
- every `depends_on` property that `$ref`s the definition is marked too,
since editors differ in whether they follow a `$ref` for annotations.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011AJ2k1LnZaAi6XaetwpBTa
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json`:
- Around line 1269-1271: The depends_on_manifest schema is incorrectly marked
deprecated. In
tests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json at lines
1269-1271, remove deprecated and x-atmos-replacement from depends_on_manifest;
in pkg/datafetcher/schema_depends_on_validation_test.go at lines 118-131,
require migration metadata only on the depends_on container and assert
depends_on_manifest is not deprecated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: fe5ada52-bd1a-4288-b79a-68e55f21cff5
📒 Files selected for processing (4)
pkg/datafetcher/schema/atmos/manifest/1.0.jsonpkg/datafetcher/schema/stacks/stack-config/1.0.jsonpkg/datafetcher/schema_depends_on_validation_test.gotests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/datafetcher/schema/stacks/stack-config/1.0.json
- pkg/datafetcher/schema/atmos/manifest/1.0.json
Erik Osterman (Cloud Posse) (@osterman) — deprecation annotations addedGood catch, done in Both "depends_on_manifest": {
"title": "depends_on_manifest",
"description": "Depends_on manifest. Deprecated: use an entry under `dependencies.components` instead. Still supported for backward compatibility.",
"deprecated": true,
"x-atmos-replacement": "dependencies.components",
...
}The replacement is named in the Final state — definitions annotated in all three copies, and every call site annotated:
Two CI guards were added so this can't silently regress: one asserts both definitions are deprecated and name the replacement, the other walks every CodeRabbit (@coderabbitai) — the
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
schema='pkg/datafetcher/schema/stacks/stack-config/1.0.json'
test_file='pkg/datafetcher/schema_depends_on_validation_test.go'
echo '== JSON validity and relevant schema definitions =='
jq -e '
.definitions
| {
terraform_component_manifest: .terraform_component_manifest,
settings: .settings,
depends_on: .depends_on,
depends_on_manifest: .depends_on_manifest
}
' "$schema"
echo
echo '== Targeted test structure =='
ast-grep outline "$test_file" --items all --type function \
--match 'TestManifestSchema_DependsOnAcceptsValidEntries|TestManifestSchema_DependsOnRejectsInvalidEntries|componentDependsOnManifest|dependsOnSchemas'
echo
echo '== Component fixture construction and assertions =='
rg -n -C 8 'func componentDependsOnManifest|stack-config/component|assertSchemaValid|assertSchemaInvalid' "$test_file"Length of output: 9824
The deprecation metadata and regression coverage are also in place as described. ʕᵕᴥᵕʔ ✏️ Learnings added
You are interacting with an AI system. |
`depends_on_manifest` models a single legacy dependency entry and is reachable only through the deprecated `depends_on` container, so it must not carry its own `deprecated` / `x-atmos-replacement`. Marking it struck through every entry in an editor on top of the already-struck container, and it departed from the convention used everywhere else in these schemas, where migration metadata sits on the use site rather than the definition. Migration metadata now lives on the `depends_on` container definition and every `depends_on` call site that `$ref`s it, which is what editors surface. Replaces the entry-shape assertion in the deprecation guard with the inverse: a sub-test that fails if `depends_on_manifest` ever regains its own marker. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011AJ2k1LnZaAi6XaetwpBTa
|
Code RabBit (@CodeRabbit) review |
✅ Action performedReview finished.
|
The deprecation guard's doc comment still described the earlier behavior -- annotating both `depends_on` definitions and relying on `$ref` inheritance -- after the test was changed to assert the entry shape stays unmarked. Rewrites it to describe what the test now pins, in both directions. Also corrects the `dependsOnSchemas` comment: `website` resolves to the same bytes as `embedded` upstream, so the copies do not all drift independently, and renames a sub-test that had spaces in its name. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011AJ2k1LnZaAi6XaetwpBTa
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
The added descriptions asserted that `stack` "Takes precedence over
`namespace`, `tenant`, `environment` and `stage`, which are ignored when
`stack` is set", repeated on each of the four siblings. That is not what
`settings.depends_on` does.
`isDependencyMatch` ANDs the two checks:
matchLegacyStack(...) && matchLegacyContextFields(...)
`matchLegacyStack` short-circuits on `stack`, but `matchLegacyContextFields`
still runs, and for a field left unset it requires the two components' values
to be equal. So a cross-stage dependency written the way the description
prescribes — `stack` alone, no `stage` — is silently dropped by
`atmos describe dependents`, while the same entry with a redundant `stage`
matches. `stack` is honored only where it is already redundant.
The matcher behavior is pre-existing and out of scope here; this only stops
the schema from recommending the shape that loses the edge. Documenting the
real rule accurately was considered and rejected: it differs between the DAG
parser (which honors `stack` alone) and `describe dependents`, and the whole
construct is deprecated in favor of `dependencies.components`.
`stack` remains declared, so `atmos validate stacks` still accepts the
documented, parsed key it previously rejected — the point of this PR.
Co-Authored-By: Claude Opus 5 <[email protected]>
Quality Gate
Readiness✅ Fewer than 150 changed files Reviews✅ CodeRabbit approval (current head) ✅ Review threads resolved or dismissed MeasuresCurrent commit: Quality Gate details
🤖 Next steps for this PR |
what
stackproperty to thedepends_on_manifestdefinition in all three schema copies that carry it:pkg/datafetcher/schema/atmos/manifest/1.0.json(canonical; the published website schema is generated from this)pkg/datafetcher/schema/stacks/stack-config/1.0.jsontests/fixtures/schemas/atmos/atmos-manifest/1.0/atmos-manifest.jsondescriptiontext for the sibling keys (namespace,tenant,environment,stage,component,file,folder) so IDE hover text matches the docs, matching the style already used bydependencies_component_entry.depends_on_manifestdefinition itselfdeprecatedwithx-atmos-replacement: dependencies.components, matching the flags already present on the threedepends_onproperty nodes. This does not changeatmos validate stacksoutput — the property-level flags already produce the warning — it makes the definition self-describing for editors that resolve$refto it.pkg/datafetcher/schema_depends_on_validation_test.go(80 subtests).why
depends_on_manifestdeclares"additionalProperties": false, so any key it does not model is rejected.stackis genuinely supported and always has been:internal/exec/dependency_parser.go(parseDependencyMapEntry/parseDependencyMapAnyEntry), which reads exactlycomponentandstack.internal/exec/describe_dependents.go(matchLegacyStack).schema.Context.Stack, which is whatsettings.depends_onentries decode into.This was not only an IDE false positive.
atmos validate stacksloads the same schema (internal/exec/validate_stacks.gofetchesatmos://schema/atmos/manifest/1.0), so it failed on valid, parsed configuration:a note on what these descriptions do not claim
An earlier revision of this PR described
stackas taking precedence overnamespace/tenant/environment/stage, "which are ignored whenstackis set". That was removed, because it is not whatsettings.depends_ondoes.isDependencyMatchANDs the stack check with the context-field check, andmatchLegacyContextFieldsrequires an unset field to be equal across the two components. So a cross-stage dependency written asstackalone is silently dropped byatmos describe dependents, while the same entry with a redundantstagematches —stackis honored only where it is already redundant. The DAG path (atmos terraform --all) honorsstackcorrectly, so the two consumers disagree.That behavior is pre-existing and out of scope for a schema fix; it is tracked separately in #2910. The descriptions here simply avoid recommending the shape that loses the edge.
Test coverage
The new test asserts each schema copy:
stack— literal, Go-templated, and alongside the context vars — at both the top level (settings.depends_on) and the component level (components.terraform.<name>.settings.depends_on);additionalProperties: falseis intact) and entries with nocomponent/file/foldertarget.It also carries a compile-time sentinel on
schema.Dependent{Stack: ...}so renaming the Go field breaks the build rather than silently desyncing the schema.Negative control: with the schema changes reverted (
-count=1), all 24stacksubtests fail; with the fix, all 80 pass.Not addressed here
The issue's "Additional Context" raises a second, separate problem: the schema recognizes only
!includevia"pattern": "^!include", so other YAML function tags (!terraform.state,!exec, ...) trip false IDE warnings. That spans dozens of sites and its correct fix depends on whether the YAML language server surfaces tag text to the validator at all — it deserves its own issue rather than being folded in here.references
depends_on_manifestmissingstackproperty #2104stackignored bydescribe dependentsunless context fields also match #2910 (stackignored bydescribe dependentsunless context fields align)Summary by CodeRabbit
Documentation
depends_onas deprecated and identifieddependencies.componentsas the replacement.Validation