8000 feat: resolve CDD execution rules into literal state references by tomrford · Pull Request #55 · tomrford/gocan · GitHub
[go: up one dir, main page]

Skip to content

feat: resolve CDD execution rules into literal state references - #55

#55
Merged
tomrford merged 1 commit into
mainfrom
feat/cdd-precondition-resolution
Sep 5, 2026
Merged

tomrford merged 1 commit into
mainfrom
feat/cdd-precondition-resolution

Conversation

@tomrford
@tomrford tomrford commented Sep 5, 2026 •
Copy link
Copy Markdown
Owner

Explicit CDD execution rules currently remain unknown even when they list states that the parser can identify. Resolve instance mayBeExec lists into literal Sessions and SecurityLevels state references. For example, a list that names only the locked security state retains that state and leaves the session list empty; it does not imply ECU permission.

Resolve one-based references across all declared state groups, preserve state and service identities, and keep one alternative per bound service. Return states in document order with repeated references removed within each list. The index interpretation has empirical support from the public Vector example, which declares 25 states and references through 25, and a reported production-file check. The private file was not independently validated here.

Malformed or empty lists, unsupported groups, exclusion attributes (including empty values), and template rules retain raw metadata and Err. Template rules remain unknown even when an instance also declares a list: instance precedence for this attribute is not yet established. These errors leave codecs and sibling service alternatives usable. Omitted groups and locked states receive no inferred UDS access policy.

Validation: go test -race ./..., go vet ./..., gofmt -l ., and git diff --check passed. Both public cantools CDD examples parse successfully. Tests cover literal locked states, source identity and order, equivalent alternatives, and codec isolation when a rule is unknown.


Note

Medium Risk
Changes diagnostic precondition semantics and adds resolved state lists that downstream callers may rely on for UDS access decisions, though unsupported rule forms still fail closed with errors.

Overview
The CDD parser stops treating every execution rule as unknown and now resolves instance mayBeExec lists into Precondition.Sessions and Precondition.SecurityLevels slices of literal State values.

Indexes are interpreted as one-based positions across all declared states (including unsupported groups), matching Vector-style documents. Referenced states are returned in document order with duplicates removed, split by session vs security group; an empty side means nothing was listed for that group, not that access is allowed.

notExecInStateGroups, template mayBeExec, malformed/empty lists, out-of-range indexes, and states outside session/security still set Err and leave resolved lists nil, while raw attribute pointers and sibling service alternatives (and codecs) stay usable.

Reviewed by Cursor Bugbot for commit c934ae7. Configure here.

Resolve explicit instance mayBeExec lists against the one-based state
catalog in document order. Keep locked states literal, preserve source and
group identities, and retain one alternative per bound service. Repeated
references within a list produce one state entry. No states listed for a
group does not establish ECU permission.

Keep raw attributes and Err for unsupported rules, including empty
exclusions and template rules even when an instance rule also exists.
Validate the whole list before exposing resolved states. Unknown rules
leave codecs and sibling services usable and produce one diagnostic on
the accepted DID.

The flattened index reading is supported empirically by the public Vector
example in cantools at f74f76888d2c88329266b33947aa6ea534ddd213
(tests/files/cdd/example-diddatarefs.cdd: 25 states, references through 25)
and the reported production-file check (12 states, 335 rules). The private
file was not independently checked here. This evidence does not establish
omitted-group semantics, template precedence or UDS access policy.

Keep the API contract in Go documentation. Cover literal locked states,
source identity and order, equivalent alternatives, unsupported rules and
codec isolation. Validation: go test -race ./..., go vet ./...,
gofmt -l ., git diff --check, and parsing the two public cantools CDDs.
@tomrford
tomrford commented Sep 5, 2026
Copy link
Copy Markdown
Owner Author

@cursor review

@cursor cursor Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c934ae7. Configure here.

@tomrford
tomrford merged commit a712dbf into main Sep 5, 2026
2 checks passed
@tomrford
tomrford deleted the feat/cdd-precondition-resolution branch September 5, 2026 11:39
tomrford added a commit that referenced this pull request Sep 5, 2026
TestSendAndReceivePairedLinks compared live capture.End() snapshots while
other virtual buses were still recording RX copies, which made main CI
flake after #55.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0