feat(autonumber): document tokens in data skill + lint unrecognized format tokens#2046
Merged
Merged
Conversation
…rmat tokens Follow-up to #2043 — close the AI-authoring gap on top of the runtime guards: - skills/objectstack-data field-types rules: the autonumber section only showed `CASE-{0000}`. Expanded with the date / {field} / per-scope tokens and the authoring rules that prevent silent mis-numbering — interpolated fields must be required, put a delimiter between adjacent variable tokens, pad width is a minimum, date tokens are exact/case-sensitive — plus an incorrect/correct example. - compile lint: warn when an autonumber `{...}` token is not a counter/date/{field} token. Unrecognized groups (wrong case, spaces, a second {0..0} slot) render LITERALLY into the record number; the field-reference checks miss the non-identifier cases. New advisory rule `autonumber-unrecognized-token`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 15 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2043. The runtime guards landed there; this closes the AI-authoring gap, per the AI-authoring-guardrails north star (templates are AI-written, so the fix belongs in the skill the AI reads + a deterministic build lint).
Why
After #2043 the
objectstack-dataskill'sfield-typesrules still documented autonumber as justCASE-{0000}— no mention of the new date /{field}/ per-scope tokens, and none of the rules that prevent silent mis-numbering. An AI modeling from that skill would neither use the new capability nor avoid the footguns.Changes
Skill rules (
skills/objectstack-data/rules/field-types.md) — expanded the autonumber section:{0000}counter,{YYYY}/{MM}/{DD}/{YYYYMMDD}date,{field}interpolation) + per-scope reset explanation{field}must berequired; delimiter between adjacent variable tokens; pad width is a minimum (grows, never wraps); date tokens are exact & case-sensitiveCompile lint (
lint-autonumber-formats.ts) — new advisory ruleautonumber-unrecognized-token: an autonumber{...}group that is not a counter/date/{field}token renders literally into the record number. The existing{field}-reference checks catch identifier-shaped typos (they parse as "unknown field" errors), but miss non-identifier cases —{ YYYY }(spaces),{YYYY-MM}(punctuation), and a second{0..0}slot. These now warn.Scope notes
lintFlowPatterns/lintLivenessProperties.Tests
lint-autonumber-formats.test.ts: +3 cases (unrecognized token, second sequence slot, valid date tokens stay clean). CLI suite 496/496; package builds (tsc) clean.🤖 Generated with Claude Code