Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 10, 2025

Summary

  • Implement validation to prevent references to non-existent links in query operations
  • Allow references to link IDs that will become available after the current operation
  • Add comprehensive test coverage for the validation functionality

Changes Made

  • Added ValidateLinksExistOrWillBeCreated function to check link references
  • Collect all link IDs that will be created in substitution patterns
  • Validate that references in both restriction and substitution patterns are valid
  • Support for mutual references between links created in same operation
  • Proper handling of variables ($var), wildcards (*), and definitions vs references

Test Coverage

  • Test for invalid reference to non-existent link (should throw exception)
  • Test for valid self-references (should succeed)
  • Test for mutual cross-references in same operation (should succeed)
  • Test for references to existing links (should succeed)
  • Test for update operations with invalid references (should throw exception)
  • Test that variables and wildcards are not validated (should succeed)

Example Behaviors

❌ Invalid (now prevented):

clink '() ((1: 10 20))' # Links 10 and 20 don't exist and won't be created

✅ Valid (still allowed):

clink '() ((1: 1 2) (2: 2 1))' # Both links created in same operation
clink '() ((1: 1 1))'          # Self-reference
clink '(() ((1: $var *)))'     # Variables and wildcards

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]


Resolves #15

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #15
@konard konard self-assigned this Sep 10, 2025
konard and others added 2 commits September 10, 2025 17:21
…tent links

- Add validation to ensure link references either exist or will be created in the current operation
- Allow references to links that will become available after the operation (e.g., mutual references)
- Prevent invalid references to links that don't exist and won't be created
- Add comprehensive test coverage for the validation functionality
- Includes proper handling of variables, wildcards, and definitions vs references

Fixes #15

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Make it impossible to make a reference to a link, that does not exists Make it impossible to make a reference to a link that does not exist Sep 10, 2025
@konard konard marked this pull request as ready for review September 10, 2025 14:36
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.

Make it impossible to make a reference to a link, that does not exists

2 participants