Repository navigation
feat(loc): detect each project's source root from its URLs - #870
amol-anand wants to merge 3 commits into
Conversation
03bdb8a to
c0848fd
Compare
c0848fd to
8532b8b
Compare
8532b8b to
243ece8
Compare
243ece8 to
0c14cb8
Compare
0c14cb8 to
56cb919
Compare
56cb919 to
abc2817
Compare
abc2817 to
dda77d3
Compare
4bb98ae to
fe371f8
Compare
fe371f8 to
97a780a
Compare
Add an opt-in `source.language.detect` config row. When enabled, each loc project resolves its own source root from the URLs added at Validate, so flat structures can run multi-level rollouts and translations as separate projects. - Validate: pick the longest matching root across row locations, row sources and the configured source; error on URLs from more than one root and keep URLs matching no root on today's sync behavior - Options: replace `source.language` with the detected root, narrow rows to actions that start from it, and show a Source card - Reuse `findSourceLocation` for root matching, stacked on per-row source location support Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assert the detected root is persisted as sourceLocations, and that finalizeOptions uses persisted locations, derives them for legacy projects, and does not treat sibling prefixes as inside the source. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
97a780a to
ab4893b
Compare
| } | ||
|
|
||
| async getSourcePrefix() { | ||
| const detected = await this.detectSource(); |
There was a problem hiding this comment.
this is calculated here, but not persisted, then re-calculated in the options step (re-runs resolveSourceLang). Think we should persist it to avoid accidental drift or projects acting strange if the conifg changes mid-flight.
There was a problem hiding this comment.
Good call. Fixed in a8a752e: Validate now persists the detected source on the project as detectedSource (null when nothing is detected or the flag is off), and Options uses it via getProjectSource() instead of re-running resolveSourceLang. Only projects without detectedSource (already in flight) fall back to resolving from config.
| } | ||
| if (!detected) return; | ||
|
|
||
| options['source.language'] = sourceLang; |
There was a problem hiding this comment.
In detect mode, URLs matching no root now sync into the detected root (e.g. /eu/fragments/x), not the configured source. possible this is the intent, but if so, maybe update PR description/docs since it currently states "keep today's sync behavior."
There was a problem hiding this comment.
Intended. source.language becomes the detected root and rollout reads from it, so an unmatched /fragments/x has to sync into /eu/fragments/x to be rolled out with the rest of an /eu project; syncing it into the configured source would leave it outside the project. Updated the PR description to say this instead of "keep today's sync behavior"; the docs will get the same note.
| notChecked = this._urls.filter((url) => !url.status); | ||
| } | ||
|
|
||
| await this.updateSourceMessage(); |
There was a problem hiding this comment.
Auto-discovered fragments from another root (e.g. /eu page → /global/fragments/...) will trip this, and the error lists roots, not URLs, so authors must hunt for what to uncheck. Consider naming the offending URLs (or the minority-root ones) in the message, and/or a docs note.
There was a problem hiding this comment.
Fixed in a8a752e: the error still lists the roots, then names the URLs outside the root with the most URLs, e.g. To keep /eu, uncheck: /global/fragments/x. It lists up to 5 and adds "and N more" after that.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
loc-per-row-source-paths; merge fix(loc): resolve URLs under per-row source locations #793 first.source.language.detectconfig row. Without it, nothing changes.locations, rowsources and the configured source becomes the project's source./fragments/...) are ignored for detection. Becausesource.languagebecomes the detected root, sync copies them into that root (e.g./eu/fragments/...) rather than the configured source, so rollout from the detected root can find them.detectedSource(nullwhen nothing is detected or the flag is off). Options uses it instead of re-resolving, so a config change mid-flight can't change a project's source. Projects withoutdetectedSourcefall back to resolving from config.source.languagewith the detected root and narrow rows to actions that start from it (Translate/Copy when the row'ssourceis the root; Rollout when the row'slocationis the root or Translate/Copy is shown). Rows left with only Skip are hidden.findSourceLocationfrom fix(loc): resolve URLs under per-row source locations #793;/root.htmland/root.jsonstill match.source.languageand the fix(loc): resolve URLs under per-row source locations #793 source locations.localescells are handled by fix(loc): resolve URLs under per-row source locations #793'sformatLangschange; this PR keeps the regression tests.sourceLocationsanddetectedSource,getProjectSource, andfinalizeOptionssource-location handling.https://da.live/apps/loc?nx=locfeat#/dashboard/aemsites/fedexwithsource.language= Global English andsource.language.detect= true./global/...URLs give Global rollout only,/apac/...give APAC rollout only,/en-to/...give Tongan translate only, and mixing/global/...with/apac/...shows the error.Documentation
Edited in
adobe/aem-website, not yet published. Publish after #793 and this PR release.source.language.detectrow, including the one-folder-per-project rule.languagestab.