Skip to content

Various sync fixes from testing with a real (messy) package - #1223

Open
isc-tleavitt wants to merge 8 commits into
mainfrom
fix/sync-sourcesroot-dot-path-mismatch
Open

Various sync fixes from testing with a real (messy) package#1223
isc-tleavitt wants to merge 8 commits into
mainfrom
fix/sync-sourcesroot-dot-path-mismatch

Conversation

@isc-tleavitt

@isc-tleavitt isc-tleavitt commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #1222
Fixes #1224
Fixes unfiled issue where running sync -test on a package with multiple unit test resources would run the synced test once per resource. (Ignoring Package filter on unit test resources.)

A module with <SourcesRoot>.</SourcesRoot> keeps its sources at the module
root. Resource paths are composed as SourcesRoot_"/"_Directory, so they reach
the sync pipeline as "./cls/Foo.cls", while WalkAndHashDirs and the FileHash
baseline key the same file as "cls/Foo.cls". NormalizePath did not collapse "."
segments, so no changed path ever matched the reverse index: nothing was
dispatched to a processor, SyncCompile was skipped (loadItems = 0), and yet
step 9 still printed "Updated:" and committed the new hashes. Every edit in
such a module was silently dropped, reported as a success, and never retried.

Three changes:

- NormalizePath now drops "." path segments, so both spellings collapse to the
  same key. A bare "." (SourcesRoot with no Directory) normalizes to "".
- New CanonicalDocName upper-cases the extension of a document name, and both
  producers of document names route through it. The storedPaths fallback in
  SyncBuildReverseIndex looked up names from RelPathToDocName ("Foo.Bar.CLS")
  in an array keyed by ResolveChildren ("Foo.Bar.cls"), so it could never
  recover a path the primary index missed.
- A changed path that routes to no resource is now reported as a warning and
  removed from the change set before CommitChanges, so it is not reported as
  "Updated:" and is re-detected on the next sync instead of being lost.

Tests: unit coverage for the new normalization cases and CanonicalDocName, plus
a sync-dot-root integration fixture and TestSyncWithDotSourcesRoot, which
asserts the edit is live in the namespace rather than merely reported — a green
sync report was exactly the symptom. Verified that the new integration test
fails on the pre-fix source with "Edit is compiled and live on the server" and
passes with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

I've verified this fixes the issue for my target package. The fix is clean and well-tested.

@isc-tleavitt
isc-tleavitt marked this pull request as draft August 18, 2026 13:03
@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

Switching back to draft, going to fix #1224 and whatever else I find too.

@isc-tleavitt
isc-tleavitt marked this pull request as ready for review August 18, 2026 16:22
@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

I think this is good now and I'd like to get it merged to better have sync available for experimentation.

@isc-tleavitt isc-tleavitt changed the title Fix sync dropping all changes when SourcesRoot is "." Various sync fixes from testing with a real (messy) package Aug 18, 2026
@isc-tleavitt
isc-tleavitt marked this pull request as draft August 18, 2026 17:07
isc-tleavitt and others added 2 commits August 18, 2026 14:44
A plain `sync` commits the changed file's hash, so change detection would
never look at that file again and an edit to a unit test synced without
-test stayed untested indefinitely.

Flag those paths instead (FileHash.TestPending, mirroring SyncFailed):
sync collects the changed paths owned by a test-phase UnitTest resource,
marks them, and says so. ComputeChanges forces marked rows back into the
change set only when the sync runs tests, and CommitChanges clears the
flag once they have run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

Actually intentionally skipping the changelogs here since they're fixes to an unreleased feature.

@isc-dchui isc-dchui left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good bug catches! Looks good overall but I tend to find LLM comments/documentation to be excessively verbose and off in a particular backwards-looking describing-what-used-to-happen way as opposed to a describing what is currently implemented way, if that makes sense.

I usually just ask Claude to write comments with concision in mind and make it undergo a verbosity check pass.

Comment thread src/cls/IPM/General/Sync/Pipeline.cls Outdated
Comment thread src/cls/IPM/General/Sync/Pipeline.cls Outdated
Comment thread src/cls/IPM/Storage/FileHash.cls Outdated
Drop backwards-looking/negative-space narration, the intra-release issue
reference, and the pre-property backward-compatibility notes; state what
the code does and why instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

Did a verbosity pass over the comments this PR adds, cutting the "here's what would otherwise happen" framing in favor of describing current behavior. Trimmed:

  • Pipeline.cls: the ComputeChanges out-param note, the unrouted-paths note, the TestPending flag block, the deferred-test warning, and SyncRunTests step 2 / SyncCollectTestPaths docs
  • FileHash.cls: Pass 3/4/5 comments, NormalizePath's "." explanation, and the SyncFailed/TestPending property docs
  • Test.cls: the sibling-package compile note, the testspec grammar note, and OnSyncRunTests' doc

Comment-only — git diff -U0 | grep -v '^[+-]\s*//' is empty over src/. f05afa9

@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

Did a verbosity pass over the comments this PR adds, cutting the "here's what would otherwise happen" framing in favor of describing current behavior. Trimmed:

  • Pipeline.cls: the ComputeChanges out-param note, the unrouted-paths note, the TestPending flag block, the deferred-test warning, and SyncRunTests step 2 / SyncCollectTestPaths docs
  • FileHash.cls: Pass 3/4/5 comments, NormalizePath's "." explanation, and the SyncFailed/TestPending property docs
  • Test.cls: the sibling-package compile note, the testspec grammar note, and OnSyncRunTests' doc

Comment-only — git diff -U0 | grep -v '^[+-]\s*//' is empty over src/. f05afa9

This was Claude on auto mode... experimenting here, clearly.

@isc-tleavitt

Copy link
Copy Markdown
Contributor Author

Interesting - Claude wasn't using AGENTS.md which directs properly here. I'm tacking on a fix for that too.

isc-tleavitt and others added 2 commits August 20, 2026 07:59
Collect the comment/doc conventions raised in review (#1223) into a
Comments & Documentation section. Add a CLAUDE.md that imports AGENTS.md
so Claude Code picks the guidelines up automatically; AGENTS.md remains
the single source of truth.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Don't want to throw Claude off on changelogs.
@isc-tleavitt
isc-tleavitt marked this pull request as ready for review August 20, 2026 12:03
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.

Sync doesn't detect and reload on revert of failed code Sync command fails with module.xml <SourcesRoot>.</SourcesRoot>

2 participants