Repository navigation
fly: semantic lint rules + cross-file mount↔volume check (#742) - #758
Merged
Merged
Conversation
Replace the FLY001 placeholder with a real starter rule set so obvious Fly mistakes fail at chant build, not at apply. Mirrors the gcp/aws catalogs. AST lint rules (lintRules(), src/lint/rules/): - FLY001 valid-region — machine `region` must be a known Fly region (error). - FLY002 guest-sizing — cpu_kind/cpus/memory_mb must be a valid guest preset (error). - FLY004 no-secret-literals — inline credential values under secret-looking keys belong in `secrets` (apply-only, D7) or a reference (warning; conservative heuristic keyed on credential names + literal, non-reference values). Whole-stack post-synth check (postSynthChecks(), src/lint/post-synth/): - FLY011 mount-references-declared-volume — every machine config.mounts[].volume must resolve to a Volume declared anywhere in the stack. Implemented as a post-synth check (ctx.entities) rather than an AST rule so it is genuinely cross-file, which is what the rule requires. A live Declarable/AttrRef mount is skipped (it can't dangle by construction); only string names are validated. Also fixes a latent bug in the pre-existing FLY010 (machine-requires-image): it read config.image directly, which false-flags a machine whose config was authored as a MachineConfig instance (args nested under .props). Both checks now share a readProps helper (src/lint/post-synth/fly-helpers.ts) that unwraps either authoring style; a new FLY010 test proves the instance form passes. Region list and guest presets are documented representative sets (the generated types type `region` as plain string). 83 fly tests pass; barrel guard, validate, and check-lexicon Tier 1 clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 tasks
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.
Closes #742 (Phase 2 breadth). Replaces the FLY001 placeholder with a real starter rule set so obvious Fly mistakes fail at
chant build, not at apply. Mirrors the gcp/aws catalogs.AST lint rules (
lintRules())regionmust be a known Fly regioncpu_kind/cpus/memory_mbmust be a valid guest presetsecrets(D7) or a refno-secret-literalsis conservative: it fires only when a credential-looking key (password/token/secret/api_key/…) has a plain string literal value that isn't a reference/placeholder — so asecretsreference is never flagged.Whole-stack post-synth check (
postSynthChecks())config.mounts[].volumemust resolve to aVolumedeclared anywhere in the stack.This one is a post-synth check (reads
ctx.entities), not an AST rule, because "in the stack" is inherently cross-file — the AST lint seam only sees one source file at a time. A live Declarable/AttrRef mount is skipped (can't dangle by construction); only string volume names are validated.Bonus: fixes a latent FLY010 bug
The pre-existing FLY010 (machine-requires-image) read
config.imagedirectly, which false-flags a machine whoseconfigwas authored as aMachineConfiginstance (constructor args nest under a non-enumerable.props). Both checks now share areadPropshelper (fly-helpers.ts) that unwraps either authoring style; a new FLY010 test proves the instance form passes.Notes
regionas plainstring, so there's no enum to import; unit tests stay network-free.validate, andcheck-lexiconTier 1 all clean.🤖 Generated with Claude Code