Skip to content

Latest commit

 

History

History
199 lines (182 loc) · 21.7 KB

TESTING.md

File metadata and controls

199 lines (182 loc) · 21.7 KB

Harness config test matrix

Harness config tests should prove that activation is a deterministic projection: the same canonical input set from the Standard's Copy Projection section produces the same managed projection subset.

Mutable-file tests should also prove the ownership transition: source creates the target file once, runtime edits are preserved, and explicit force re-projection is the only path back to source bytes.

Covered Scenarios

Area Scenario Test
TOML Valid harness.toml with required target-local paths, optional target parents, default .harness/harness.toml manifest path, and ordered [[resources]] / [[dir]] source roots packages/core/test/standard.test.ts
TOML Unsupported standard versions fail validation packages/core/test/standard.test.ts
TOML Unknown top-level tables or keys and unknown [[targets]], [[resources]], [[dir]], and [activation] fields are accepted and surfaced as informational diagnostics packages/core/test/standard.test.ts
TOML Target paths reject absolute paths, .., .harness, duplicate resolved roots, and overlapping target roots while allowing arbitrary repo-local target folders and explicit external parents packages/core/test/standard.test.ts
TOML [[resources]].path, [[dir]].path, and [[targets]].parent expand gitignore-style wildcard patterns, including **, ?, character classes, backslash escapes, absolute target parents, file/symlink exclusion, and validation after expansion, while [[targets]].path rejects wildcard patterns packages/core/test/standard.test.ts
TOML Single [resources] and [dir] tables are rejected; configured source paths reject target overlaps and resolve independently from target roots packages/core/test/standard.test.ts
TOML Missing configured source roots pass as empty layers packages/core/test/standard.test.ts
TOML Duplicate targets, including explicit .agents, are diagnostics packages/core/test/standard.test.ts
TOML Extension declarations parse with version, default activation, and extension-owned fields packages/core/test/standard.test.ts
Ignore Global patterns, directory patterns, **, *, and negation packages/core/test/standard.test.ts
Ignore Unsupported target-specific sections such as [.claude] and [!.cursor] packages/core/test/standard.test.ts
Ignore Global reset sections such as [*] packages/core/test/standard.test.ts
Ignore Source-local, target-output-local, root source/output, and shallow-first precedence packages/core/test/standard.test.ts
Profiles Root and target-local .harnessProfile selectors discover active profiles and protected target selectors packages/core/test/standard.test.ts
Profiles .harnessProfile and .harnessProfileRoot grammar, empty selector behavior, and multi-line severity packages/core/test/standard.test.ts
Profiles Nested .harnessProfileRoot declarations and profile roots outside configured source roots are diagnostics packages/core/test/standard.test.ts
Profiles Malformed .harnessProfileIsolation declarations, including unknown fields, are validation diagnostics packages/core/test/standard.test.ts
Projection Explicit .agents copy projection with .agents overrides packages/core/test/projection.test.ts
Projection Explicit .harness/resources tree projects direct files and target-root overrides packages/core/test/projection.test.ts, packages/cli/test/run.test.ts
Projection External target parents project resources and target-scoped dir outputs into sibling worktree-style targets while preserving target-output controls packages/core/test/projection.test.ts, packages/cli/test/run.test.ts
Projection Multiple external parents can declare the same target-local path and project independently, including target-local profile selectors outside the repo packages/core/test/projection.test.ts
Projection Wildcard resources roots, dir roots, and target parents expand into deterministic source layers and multiple concrete external target projections; target-local profile and ignore controls remain isolated per expanded target; a target parent pattern with no matches does not redirect target-scoped dir outputs to the repo root packages/core/test/projection.test.ts, packages/cli/test/run.test.ts
Projection .harnessProfileIsolation can isolate wildcard-expanded pack resources to active same-name profile roots while excluding inactive sibling packs and general matching resources, with negated patterns preserving carved-out resource paths packages/core/test/projection.test.ts
Projection Repo-root .harnessIgnore filters resource projection by configured source paths and target output paths packages/core/test/projection.test.ts
Projection Ordered [[resources]] roots project resources, target overrides, profile roots, source-local ignores, exact replacement, and composable merge behavior packages/core/test/projection.test.ts
Projection Activation can load a repo-local manifest from an explicit non-default config path packages/core/test/projection.test.ts, packages/cli/test/run.test.ts
Projection Resource files can be composed from .harnessComposable leaves, including .harnessRef imports, recipient-local .harnessIgnore filters, target-output .harnessIgnore boundaries, and profile overlays packages/core/test/projection.test.ts
Projection Additional target copy projection with target-derived overrides packages/core/test/projection.test.ts
Projection Override-local .harnessIgnore files act as target-output boundaries for base and profile resources while real target-output rules keep final precedence packages/core/test/projection.test.ts
Projection Nested override contents such as plugin manifests and nested skills packages/core/test/projection.test.ts
Projection Arbitrary resource kinds under configured resources sources project without per-kind manifest declarations packages/core/test/projection.test.ts
Projection Scoped .harnessIgnore changes target output independently packages/core/test/projection.test.ts
Projection Logical-depth .harnessIgnore precedence lets deeper source-local and profile-local rules re-include selected paths while leaving siblings ignored packages/core/test/projection.test.ts
Projection Whole configured resource roots can be suppressed by repo-root or source-local .harnessIgnore, and cleanup remains explicit with --remove-unmanaged packages/core/test/projection.test.ts
Projection Profile-local .harnessIgnore can select resources across multiple resource groups without copying a profile catalog packages/core/test/projection.test.ts
Projection Same-named active profiles across multiple resource roots evaluate profile-local .harnessIgnore files independently packages/core/test/projection.test.ts
Projection Target-derived override .harnessIgnore files evaluate at logical target/source locations rather than physical dot-folder storage paths packages/core/test/projection.test.ts
Projection Target-output .harnessIgnore filters one target and is preserved during cleanup packages/core/test/projection.test.ts
Projection Active .harnessProfileRoot overlays merge resources, suppress base resources with logical .harnessIgnore, and preserve target-local .harnessProfile during cleanup packages/core/test/projection.test.ts
Projection Target-output .harnessIgnore remains the final boundary when profile-local rules also match packages/core/test/projection.test.ts
Projection Target overrides stay above generic active profile overlays, while profile target overrides can still specialize targets packages/core/test/projection.test.ts
Projection Exact target-root and item-level override collisions resolve by deterministic last-wins ordering, while file/directory shape conflicts remain errors packages/core/test/projection.test.ts
Projection Portable profile roots nested inside resource items overlay the containing item packages/core/test/projection.test.ts
Projection Multiple active profile roots projecting the same file emit a warning and resolve deterministically packages/core/test/projection.test.ts
Projection Activation planning reports profile diagnostics once despite shared dir/resource phases packages/core/test/projection.test.ts
Projection Profile switching reports outputs from the prior non-active profile as orphaned managed outputs, preserves them by default, removes unedited orphans only under explicit orphan cleanup, and preserves edited orphans plus genuinely unmanaged entries packages/core/test/projection.test.ts
Projection Paths produced by both the active and non-active profile remain managed keep or update actions rather than orphaned managed outputs packages/core/test/projection.test.ts
Projection Orphan cleanup respects target-output .harnessIgnore boundaries so ignored prior-profile outputs are not removed as orphaned managed outputs packages/core/test/projection.test.ts
Projection Orphan cleanup compares current bytes with the final non-active target override projection, including dotfile outputs such as .gitignore packages/core/test/projection.test.ts
TOML Target paths determine override folders from the first path segment packages/core/test/standard.test.ts
TOML Target paths are explicit target-local paths, optional parents can place outputs outside the repo, and targets are not constrained to named harness surfaces packages/core/test/standard.test.ts, packages/cli/test/run.test.ts
Projection Identical declared targets are still materialized as copy projections packages/core/test/projection.test.ts
TOML [activation].targetSymlinks defaults to conflict and accepts explicit replace packages/core/test/standard.test.ts
Projection Target root and nested target symlinks are treated as leaf entries: projected symlink paths conflict by default, explicit replacement replaces the link itself, unmanaged links are preserved by default packages/core/test/projection.test.ts
Projection Changed source files plan update actions packages/core/test/projection.test.ts
Projection Unmanaged target entries are preserved by default and summarized at one level packages/core/test/projection.test.ts
Projection Explicit unmanaged cleanup plans remove actions packages/core/test/projection.test.ts
Projection Source deletion plus explicit cleanup removes stale target files packages/core/test/projection.test.ts
Projection Re-running after apply converges to keep actions packages/core/test/projection.test.ts
Projection Mutable files are created once and then reported as mutable packages/core/test/projection.test.ts
Projection Resource composable leaves matched by .harnessMutable are created once as composed files and then reported as mutable packages/core/test/projection.test.ts
Projection Mutable files report mutable even when target bytes still match source packages/core/test/projection.test.ts
Projection Mutable files are not overwritten when bytes diverge in the target packages/core/test/projection.test.ts
Projection --force-mutable re-projects mutable files from source packages/core/test/projection.test.ts
Projection Ignore rules win when a file is both ignored and marked mutable packages/core/test/projection.test.ts
Projection Target byte changes plan update actions by direct comparison packages/core/test/projection.test.ts
Dir [[dir]] composes top-level, nested, dot-directory, and extensionless outputs with the .harnessComposable marker packages/core/test/dir.test.ts
Dir [[dir]] .harnessRef imports parts and sorts them with local parts packages/core/test/dir.test.ts
Dir [[dir]] honors only global .harnessIgnore rules during composition packages/core/test/dir.test.ts
Dir [[dir]] honors source-local .harnessIgnore inside .harnessComposable leaves, including custom dir sources outside .harness packages/core/test/dir.test.ts
Dir [[dir]] honors target-output .harnessIgnore for copy and composable outputs packages/core/test/dir.test.ts
Dir [[dir]] active profile roots add composable parts and use logical .harnessIgnore files to suppress base parts packages/core/test/dir.test.ts
Dir .harnessProfileIsolation can isolate selected dir output paths to active same-name wildcard pack profile roots while preserving unrelated or negated base dir outputs packages/core/test/dir.test.ts
Dir [[dir]] portable profile roots nested inside composable leaves can add profile parts packages/core/test/dir.test.ts
Dir [[dir]] discovers target-output .harnessProfile selectors in the final bootstrap pass, including profile-only dir outputs with no base candidate packages/core/test/dir.test.ts
Dir [[dir]] reports invalid parts, mixed containers, symlinks, .harnessRef errors, target overlaps, and source-source overlaps packages/core/test/dir.test.ts, packages/core/test/standard.test.ts
Dir [[dir]] reports create, update, and keep actions across activations packages/core/test/dir.test.ts
Dir [[dir]] copies files from directories without the .harnessComposable marker packages/core/test/dir.test.ts
Dir [[dir]] never copies the .harnessComposable marker file itself packages/core/test/dir.test.ts
Dir [[dir]] ordered roots support later exact-path replacement, same-path composable merge, direct-file replacement of a composable output, target-merged outputs, and file/folder conflicts packages/core/test/dir.test.ts
Dir [[dir]] outputs that fall under a declared target are merged into that target's projection packages/core/test/dir.test.ts
Dir Dir outputs do nothing when no [[dir]] entries are declared even if a conventional folder exists packages/core/test/dir.test.ts
CLI harnessc activate runs dir composition + copy alongside resource projection packages/cli/test/run.test.ts
Ignore .harnessMutable rules and unsupported [mutable] sections in .harnessIgnore packages/core/test/standard.test.ts
Docs STANDARD.md stays independent of package names, repo paths, and CLI flags packages/core/test/docs.test.ts
CLI harnessc init dry-runs by default packages/cli/test/run.test.ts
CLI harnessc init --yes creates the standard files and resource folders under .harness/resources by default packages/cli/test/run.test.ts
CLI harnessc init --config --resources-path --target --yes writes a non-default manifest and activates from the configured resources source root packages/cli/test/run.test.ts
CLI harnessc activate dry-runs by default packages/cli/test/run.test.ts
CLI harnessc activate --yes writes live targets packages/cli/test/run.test.ts
CLI --remove-unmanaged changes preserved unmanaged entries into removals packages/cli/test/run.test.ts
CLI --keep-unmanaged and --remove-unmanaged cannot be used together packages/cli/test/run.test.ts
CLI --remove-orphans removes only unedited orphaned managed outputs after a profile switch, while default activation and --keep-orphans preserve them packages/cli/test/run.test.ts
CLI --keep-orphans and --remove-orphans cannot be used together packages/cli/test/run.test.ts
CLI --force-mutable re-projects mutable files; default skips them packages/cli/test/run.test.ts
CLI --replace-target-symlinks is required before harnessc activate --yes replaces a target symlink conflict packages/cli/test/run.test.ts
CLI Invalid activation TOML returns diagnostics and a non-zero exit packages/cli/test/run.test.ts
CLI Human output is colorized only for color-capable sinks, while --json stays unstyled packages/cli/test/run.test.ts
CLI harnessc extension activate reports unsupported extension selections and conflicting flags packages/cli/test/run.test.ts
CLI harnessc explain <path> reports projected outputs, participating source roots, source-use paths, ignore decisions, and diagnostics in JSON and human-readable forms packages/cli/test/run.test.ts
CLI harnessc explain --json reports winning ignore decisions for repo-root exclusions, source-local and profile-local re-includes, and target-output final boundaries packages/cli/test/run.test.ts
CLI E2E harnessc activate runs composable + copy + .harnessRef + cross-target dir composition end-to-end packages/cli/test/run.test.ts
CLI E2E harnessc activate honors target-output .harnessIgnore, custom dir source ignores, and cleanup preservation packages/cli/test/run.test.ts
CLI E2E harnessc activate projects resource composables through target-output .harnessIgnore, target-local .harnessProfile, and unmanaged cleanup packages/cli/test/run.test.ts
CLI E2E harnessc activate applies profile roots across resources and composable dir outputs packages/cli/test/run.test.ts
CLI E2E harnessc validate and harnessc activate --yes apply .harnessProfileIsolation across wildcard pack resource and dir roots packages/cli/test/run.test.ts
Examples Every documented examples/* mini-repo validates, dry-runs, applies, asserts its characteristic generated outputs, and converges to keep or mutable on a second dry run packages/cli/test/examples.test.ts
Examples Example directories, root README links, examples README links, and example-local generated-output .gitignore rules stay aligned so tracked source fixtures are not hidden from CI packages/cli/test/examples.test.ts
Examples Wildcard examples project external target-parent fanout into sibling worktrees and collect monorepo package-owned wildcard resources / dir roots packages/cli/test/examples.test.ts
Examples Isolated profile-pack examples suppress matching base resources and dir outputs while preserving same-name local pack overlays and unrelated outputs, then switch to another isolated pack and remove stale profile outputs packages/cli/test/examples.test.ts
Docs Translated website specification sections keep heading, fenced-code, identifier, diagnostic-code, flag, and RFC 2119 keyword parity with English packages/core/test/locales.test.ts

Known gap: orphaned managed output cleanup covers target copy projection. Dir composition does not yet have a cleanup action model for orphaned dir outputs; add those scenarios only after dir activation gains an explicit cleanup mechanism.

Manual Smoke Command

pnpm run quality

The quality gate runs linting, TypeScript checks, package tests, builds, and package dry-runs.

For a focused activation smoke test:

tmp="$(mktemp -d)"
mkdir -p "$tmp/.harness/resources/.claude" "$tmp/.harness/resources/skills/review/.agents" "$tmp/.harness/resources/skills/review/.claude"
printf 'version = 1\n\n[[resources]]\npath = "./.harness/resources"\n\n[[targets]]\npath = "./.agents"\n\n[[targets]]\npath = "./.claude"\n' > "$tmp/.harness/harness.toml"
printf '.harness/**/logs/\n' > "$tmp/.harnessIgnore"
printf 'base\n' > "$tmp/.harness/resources/skills/review/SKILL.md"
printf 'agents\n' > "$tmp/.harness/resources/skills/review/.agents/SKILL.md"
printf 'claude\n' > "$tmp/.harness/resources/skills/review/.claude/SKILL.md"
printf 'shared hooks\n' > "$tmp/.harness/resources/hooks.json"
printf 'claude hooks\n' > "$tmp/.harness/resources/.claude/hooks.json"
node packages/cli/dist/bin.js activate --root "$tmp"
node packages/cli/dist/bin.js activate --root "$tmp" --yes
node packages/cli/dist/bin.js activate --root "$tmp"

The first command should report creates without writing. The second should apply. The third should report keeps for the same source inputs.

For a focused update smoke test:

tmp="$(mktemp -d)"
mkdir -p "$tmp/.harness/resources/skills/review"
printf 'version = 1\n\n[[resources]]\npath = "./.harness/resources"\n\n[[targets]]\npath = "./.agents"\n' > "$tmp/.harness/harness.toml"
printf '' > "$tmp/.harnessIgnore"
printf 'source\n' > "$tmp/.harness/resources/skills/review/SKILL.md"
node packages/cli/dist/bin.js activate --root "$tmp" --yes
printf 'target edit\n' > "$tmp/.agents/skills/review/SKILL.md"
node packages/cli/dist/bin.js activate --root "$tmp"
node packages/cli/dist/bin.js activate --root "$tmp" --yes
cat "$tmp/.agents/skills/review/SKILL.md"

The dry run after editing the target should report update 1 by direct comparison. The apply should overwrite the target from source, and the final cat should print source.

For a focused mutable smoke test:

tmp="$(mktemp -d)"
mkdir -p "$tmp/.harness/resources/skills/review"
printf 'version = 1\n\n[[resources]]\npath = "./.harness/resources"\n\n[[targets]]\npath = "./.agents"\n' > "$tmp/.harness/harness.toml"
printf '.harness/resources/**/settings.local.json\n' > "$tmp/.harnessMutable"
printf 'base\n' > "$tmp/.harness/resources/skills/review/SKILL.md"
printf 'source local\n' > "$tmp/.harness/resources/skills/review/settings.local.json"
node packages/cli/dist/bin.js activate --root "$tmp" --yes
printf 'target local\n' > "$tmp/.agents/skills/review/settings.local.json"
node packages/cli/dist/bin.js activate --root "$tmp"
node packages/cli/dist/bin.js activate --root "$tmp" --yes --force-mutable
cat "$tmp/.agents/skills/review/settings.local.json"

The dry run after editing the mutable target should report mutable 1 and leave the target file unchanged. The --force-mutable apply should overwrite the mutable target from source, and the final cat should print source local.