Skip to content

fix: stop forcing document paths to uppercase, guard platform context file case - #281

Open
Ruari-Phipps wants to merge 1 commit into
mainfrom
ruari/fix/allow_lowercase_context
Open

fix: stop forcing document paths to uppercase, guard platform context file case#281
Ruari-Phipps wants to merge 1 commit into
mainfrom
ruari/fix/allow_lowercase_context

Conversation

@Ruari-Phipps

Copy link
Copy Markdown
Collaborator

Summary

Stops forcing every Document's path to uppercase on construction, and instead only enforces exact-case for the platform's special CONTEXT.MD context file.

Motivation

#231 normalized all document paths to uppercase to fix a case-sensitivity conflict, but that force-uppercased every document rather than just the one path (CONTEXT.MD) the platform treats specially, causing unwanted renames for ordinary documents. discover_resources() also still forced the discovered path to uppercase, which could construct a file path that doesn't exist on case-sensitive filesystems.

Changes

  • Removed Document.__post_init__ uppercase normalization; paths now preserve their original case
  • validate() now only errors when a path case-insensitively matches CONTEXT.MD but isn't the exact-case CONTEXT.MD
  • discover_resources() no longer force-uppercases discovered file names
  • from_projection() strips both .md and .MD suffixes when deriving name
  • Updated existing tests for preserved-case behavior; added tests for the CONTEXT.MD validation and a CONTEXT.MD fixture

Test strategy

  • Added/updated unit tests
  • Manual CLI testing (poly <command>)
  • Tested against a live Agent Studio project
  • N/A (docs, config, or trivial change)

Checklist

  • ruff check . and ruff format --check . pass
  • pytest passes
  • No breaking changes to the poly CLI interface (or migration path documented)
  • Commit messages follow conventional commits

Screenshots / Logs

N/A

@Ruari-Phipps
Ruari-Phipps requested a review from a team August 19, 2026 15:45
@Ruari-Phipps
Ruari-Phipps requested a review from a team as a code owner August 19, 2026 15:45
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Base (main) PR Change
75.6% 75.6% -0.0% ⚠️

@oeisenberg
oeisenberg requested a lite review from Copilot August 19, 2026 16:49
@linear-code

linear-code Bot commented Aug 19, 2026

Copy link
Copy Markdown

DEVP-604

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refines Document case-handling to avoid renaming ordinary documents by preserving their original path casing, while still enforcing the platform’s exact-case requirement for the special CONTEXT.MD file. It updates discovery/projection parsing accordingly and adjusts the unit/integration test fixtures to cover the new behavior.

Changes:

  • Stop uppercasing all Document.path values; preserve original case and only validate exact-case for CONTEXT.MD.
  • Fix document discovery to stop force-uppercasing discovered filenames; improve projection name derivation to strip both .md and .MD.
  • Update/add tests and test-project fixtures to cover preserved-case behavior and the CONTEXT.MD constraint.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Updates the locked editable package version for polyai-adk.
src/poly/resources/documents.py Preserves document path casing; validates CONTEXT.MD exact-case; avoids uppercasing discovered filenames; adjusts projection name parsing.
src/poly/tests/resources_test.py Updates unit tests to assert case preservation and adds validation tests for CONTEXT.MD.
src/poly/tests/project_test.py Updates round-trip/discovery expectations to match preserved-case behavior and adds CONTEXT.MD to fixtures.
src/poly/tests/test_projects/test_project/test_project.json Adds a CONTEXT.MD document fixture entry.
src/poly/tests/test_projects/test_project/context/test_document.md Adds a preserved-case test document fixture file.
src/poly/tests/test_projects/test_project/context/CONTEXT.MD Adds the platform context file fixture with exact-case name.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 119 to 123
for file_name in os.listdir(context_path):
if not file_name.upper().endswith(".MD"):
continue
file_path = os.path.join(context_path, file_name.upper())
file_path = os.path.join(context_path, file_name)
file_paths.append(file_path)
Comment on lines 209 to 213
self.assertEqual(restored.resource_id, "test.md")
self.assertEqual(restored.name, "test")
self.assertEqual(restored.path, "TEST.MD")
self.assertEqual(restored.contents, "hello world\n")
self.assertEqual(restored.file_path, os.path.join("context", "TEST.MD"))
self.assertEqual(restored.path, "test.md")
self.assertEqual(restored.file_path, os.path.join("context", "test.md"))
self.assertEqual(restored.compute_hash(), doc.compute_hash())
Comment on lines +50 to +53
if self.path.upper() == PLATFORM_CONTEXT_FILE and self.path != PLATFORM_CONTEXT_FILE:
raise ValueError(
f"Document path must be {PLATFORM_CONTEXT_FILE} (case-sensitive) for the platform context file."
)
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.

2 participants