Include paths should support project-root-relative resolution #102

Closed
opened 2025-12-16 23:04:28 +00:00 by navicore · 4 comments
navicore commented 2025-12-16 23:04:28 +00:00 (Migrated from github.com)

Summary

The include statement blocks paths containing .., which prevents test files in a separate directory from including source files.

Current Behavior

$ cat tests/seq/test_tokenizer.seq
include "../../src/tokenizer"

$ seqc tests/seq/test_tokenizer.seq -o test_tokenizer
Error: paths cannot contain '..'

The include processor has a hardcoded check that rejects any path containing .. before path resolution occurs.

Expected Behavior

Include paths should go through the same path resolution utilities that other file operations in patch-seq use. The .. segments should be resolved normally, allowing:

# In tests/seq/test_tokenizer.seq
include "../../src/tokenizer"  # Should resolve to src/tokenizer.seq

Use Case

This prevents organizing tests in a separate directory structure:

project/
  src/
    tokenizer.seq
    parser.seq
    eval.seq
  tests/
    seq/
      test_tokenizer.seq   # wants include "../../src/tokenizer"
      test_parser.seq      # wants include "../../src/parser"

Currently, test files must live in src/ alongside production code, which is messy.

Root Cause

The include path processing has an explicit check blocking .. (likely as a security measure), but this is inconsistent with other path utilities in patch-seq that can handle relative paths with .. and ~.

Environment

  • Seq version: patch-seq (latest)
  • OS: macOS Darwin 25.1.0
## Summary The `include` statement blocks paths containing `..`, which prevents test files in a separate directory from including source files. ## Current Behavior ```bash $ cat tests/seq/test_tokenizer.seq include "../../src/tokenizer" $ seqc tests/seq/test_tokenizer.seq -o test_tokenizer Error: paths cannot contain '..' ``` The include processor has a hardcoded check that rejects any path containing `..` before path resolution occurs. ## Expected Behavior Include paths should go through the same path resolution utilities that other file operations in patch-seq use. The `..` segments should be resolved normally, allowing: ```seq # In tests/seq/test_tokenizer.seq include "../../src/tokenizer" # Should resolve to src/tokenizer.seq ``` ## Use Case This prevents organizing tests in a separate directory structure: ``` project/ src/ tokenizer.seq parser.seq eval.seq tests/ seq/ test_tokenizer.seq # wants include "../../src/tokenizer" test_parser.seq # wants include "../../src/parser" ``` Currently, test files must live in `src/` alongside production code, which is messy. ## Root Cause The include path processing has an explicit check blocking `..` (likely as a security measure), but this is inconsistent with other path utilities in patch-seq that can handle relative paths with `..` and `~`. ## Environment - Seq version: patch-seq (latest) - OS: macOS Darwin 25.1.0
navicore commented 2025-12-16 23:31:20 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/pull/103
navicore commented 2025-12-17 00:22:13 +00:00 (Migrated from github.com)

not fully fixed. we still get the unhelpful blocking check and error of:

"resolves outside the project directory".

It seems seqc considers tests/seq/ as the project directory and won't allow includes that resolve outside of it. this might have been a sensible restriction at one time but it is just friction now.

not fully fixed. we still get the unhelpful blocking check and error of: "resolves outside the project directory". It seems seqc considers tests/seq/ as the project directory and won't allow includes that resolve outside of it. this might have been a sensible restriction at one time but it is just friction now.
navicore commented 2025-12-17 00:34:37 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/commit/f2025ab7a9ada6894712d099700e9d90ee45bbbe
navicore commented 2025-12-17 00:40:45 +00:00 (Migrated from github.com)

Fixed! Tests now compile and run from tests/seq/ with include "../../src/..." paths. Thanks for the quick turnaround.

Fixed! Tests now compile and run from `tests/seq/` with `include "../../src/..."` paths. Thanks for the quick turnaround.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-seq#102
No description provided.