Skip to content

Commit 9ef34a3

Browse files
committed
docs(skills): the indexing rule's partial-index example uses a table no other example declares with a different uniqueness
The round-1 re-cut reused (source, dedup_key), which line 61 of the same file declares unique: 'global'. Read together the two contradict: a global unique already forbids a second job with that key in any status, so the partial form would add nothing. The example is now one active subscription per account — the coarse { fields: ['account_id'] } declared in metadata, a unique partial index ON subscription (account_id) WHERE status = 'active' built in the migration — columns no other example in the file declares. The rule sentence, the fallback and the platform pointer are unchanged; the changeset sentence that named the pair follows. 230 lines, 2200 tokens against main's 2202. Claude-Session: https://claude.ai/code/session_012dGTuJen61ECNHXYXKChoC Co-authored-by: Claude <noreply@anthropic.com>
1 parent 34a834a commit 9ef34a3

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎.changeset/23039-indexing-partial-example-recut.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ docs(skills): the `objectstack-data` indexing rule's partial-index example teach
66

77
Clause-②: no
88

9-
`skills/objectstack-data/rules/indexing.md`'s "Access methods and partial indexes" section illustrated a partial index with the platform's own overlay-uniqueness DDL and said that was what `ensureOverlayIndex` runs. The quoted key had four parts; the platform's runtime key has carried a fifth, `bundle_member`, since protocol 18, so the sentence stated something the platform no longer runs. The example is re-cut to an application-shaped partial index — one *pending* job per dedup key, the coarse `{ fields: ['source', 'dedup_key'] }` declared in metadata and the unique partial form built in a migration — so the rule is taught without restating a platform key that changes on its own schedule. The rule itself is unchanged: declare the coarse index (or none) in metadata, build the partial form as raw SQL in a runtime migration, fall back to a plain index on a dialect that rejects the predicate. Nothing an author writes changes.
9+
`skills/objectstack-data/rules/indexing.md`'s "Access methods and partial indexes" section illustrated a partial index with the platform's own overlay-uniqueness DDL and said that was what `ensureOverlayIndex` runs. The quoted key had four parts; the platform's runtime key has carried a fifth, `bundle_member`, since protocol 18, so the sentence stated something the platform no longer runs. The example is re-cut to an application-shaped partial index — one *active* subscription per account, the coarse `{ fields: ['account_id'] }` declared in metadata and the unique partial form built in a migration — so the rule is taught without restating a platform key that changes on its own schedule. The rule itself is unchanged: declare the coarse index (or none) in metadata, build the partial form as raw SQL in a runtime migration, fall back to a plain index on a dialect that rejects the predicate. Nothing an author writes changes.

‎skills/objectstack-data/rules/indexing.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ the dialect you are actually running.
157157
and SQLite (≥ 3.8.9), absent on MySQL. Because it cannot be expressed
158158
portably — and because knex's index builders have no way to emit a predicate —
159159
it is issued as raw SQL from a runtime migration, falling back to a plain
160-
index on a dialect that rejects it. One *pending* job per dedup key, the
161-
coarse `{ fields: ['source', 'dedup_key'] }` declared in metadata:
160+
index on a dialect that rejects it. One *active* subscription per account,
161+
the coarse `{ fields: ['account_id'] }` declared in metadata:
162162

163163
```sql
164-
CREATE UNIQUE INDEX IF NOT EXISTS idx_job_dedup_pending
165-
ON job (source, dedup_key)
166-
WHERE status = 'pending';
164+
CREATE UNIQUE INDEX IF NOT EXISTS idx_subscription_account_active
165+
ON subscription (account_id)
166+
WHERE status = 'active';
167167
```
168168

169169
Follow that shape: declare the coarse index (or none) in metadata, and build

0 commit comments

Comments
 (0)