Skip to content

feat(core): add resolveZones zone resolver (TV2.1)#27

Merged
yan-vidal merged 3 commits into
mainfrom
task/TV2.1-zone-resolver
Jun 18, 2026
Merged

feat(core): add resolveZones zone resolver (TV2.1)#27
yan-vidal merged 3 commits into
mainfrom
task/TV2.1-zone-resolver

Conversation

@yan-vidal

Copy link
Copy Markdown
Contributor

TV2.1 — Zone model + resolver

Pure resolver that turns a v2 config's zones into rooted, option-merged ResolvedZone[]. This is the foundation Phase V2 per-zone execution (TV2.2) builds on — and, with TV2.3, part of the path toward running Sentiness on polyglot monorepos (Rust + Go + JS).

What it does

resolveZones(config, repoRoot) maps ResolvedConfig.zonesResolvedZone[], each with:

  • path (repo-relative, '.' for root) and absRoot = join(repoRoot, path).
  • checks: ResolvedCheckPlacement[], where each placement carries id, tier, and merged options.

Resolution rules:

  • tier = zone override → catalog entry → 'standard'.
  • options = catalog options deep-merged with the zone override (zone wins; thresholds/nested objects merge recursively, arrays/primitives replace). Resolution metadata (version, path, tier) never leaks into options.
  • A check id may appear in several zones → one placement per zone, same catalog options.
  • Single-root configs need no special case: resolveConfig already normalizes an absent zones to one zone at '.' with every catalog id, so absRoot === repoRoot.

Internal to core (the TV2.2 runner imports it directly); not re-exported from index.ts.

Deviation from spec (flagged)

The TV2.1 interface types placement.tier as a required Tier, but resolveZones is pure over config and cannot see a check's defaultTier, and the config tier is optional. Since init always writes a tier per catalog entry, the resolver uses zoneOverride.tier ?? catalogEntry.tier ?? 'standard'. The 'standard' fallback only affects hand-written configs that omit a tier; TV2.2 can refine the effective tier against check.defaultTier where the Check instance is in scope.

Validation

  • pnpm --filter @sentiness/core typecheck
  • zones.test.ts ✅ — 6 cases: root normalization, absRoot join, multi-zone, override/threshold deep-merge, bare-id catalog tier, repeated check across zones.
  • Full core suite ✅ (215 tests) · pnpm lint ✅ (221 files)

Relation to other PRs

Independent of #26 (TV2.3 repoRoot). TV2.2 depends on both this and #26.

Pure resolver that maps a v2 config's zones into rooted, option-merged
ResolvedZone[] placements. Foundation for Phase V2 per-zone execution (TV2.2).

- absRoot = join(repoRoot, zone.path); root zone '.' resolves to repoRoot.
- tier = zone override ?? catalog tier ?? 'standard' (deviation: resolveZones is
  pure over config and cannot see check.defaultTier; init always writes a tier).
- options = catalog deep-merged with zone override (zone wins; thresholds and
  nested objects merge recursively). version/path/tier never leak into options.
- Single-root configs need no special case: resolveConfig already normalizes an
  absent zones[] to one zone at '.' with every catalog id.

Internal to core; not re-exported from index.ts. Covered by zones.test.ts (6).
@yan-vidal
yan-vidal force-pushed the task/TV2.1-zone-resolver branch from 74a2c4e to 768bb73 Compare June 18, 2026 01:09
…in CI

- check-sdk minor (CheckContext.repoRoot, TV2.3); core patch (resolveZones, TV2.1).
- New CI 'Changeset' job runs on pull_request and fails when a publishable
  package changed without a changeset, pointing at `changeset add --empty` for
  changes that need no release. Makes the release decision a standard PR gate.
The Changesets release PR (head changeset-release/main) consumes the changeset
files, which would make the status gate fail and block releases. Skip the gate
step on that branch; the job still runs and reports success.
@yan-vidal
yan-vidal merged commit 45468a9 into main Jun 18, 2026
2 checks passed
@yan-vidal
yan-vidal deleted the task/TV2.1-zone-resolver branch June 18, 2026 01:50
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