Repository navigation
feat: preserve CDD service preconditions - #52
Merged
Merged
Conversation
tomrford
force-pushed
the
feat/cdd-preconditions
branch
2 times, most recently
from
September 4, 2026 23:40
f4e4d79 to
9b773f0
Compare
tomrford
marked this pull request as ready for review
September 4, 2026 23:40
tomrford
force-pushed
the
feat/cdd-preconditions
branch
2 times, most recently
from
September 5, 2026 10:21
bbf4b66 to
fc1859d
Compare
Read the STATEGROUPS declared by a CANdela document into Database.Sessions and Database.SecurityLevels, and resolve each DID service's mayBeExec state indexes into Record.Sessions and Record.SecurityLevels so consumers learn which diagnostic sessions and security levels an operation runs in without seeing the index arithmetic. A group with no listed state, or a service with no attribute, leaves the operation unrestricted. An index outside the declared states is reported in Database.Diagnostics and keeps the DID.
Carry the resolved DCLSRVTMPL alongside each SERVICE instance so servicePrecondition cannot see a nil template and does not repeat the ID lookup. Mention preconditions in the README package table.
A service permitted in the locked state has no security requirement, since UDS never rejects a request for being unlocked. SecurityLevels now lists only unlocked levels and is nil when the locked state, or no security state, is permitted. Sessions remain literal. The locked state is the first state CANdela declares in the security group.
tomrford
force-pushed
the
feat/cdd-preconditions
branch
from
September 5, 2026 10:37
ce0ec42 to
2a8c517
Compare
Owner
Author
|
@cursor review |
There was a problem hiding this comment.
✅ 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 2a8c517. Configure here.
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.
Preserve CDD execution-precondition metadata for supported DID read/write records without guessing ECU permissions. Each service bound to an operation retains its own alternative, source identity, source order, template reference, and raw instance/template rule attributes. Equivalent rules do not erase distinct source services.
Database.Statesretains every declared state with its group identity and document position.SessionsandSecurityLevelsprovide the corresponding subsets, including any locked state. Positions describe source order, not UDS subfunctions. No initial state or security privilege hierarchy is inferred.Precondition.Errmarks unknown requirements. A nil error means no explicit restriction was found on the instance or template; it does not establish ECU permission. All explicitmayBeExecandnotExecInStateGroupsrules remain unresolved. Raw pointers distinguish absent attributes from explicit empty values. Resolved restriction lists are not exposed while their semantics are unverified.Unknown requirements leave valid record encoding and decoding available. Diagnostics identify the affected operation and source service and are emitted only after DID acceptance, avoiding orphan rule diagnostics for rejected layouts and duplicate DIDs. Service binding carries the resolved template into precondition handling.
Resolution of CDD state-reference indexing, omitted groups, exclusions, and template inheritance is outside this metadata-preservation scope. These forms remain explicitly unknown. Public/generic evidence is required before adding resolved requirements; synthetic tests do not establish their meaning.
Evidence:
example-diddatarefs.cddreturns 1 DID, 10 session states, 15 security states and no diagnostics;example.cddreturns no UDS DIDs and no diagnostics.Validation at
2a8c517(rebased onto mainaf7b7ec):go test -race ./...,go vet ./...,gofmt -l ., andgit diff --checkpassed. Public Go documentation was inspected. Tests cover parse/encode/decode lifecycles, known-absent and unknown alternatives on the same operation, read/write isolation, raw rule presence, identities and source order, equal qualifiers, equivalent alternatives, and diagnostic timing after DID acceptance. Fresh independent review findings were addressed. GitHub CI passed on the rebased head, including Linux virtual CAN tests and Windows cross-compilation. Cursor Bugbot reviewed commit2a8c517and found no new issues; its check passed.Scope remains DID precondition metadata. Broader service catalogs, transitions, DTC support, and automatic ECU state changes are deferred.