# Self-test: verify-sqlite-schema

Run these manually before promoting this skill.

## Test 1 — Trigger activation

1. Start a fresh conversation in this repo
2. Type: "is the column Status available in the Visit table of app.db3?"
3. **Pass criterion:** Claude announces using the `verify-sqlite-schema` skill

## Test 2 — Stage 1 hit (happy path)

Pick a column known to exist locally:

```bash
sqlite3 appl/data/app.db3 ".schema Visit" | head -20
```

Trigger the skill with that column.
**Pass criterion:** skill reports `ok` after Stage 1 without calling `sf`.

## Test 3 — Stage 1 miss, Stage 2 runs

Pick a plausible-sounding column likely missing locally (e.g., `CustomerRating__c` on `Visit`).

Trigger the skill.
**Pass criterion:**

-   Stage 1 reports missing
-   Stage 2 runs `sf sobject describe` commands
-   Skill shows the SObject-name resolution trace
-   Skill halts for user input if the org investigation is needed

## Test 4 — Dry-run remediation (do NOT deploy)

In a sandbox/scratch org:

1. Find an SObject with a field NOT in `Mobility_relevant`
2. Trigger the skill with that table + column
3. **Pass criterion:** skill shows the proposed XML diff, then asks for approval
4. Answer "no" — skill returns `skill_declined` without deploying

## Test 5 — Org-disconnect handling

1. Run `sf org logout --target-org <alias>`
2. Trigger the skill with a local-miss column
3. **Pass criterion:** skill reports `NOT_CONNECTED` and instructs the user to run `sf org login web`
4. Log back in: `sf org login web`

## Test 6 — Managed-package SObject

1. Find a managed-package SObject (name contains `__` prefix)
2. Trigger the skill against it
3. **Pass criterion:** skill tries the managed-prefix mapping rule in order and finds the match
4. If the field set is read-only (deployable=false), skill declines to modify and reports this clearly

## Test 7 — Real authoring scenario

While writing a real DS in this repo:

1. Intentionally reference a column you suspect doesn't sync (e.g., a newly added field)
2. Run `sf mdl build` — passes
3. Run `sf mdl simulate` — crashes with SQLITE_ERROR
4. Trigger the skill
5. **Pass criterion:** skill diagnoses correctly and either remediates or explains why it can't
