fix: harden location extraction and docs automation safety - #4
Merged
Conversation
Copilot
AI
changed the title
fix: prevent greedy location capture caused by case-insensitive regex flag
fix: prevent greedy location capture from case-insensitive regex flag
Jun 1, 2026
Copilot created this pull request from a session on behalf of
aj1126
June 1, 2026 09:43
View session
aj1126
marked this pull request as ready for review
June 1, 2026 09:45
There was a problem hiding this comment.
Pull request overview
This PR tightens location extraction to avoid case-insensitive regex behavior causing greedy captures, and introduces a small docs automation workflow (generated README sections + validation) to keep documentation aligned with the current Node CLI implementation.
Changes:
- Adjusted
extractLocationsregexes to prevent greedy capture of trailing lowercase words. - Added documentation generation + validation scripts, wired into
package.jsonand a GitHub Actions workflow. - Refreshed README + architecture/diagram docs and moved Python prototype guidance into
docs/legacy-prototype.md.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ingestion/file-ingestion.js | Updates location-extraction regex flags/keywords to prevent greedy captures. |
| scripts/validate-docs.js | Adds a docs consistency validator for scripts/docs/README cross-references. |
| scripts/generate-docs.js | Adds README section generator for commands/file-types/layout sections. |
| README.md | Refocuses README on current Node CLI and adds generated sections + docs workflow guidance. |
| package.json | Adds docs:generate and docs:check scripts. |
| docs/legacy-prototype.md | Introduces a dedicated legacy doc for the Python prototype. |
| docs/docs-source.json | Adds metadata source for generated README sections and required-doc links. |
| docs/diagrams/sequenceDiagram.mermaid | Updates sequence diagram labels to clarify current vs planned behavior. |
| docs/diagrams/architectureDiagram.mermaid | Updates architecture diagram to distinguish current components vs planned expansion. |
| docs/architecture.md | Rewrites architecture doc into “current vs planned” structure and references diagrams. |
| .github/workflows/docs.yml | Adds CI job to run docs validation on PRs and releases. |
| .github/pull_request_template.md | Adds a checklist prompting docs checks. |
| .github/prompts/update-readme.prompt.md | Updates prompt to cover the full “active documentation set” and generation workflow. |
Comment on lines
+37
to
+38
| const metadataPattern = /\b(?:location|city|site|Location|City|Site)\s*:\s*([A-Z][a-zA-Z]+(?:[ -][A-Z][a-zA-Z]+)*)/g; | ||
| const sentencePattern = /\b(?:in|at|near|In|At|Near)\s+([A-Z][a-zA-Z]+(?:[ -][A-Z][a-zA-Z]+)*)/g; |
Comment on lines
+19
to
+23
| const docsSource = loadJson('docs/docs-source.json'); | ||
| const packageJson = loadJson('package.json'); | ||
| const readme = readFile('README.md'); | ||
| const architecture = readFile('docs/architecture.md'); | ||
| const legacyPrototype = readFile('docs/legacy-prototype.md'); |
|
|
||
| ## Legacy Scope | ||
|
|
||
| The prototype in `/tmp/workspace/aj1126/UAP_AnalyticsBot/ingestion.py` provided: |
Comment on lines
+37
to
+38
| const metadataPattern = /\b(?:[Ll][Oo][Cc][Aa][Tt][Ii][Oo][Nn]|[Cc][Ii][Tt][Yy]|[Ss][Ii][Tt][Ee])\s*:\s*([A-Z][a-zA-Z]+(?:[ -][A-Z][a-zA-Z]+)*)/g; | ||
| const sentencePattern = /\b(?:[Ii][Nn]|[Aa][Tt]|[Nn][Ee][Aa][Rr])\s+([A-Z][a-zA-Z]+(?:[ -][A-Z][a-zA-Z]+)*)/g; |
Owner
@copilot what must be done to finish the checklist? |
Copilot
AI
changed the title
fix: prevent greedy location capture from case-insensitive regex flag
fix: harden location extraction and docs automation safety
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extractLocationsto use Unicode-aware capture rules with scoped case sensitivity.LOCATION/NEAR) to ensure location extraction behavior remains correct.GITHUB_TOKENpermissions (contents: read) to satisfy security checks.Checklist
npm run docs:generate.npm run docs:check.docs/legacy-prototype.md.