Skip to content

chore: scaffold test hygiene — constant extraction, missing assertions, direct dcp.jsonc coverage #227

Description

@yvonnedevlinrh

Summary

Follow-up from PR #224 review. Addresses 3 LOW advisory findings and 1 pre-existing test gap, all scoped to internal/scaffold/scaffold_test.go (and one URL in internal/scaffold/assets/dcp.jsonc).

Tasks

1. Extract hardcoded asset count to named constant

The magic number 9 appears across 8+ test assertion sites. Each new embedded asset requires a mechanical find-and-replace.

  • Add const expectedAssetCount = 9 (or similar) in scaffold_test.go
  • Replace all hardcoded 9 count assertions with the constant

2. Complete TestRun_CreatesFiles expected file list

The on-disk existence check (line 48-56) enumerates only 7 of 9 files. Missing since before PR #224:

  • Add ".opencode/agents/gaze-test-generator.md" to the expected list
  • Add ".opencode/commands/gaze-fix.md" to the expected list

3. Add direct dcp.jsonc overwrite-on-diff coverage

TestRun_OverwriteOnDiff_ToolOwned modifies 2 .md tool-owned files and verifies restoration, but dcp.jsonc is only covered implicitly via count arithmetic.

  • In the test's "modify on disk" section, also mutate .opencode/dcp.jsonc
  • After third run, verify dcp.jsonc content matches the raw embedded asset (no marker)
  • Update expected counts: 3 updated, 6 skipped (3 user-owned + 3 identical tool-owned)

4. Pin $schema URL (optional)

dcp.jsonc references master branch:

https://raw.githubusercontent.com/Opencode-DCP/opencode-dynamic-context-pruning/master/dcp.schema.json

A pinned commit SHA or version tag would be more stable. However, this is a DCP community convention for editor tooling — defer if upstream doesn't publish tagged releases.

  • Check if DCP repo publishes tagged releases or pinnable refs
  • If yes, pin to specific ref; if no, skip (document decision)

Scope

  • Files: internal/scaffold/scaffold_test.go, optionally internal/scaffold/assets/dcp.jsonc
  • Production code changes: None (test-only + optional asset URL)
  • Spec required: No — test hygiene, no behavior change

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions