Skip to content

refactor(engine,app): consolidate gating descriptors, option intake, and planning seams#31

Merged
ncode merged 3 commits into
mainfrom
juliano/deepen-cli-intake-and-gating-descriptors
Jul 7, 2026
Merged

refactor(engine,app): consolidate gating descriptors, option intake, and planning seams#31
ncode merged 3 commits into
mainfrom
juliano/deepen-cli-intake-and-gating-descriptors

Conversation

@ncode

@ncode ncode commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Implements and archives OpenSpec change deepen-cli-intake-and-gating-descriptors (and archives its prerequisite add-fact-disable-controls, closing its deferred cache regression task).

Two vocabularies that had to agree by convention now have single sources of truth, and the CLI stops mirroring engine planning:

  • Gating descriptor table (internal/engine/descriptors.go): one row per core fact category (root, Facter-compat group, gating class, emitted roots, probe consumers, emits-under) now drives buildCoreFacts gating, BuiltinFactGroups (a projection), and one shared fact-hierarchy helper replacing four independent ancestor/descendant walks. Agreement is enforced by test.
  • Registry-driven option intake (internal/app/options.go): runQuery's 28 hand flag declarations replaced by a FlagSet derived from the cli registry (with a registry↔parser parity test); the hand-rolled arg walkers are gone — list tasks use a registry-driven whole-tail scanner preserving the historical permissive semantics.
  • Engine-owned planning seam: the version fast path and --list-*-groups consume the engine's resolved external-dir planning instead of re-deriving it.
  • Bug fix (spec-required, found by the pins): a disabled fact could be resurrected from cache on the query path. Disabled subtraction is now confined to the cache interaction — cache can neither serve nor persist disabled facts; all non-cache output stays byte-identical.

Verification

  • Behavior-preserving by construction: pre-refactor pin tests landed first (list-task semantics, error-prefix tiers, fast-path bytes, emission order, cache/disable ordering); pre-existing test files unmodified (additions only, except the sanctioned core_gating_test.go list→table migration). 2382 tests, go vet, acceptance suite green.
  • Adversarial review: multi-lens panel + Codex + OpenCodeReview; 5 real divergences found (timing line order, list-task task-flag/positional handling, no-cache disabled-query output, over-widened disable filtering) and fixed with HEAD-vs-fixed differential binary proofs, each pinned by a regression test.
  • Lab-validated on nlab native guests: FreeBSD, OmniOS (illumos identity), OpenBSD, NetBSD, DragonFly, Windows, Plan 9 — discovery, target identities, --disable packages resolution-gating, list tasks (incl. the new task-flag tolerance), fast-path bytes all pass.

OpenSpec

  • openspec/changes/archive/2026-07-06-add-fact-disable-controls/ — archived; deltas synced (new fact-disable-controls capability spec, --disable option contract, native input keys).
  • openspec/changes/archive/2026-07-06-deepen-cli-intake-and-gating-descriptors/ — archived; deltas synced (vocabulary-drives-parser, fast-path planning seam, list-task shared intake, error-rendering tiers, descriptor-table requirement). openspec validate --strict passed pre-archive.

ncode added 3 commits July 6, 2026 17:15
…and planning seams

Implement OpenSpec change deepen-cli-intake-and-gating-descriptors:

- internal/engine: one gating descriptor table (descriptors.go) now drives
  buildCoreFacts gating, BuiltinFactGroups (as a projection), and a shared
  fact-hierarchy helper replacing four independent ancestor/descendant walks;
  agreement between gate names, group membership, and emitted roots is
  enforced by test instead of convention.
- internal/app: the runQuery FlagSet is derived from the cli option registry
  (options.go) with a registry<->parser parity test; the hand-rolled
  configPathFromArgs/externalDirsFromArgs walkers are replaced by a
  registry-driven whole-tail scanner that preserves the historical permissive
  list-task semantics (positionals, --, and extra task flags ignored).
- engine planning seam: the version fast path and list-group tasks consume
  the engine's resolved external-dir planning instead of mirroring it.
- bug fix: a disabled fact is no longer served from cache on the query path;
  the disabled subtraction is confined to the cache interaction so all
  non-cache output stays byte-identical (closes the deferred
  add-fact-disable-controls task 1.6 with regression tests).

Behavior-preserving otherwise: pre-refactor pin tests lock list-task option
semantics, error-prefix tiers, fast-path bytes, and inline fact emission
order. Adversarially reviewed (multi-lens panel + Codex + OCR; five
divergences found and fixed with HEAD-differential proofs) and lab-validated
on FreeBSD, OmniOS, OpenBSD, NetBSD, DragonFly, Windows, and Plan 9.
…ake-and-gating-descriptors, sync main specs

- add-fact-disable-controls: task 1.6 closed by the gating-descriptors change
  (cache-resurrection regression tests); deltas synced — new
  fact-disable-controls capability spec, --disable in the CLI option
  contract, native disable/blocklist keys and FACTS_DISABLE reservation in
  facts-native-input-surface.
- deepen-cli-intake-and-gating-descriptors: deltas synced — option vocabulary
  drives the parser, fast path consumes engine-resolved planning, list-task
  shared intake with permissive scan, stable option-error rendering tiers,
  and the gating descriptor table requirement on fact-disable-controls.
Both changes moved to openspec/changes/archive/2026-07-06-*.
TestCoreFactDescriptors_coverEmittedRoots failed on FreeBSD, NetBSD, and
OmniOS CI VMs: disksCoreFacts emits zfs.* on ZFS hosts, but the disks
descriptor listed only disks/mountpoints/partitions/zpool. Beyond the test,
the gap was a live gating bug on ZFS hosts: disabling every listed root
would wrongly gate the resolver and drop zfs facts with it. ZFS-less local
hosts could not catch this — the coverage test asserts against the live
host by design.
@ncode ncode merged commit 9bc4ea7 into main Jul 7, 2026
37 checks passed
@ncode ncode deleted the juliano/deepen-cli-intake-and-gating-descriptors branch July 7, 2026 12:00
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