From 38d37b353e711c7bf1a5f6830823a101ae106540 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 19:00:00 +0000 Subject: [PATCH 1/7] Initial plan From 24ebd5a2183d85f5d751ff787dc6738cde9dadb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 19:02:40 +0000 Subject: [PATCH 2/7] Improve traject config discovery and logging - Add fallback search in arcflow package directory for development - Add clear logging showing which traject config is being used - Add warning when using arcflow package version (development mode) - Improve error messages when traject config not found - Document that traject config belongs in arcuit gem, not arcflow - Update README with traject config location guidance Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- README.md | 19 +++++++++++- arcflow/main.py | 77 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 73 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 3eac054..7910508 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,24 @@ This is a **one-time setup** per Solr instance. --- -To index creator documents to Solr: +### Traject Configuration for Creator Indexing + +The `traject_config_eac_cpf.rb` file defines how EAC-CPF creator records are mapped to Solr fields. + +**Production Location**: This file should live in your **arcuit gem** (UIUC's ArcLight customization), not in arcflow: +- arcflow is the data pipeline (orchestration between ArchivesSpace and ArcLight) +- arcuit defines how data appears in Solr (indexing configuration) + +**Discovery Order**: arcflow searches for the traject config in this order: +1. **arcuit gem** (via `bundle show arcuit`) - RECOMMENDED for production + - Checks: `{gem_root}/traject_config_eac_cpf.rb` + - Checks: `{gem_root}/arcflow/traject_config_eac_cpf.rb` +2. **arcuit_dir** if provided via `--arcuit-dir` flag +3. **arcflow package** (fallback for development/testing only) + +**Logging**: arcflow will clearly log which traject config file is being used when creator indexing runs. + +To index creator documents to Solr manually: ```bash bundle exec traject \ diff --git a/arcflow/main.py b/arcflow/main.py index 18875ed..446dc43 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -965,14 +965,15 @@ def process_creators(self): self.log.info(f'{indent}Indexing {len(creator_ids)} creator records to Solr...') traject_config = self.find_traject_config() if traject_config: + self.log.info(f'{indent}Using traject config: {traject_config}') indexed = self.index_creators(agents_dir, creator_ids) self.log.info(f'{indent}Creator indexing complete: {indexed}/{len(creator_ids)} indexed') else: - self.log.info(f'{indent}Skipping creator indexing (traject config not found)') + self.log.error(f'{indent}Skipping creator indexing (traject config not found)') self.log.info(f'{indent}To index manually:') self.log.info(f'{indent} cd {self.arclight_dir}') self.log.info(f'{indent} bundle exec traject -u {self.solr_url} -i xml \\') - self.log.info(f'{indent} -c /path/to/arcuit/arcflow/traject_config_eac_cpf.rb \\') + self.log.info(f'{indent} -c /path/to/arcuit/traject_config_eac_cpf.rb \\') self.log.info(f'{indent} {agents_dir}/*.xml') elif self.skip_creator_indexing: self.log.info(f'{indent}Skipping creator indexing (--skip-creator-indexing flag set)') @@ -984,15 +985,20 @@ def find_traject_config(self): """ Find the traject config for creator indexing. - Tries: - 1. bundle show arcuit (finds installed gem) - 2. self.arcuit_dir (explicit path) - 3. Returns None if neither works + Search order: + 1. arcuit gem (via bundle show) - RECOMMENDED for production + 2. arcuit_dir if provided (for development) + 3. arcflow package directory (fallback for development/testing) + + The traject config should live in the arcuit gem (UIUC's ArcLight customization) + since it defines Solr indexing behavior, not in arcflow (the data pipeline). Returns: str: Path to traject config, or None if not found """ - # Try bundle show arcuit first + self.log.info('Searching for traject_config_eac_cpf.rb...') + + # Try 1: bundle show arcuit (RECOMMENDED - production location) try: result = subprocess.run( ['bundle', 'show', 'arcuit'], @@ -1003,39 +1009,66 @@ def find_traject_config(self): ) if result.returncode == 0: arcuit_path = result.stdout.strip() - # Prefer config at gem root, fall back to legacy subdirectory layout + self.log.debug(f' Found arcuit gem at: {arcuit_path}') candidate_paths = [ os.path.join(arcuit_path, 'traject_config_eac_cpf.rb'), os.path.join(arcuit_path, 'arcflow', 'traject_config_eac_cpf.rb'), ] for traject_config in candidate_paths: if os.path.exists(traject_config): - self.log.info(f'Found traject config via bundle show: {traject_config}') + self.log.info(f'✓ Using traject config from arcuit gem: {traject_config}') return traject_config - self.log.warning( - 'bundle show arcuit succeeded but traject_config_eac_cpf.rb ' - 'was not found in any expected location under the gem root' + self.log.debug( + ' traject_config_eac_cpf.rb not found in arcuit gem ' + '(checked root and arcflow/ subdirectory)' ) else: - self.log.debug('bundle show arcuit failed (gem not installed?)') + self.log.debug(' arcuit gem not found via bundle show') except Exception as e: - self.log.debug(f'Error running bundle show arcuit: {e}') - # Fall back to arcuit_dir if provided + self.log.debug(f' Error checking for arcuit gem: {e}') + + # Try 2: arcuit_dir if provided (for development) if self.arcuit_dir: + self.log.debug(f' Checking arcuit_dir: {self.arcuit_dir}') candidate_paths = [ os.path.join(self.arcuit_dir, 'traject_config_eac_cpf.rb'), os.path.join(self.arcuit_dir, 'arcflow', 'traject_config_eac_cpf.rb'), ] for traject_config in candidate_paths: if os.path.exists(traject_config): - self.log.info(f'Using traject config from arcuit_dir: {traject_config}') + self.log.info(f'✓ Using traject config from arcuit_dir: {traject_config}') return traject_config - self.log.warning( - 'arcuit_dir provided but traject_config_eac_cpf.rb was not found ' - 'in any expected location' - ) - # No config found - self.log.warning('Could not find traject config (bundle show arcuit failed and arcuit_dir not provided or invalid)') + self.log.debug(' traject_config_eac_cpf.rb not found in arcuit_dir') + + # Try 3: arcflow package directory (fallback for development/testing) + # This is where the file currently lives during development + arcflow_package_dir = os.path.dirname(os.path.abspath(__file__)) + arcflow_repo_root = os.path.dirname(arcflow_package_dir) + candidate_paths = [ + os.path.join(arcflow_repo_root, 'traject_config_eac_cpf.rb'), + os.path.join(arcflow_package_dir, 'traject_config_eac_cpf.rb'), + ] + for traject_config in candidate_paths: + if os.path.exists(traject_config): + self.log.warning( + f'⚠ Using traject config from arcflow package (development mode): {traject_config}' + ) + self.log.warning( + ' For production, traject_config_eac_cpf.rb should be in the arcuit gem, ' + 'not in arcflow.' + ) + self.log.warning( + ' arcflow is the data pipeline; arcuit defines Solr indexing behavior.' + ) + return traject_config + + # No config found anywhere + self.log.error('✗ Could not find traject_config_eac_cpf.rb in any expected location:') + self.log.error(' 1. arcuit gem (via bundle show arcuit)') + self.log.error(' 2. arcuit_dir (if provided via --arcuit-dir)') + self.log.error(' 3. arcflow package directory (fallback)') + self.log.error('') + self.log.error(' The traject config should be added to your arcuit gem for production use.') return None From 91ad109c70bec2df16384593092f532c9fbd3a49 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 19:04:40 +0000 Subject: [PATCH 3/7] Address code review feedback - Change log level from error to warning for missing traject config - Update example path to clarify arcuit gem location - Show actual searched paths in error message for better troubleshooting Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- arcflow/main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/arcflow/main.py b/arcflow/main.py index 446dc43..99338d4 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -969,11 +969,11 @@ def process_creators(self): indexed = self.index_creators(agents_dir, creator_ids) self.log.info(f'{indent}Creator indexing complete: {indexed}/{len(creator_ids)} indexed') else: - self.log.error(f'{indent}Skipping creator indexing (traject config not found)') + self.log.warning(f'{indent}Skipping creator indexing (traject config not found)') self.log.info(f'{indent}To index manually:') self.log.info(f'{indent} cd {self.arclight_dir}') self.log.info(f'{indent} bundle exec traject -u {self.solr_url} -i xml \\') - self.log.info(f'{indent} -c /path/to/arcuit/traject_config_eac_cpf.rb \\') + self.log.info(f'{indent} -c /path/to/arcuit-gem/traject_config_eac_cpf.rb \\') self.log.info(f'{indent} {agents_dir}/*.xml') elif self.skip_creator_indexing: self.log.info(f'{indent}Skipping creator indexing (--skip-creator-indexing flag set)') @@ -997,6 +997,7 @@ def find_traject_config(self): str: Path to traject config, or None if not found """ self.log.info('Searching for traject_config_eac_cpf.rb...') + searched_paths = [] # Try 1: bundle show arcuit (RECOMMENDED - production location) try: @@ -1014,6 +1015,7 @@ def find_traject_config(self): os.path.join(arcuit_path, 'traject_config_eac_cpf.rb'), os.path.join(arcuit_path, 'arcflow', 'traject_config_eac_cpf.rb'), ] + searched_paths.extend(candidate_paths) for traject_config in candidate_paths: if os.path.exists(traject_config): self.log.info(f'✓ Using traject config from arcuit gem: {traject_config}') @@ -1034,6 +1036,7 @@ def find_traject_config(self): os.path.join(self.arcuit_dir, 'traject_config_eac_cpf.rb'), os.path.join(self.arcuit_dir, 'arcflow', 'traject_config_eac_cpf.rb'), ] + searched_paths.extend(candidate_paths) for traject_config in candidate_paths: if os.path.exists(traject_config): self.log.info(f'✓ Using traject config from arcuit_dir: {traject_config}') @@ -1048,6 +1051,7 @@ def find_traject_config(self): os.path.join(arcflow_repo_root, 'traject_config_eac_cpf.rb'), os.path.join(arcflow_package_dir, 'traject_config_eac_cpf.rb'), ] + searched_paths.extend(candidate_paths) for traject_config in candidate_paths: if os.path.exists(traject_config): self.log.warning( @@ -1062,13 +1066,13 @@ def find_traject_config(self): ) return traject_config - # No config found anywhere - self.log.error('✗ Could not find traject_config_eac_cpf.rb in any expected location:') - self.log.error(' 1. arcuit gem (via bundle show arcuit)') - self.log.error(' 2. arcuit_dir (if provided via --arcuit-dir)') - self.log.error(' 3. arcflow package directory (fallback)') + # No config found anywhere - show all paths searched + self.log.error('✗ Could not find traject_config_eac_cpf.rb in any of these locations:') + for i, path in enumerate(searched_paths, 1): + self.log.error(f' {i}. {path}') self.log.error('') self.log.error(' The traject config should be added to your arcuit gem for production use.') + self.log.error(' You can specify a custom location with --arcuit-dir flag.') return None From 2ac19dba5587f51a1657ffbf3315a79dd6ef3d5a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 15:56:36 +0000 Subject: [PATCH 4/7] Reorder traject config search to follow collection records pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change search order: arcuit_dir (1st) → bundle show (2nd) → example file (3rd) - Rename traject_config_eac_cpf.rb to example_traject_config_eac_cpf.rb - Prioritize arcuit_dir parameter as most up-to-date user control - Fall back to example file for module usage without arcuit - Update README with new search order and example file guidance Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- README.md | 22 +++---- arcflow/main.py | 64 ++++++++----------- ...pf.rb => example_traject_config_eac_cpf.rb | 0 3 files changed, 38 insertions(+), 48 deletions(-) rename traject_config_eac_cpf.rb => example_traject_config_eac_cpf.rb (100%) diff --git a/README.md b/README.md index 7910508..710ddc4 100644 --- a/README.md +++ b/README.md @@ -141,18 +141,16 @@ This is a **one-time setup** per Solr instance. The `traject_config_eac_cpf.rb` file defines how EAC-CPF creator records are mapped to Solr fields. -**Production Location**: This file should live in your **arcuit gem** (UIUC's ArcLight customization), not in arcflow: -- arcflow is the data pipeline (orchestration between ArchivesSpace and ArcLight) -- arcuit defines how data appears in Solr (indexing configuration) - -**Discovery Order**: arcflow searches for the traject config in this order: -1. **arcuit gem** (via `bundle show arcuit`) - RECOMMENDED for production - - Checks: `{gem_root}/traject_config_eac_cpf.rb` - - Checks: `{gem_root}/arcflow/traject_config_eac_cpf.rb` -2. **arcuit_dir** if provided via `--arcuit-dir` flag -3. **arcflow package** (fallback for development/testing only) - -**Logging**: arcflow will clearly log which traject config file is being used when creator indexing runs. +**Search Order**: arcflow searches for the traject config following the collection records pattern: +1. **arcuit_dir parameter** (if provided via `--arcuit-dir`) - Highest priority, most up-to-date user control +2. **arcuit gem** (via `bundle show arcuit`) - For backward compatibility when arcuit_dir not provided +3. **example_traject_config_eac_cpf.rb** in arcflow - Fallback for module usage without arcuit + +**Example File**: arcflow includes `example_traject_config_eac_cpf.rb` as a reference implementation. For production: +- Copy this file to your arcuit gem as `traject_config_eac_cpf.rb`, or +- Specify the location with `--arcuit-dir /path/to/arcuit` + +**Logging**: arcflow clearly logs which traject config file is being used when creator indexing runs. To index creator documents to Solr manually: diff --git a/arcflow/main.py b/arcflow/main.py index 99338d4..acaacfb 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -985,13 +985,10 @@ def find_traject_config(self): """ Find the traject config for creator indexing. - Search order: - 1. arcuit gem (via bundle show) - RECOMMENDED for production - 2. arcuit_dir if provided (for development) - 3. arcflow package directory (fallback for development/testing) - - The traject config should live in the arcuit gem (UIUC's ArcLight customization) - since it defines Solr indexing behavior, not in arcflow (the data pipeline). + Search order (follows collection records pattern): + 1. arcuit_dir if provided (most up-to-date user control) + 2. arcuit gem via bundle show (for backward compatibility) + 3. example_traject_config_eac_cpf.rb in arcflow (fallback when used as module without arcuit) Returns: str: Path to traject config, or None if not found @@ -999,7 +996,21 @@ def find_traject_config(self): self.log.info('Searching for traject_config_eac_cpf.rb...') searched_paths = [] - # Try 1: bundle show arcuit (RECOMMENDED - production location) + # Try 1: arcuit_dir if provided (highest priority - user's explicit choice) + if self.arcuit_dir: + self.log.debug(f' Checking arcuit_dir parameter: {self.arcuit_dir}') + candidate_paths = [ + os.path.join(self.arcuit_dir, 'traject_config_eac_cpf.rb'), + os.path.join(self.arcuit_dir, 'arcflow', 'traject_config_eac_cpf.rb'), + ] + searched_paths.extend(candidate_paths) + for traject_config in candidate_paths: + if os.path.exists(traject_config): + self.log.info(f'✓ Using traject config from arcuit_dir: {traject_config}') + return traject_config + self.log.debug(' traject_config_eac_cpf.rb not found in arcuit_dir') + + # Try 2: bundle show arcuit (for backward compatibility when arcuit_dir not provided) try: result = subprocess.run( ['bundle', 'show', 'arcuit'], @@ -1029,40 +1040,22 @@ def find_traject_config(self): except Exception as e: self.log.debug(f' Error checking for arcuit gem: {e}') - # Try 2: arcuit_dir if provided (for development) - if self.arcuit_dir: - self.log.debug(f' Checking arcuit_dir: {self.arcuit_dir}') - candidate_paths = [ - os.path.join(self.arcuit_dir, 'traject_config_eac_cpf.rb'), - os.path.join(self.arcuit_dir, 'arcflow', 'traject_config_eac_cpf.rb'), - ] - searched_paths.extend(candidate_paths) - for traject_config in candidate_paths: - if os.path.exists(traject_config): - self.log.info(f'✓ Using traject config from arcuit_dir: {traject_config}') - return traject_config - self.log.debug(' traject_config_eac_cpf.rb not found in arcuit_dir') - - # Try 3: arcflow package directory (fallback for development/testing) - # This is where the file currently lives during development + # Try 3: example file in arcflow package (fallback for module usage without arcuit) arcflow_package_dir = os.path.dirname(os.path.abspath(__file__)) arcflow_repo_root = os.path.dirname(arcflow_package_dir) candidate_paths = [ - os.path.join(arcflow_repo_root, 'traject_config_eac_cpf.rb'), - os.path.join(arcflow_package_dir, 'traject_config_eac_cpf.rb'), + os.path.join(arcflow_repo_root, 'example_traject_config_eac_cpf.rb'), + os.path.join(arcflow_package_dir, 'example_traject_config_eac_cpf.rb'), ] searched_paths.extend(candidate_paths) for traject_config in candidate_paths: if os.path.exists(traject_config): - self.log.warning( - f'⚠ Using traject config from arcflow package (development mode): {traject_config}' - ) - self.log.warning( - ' For production, traject_config_eac_cpf.rb should be in the arcuit gem, ' - 'not in arcflow.' + self.log.info( + f'✓ Using example traject config from arcflow: {traject_config}' ) - self.log.warning( - ' arcflow is the data pipeline; arcuit defines Solr indexing behavior.' + self.log.info( + ' Note: Using example config. For production, copy this file to your arcuit gem ' + 'or specify location with --arcuit-dir.' ) return traject_config @@ -1071,8 +1064,7 @@ def find_traject_config(self): for i, path in enumerate(searched_paths, 1): self.log.error(f' {i}. {path}') self.log.error('') - self.log.error(' The traject config should be added to your arcuit gem for production use.') - self.log.error(' You can specify a custom location with --arcuit-dir flag.') + self.log.error(' Add traject_config_eac_cpf.rb to your arcuit gem or specify with --arcuit-dir.') return None diff --git a/traject_config_eac_cpf.rb b/example_traject_config_eac_cpf.rb similarity index 100% rename from traject_config_eac_cpf.rb rename to example_traject_config_eac_cpf.rb From 36c4a7976c5b873085a1b8979f6b132b16dc46bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 15:57:25 +0000 Subject: [PATCH 5/7] Address code review feedback on example file - Update usage comment to reference correct filename - Improve log message formatting for consistency - Add note about copying to arcuit for production use Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- arcflow/main.py | 8 +++----- example_traject_config_eac_cpf.rb | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arcflow/main.py b/arcflow/main.py index acaacfb..0ddcd89 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -1050,12 +1050,10 @@ def find_traject_config(self): searched_paths.extend(candidate_paths) for traject_config in candidate_paths: if os.path.exists(traject_config): + self.log.info(f'✓ Using example traject config from arcflow: {traject_config}') self.log.info( - f'✓ Using example traject config from arcflow: {traject_config}' - ) - self.log.info( - ' Note: Using example config. For production, copy this file to your arcuit gem ' - 'or specify location with --arcuit-dir.' + ' Note: Using example config. For production, copy this file to your ' + 'arcuit gem or specify location with --arcuit-dir.' ) return traject_config diff --git a/example_traject_config_eac_cpf.rb b/example_traject_config_eac_cpf.rb index deb9ac5..1fe97d0 100644 --- a/example_traject_config_eac_cpf.rb +++ b/example_traject_config_eac_cpf.rb @@ -4,7 +4,9 @@ # Persons, and Families) XML documents from ArchivesSpace archival_contexts endpoint. # # Usage: -# bundle exec traject -u $SOLR_URL -c traject_config_eac_cpf.rb /path/to/agents/*.xml +# bundle exec traject -u $SOLR_URL -c example_traject_config_eac_cpf.rb /path/to/agents/*.xml +# +# For production, copy this file to your arcuit gem as traject_config_eac_cpf.rb # # The EAC-CPF XML documents are retrieved directly from ArchivesSpace via: # /repositories/{repo_id}/archival_contexts/{agent_type}/{id}.xml From addee2bd8193660772142949fa0427b864b1a9eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:06:54 +0000 Subject: [PATCH 6/7] Update traject config search paths to follow ArcLight pattern - Remove arcuit_dir/arcflow path (development artifact) - Add arcuit_dir/lib/arcuit/traject path (matches EAD traject location) - Apply same paths to both arcuit_dir and bundle show arcuit searches - Update debug message to reflect new subdirectory checked Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- arcflow/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arcflow/main.py b/arcflow/main.py index 0ddcd89..2c36055 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -1001,7 +1001,7 @@ def find_traject_config(self): self.log.debug(f' Checking arcuit_dir parameter: {self.arcuit_dir}') candidate_paths = [ os.path.join(self.arcuit_dir, 'traject_config_eac_cpf.rb'), - os.path.join(self.arcuit_dir, 'arcflow', 'traject_config_eac_cpf.rb'), + os.path.join(self.arcuit_dir, 'lib', 'arcuit', 'traject', 'traject_config_eac_cpf.rb'), ] searched_paths.extend(candidate_paths) for traject_config in candidate_paths: @@ -1024,7 +1024,7 @@ def find_traject_config(self): self.log.debug(f' Found arcuit gem at: {arcuit_path}') candidate_paths = [ os.path.join(arcuit_path, 'traject_config_eac_cpf.rb'), - os.path.join(arcuit_path, 'arcflow', 'traject_config_eac_cpf.rb'), + os.path.join(arcuit_path, 'lib', 'arcuit', 'traject', 'traject_config_eac_cpf.rb'), ] searched_paths.extend(candidate_paths) for traject_config in candidate_paths: @@ -1033,7 +1033,7 @@ def find_traject_config(self): return traject_config self.log.debug( ' traject_config_eac_cpf.rb not found in arcuit gem ' - '(checked root and arcflow/ subdirectory)' + '(checked root and lib/arcuit/traject/ subdirectory)' ) else: self.log.debug(' arcuit gem not found via bundle show') From 43fc88cc6647af038f8310de648cef88abfdbecd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:13:26 +0000 Subject: [PATCH 7/7] Simplify example traject config search to single known location - Remove candidate paths loop for example file - Directly check the one known location at repo root - Add comment explaining we know the exact location Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com> --- arcflow/main.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/arcflow/main.py b/arcflow/main.py index 2c36055..50f7583 100644 --- a/arcflow/main.py +++ b/arcflow/main.py @@ -1041,21 +1041,19 @@ def find_traject_config(self): self.log.debug(f' Error checking for arcuit gem: {e}') # Try 3: example file in arcflow package (fallback for module usage without arcuit) + # We know exactly where this file is located - at the repo root arcflow_package_dir = os.path.dirname(os.path.abspath(__file__)) arcflow_repo_root = os.path.dirname(arcflow_package_dir) - candidate_paths = [ - os.path.join(arcflow_repo_root, 'example_traject_config_eac_cpf.rb'), - os.path.join(arcflow_package_dir, 'example_traject_config_eac_cpf.rb'), - ] - searched_paths.extend(candidate_paths) - for traject_config in candidate_paths: - if os.path.exists(traject_config): - self.log.info(f'✓ Using example traject config from arcflow: {traject_config}') - self.log.info( - ' Note: Using example config. For production, copy this file to your ' - 'arcuit gem or specify location with --arcuit-dir.' - ) - return traject_config + traject_config = os.path.join(arcflow_repo_root, 'example_traject_config_eac_cpf.rb') + searched_paths.append(traject_config) + + if os.path.exists(traject_config): + self.log.info(f'✓ Using example traject config from arcflow: {traject_config}') + self.log.info( + ' Note: Using example config. For production, copy this file to your ' + 'arcuit gem or specify location with --arcuit-dir.' + ) + return traject_config # No config found anywhere - show all paths searched self.log.error('✗ Could not find traject_config_eac_cpf.rb in any of these locations:')