fix: replace URL hostname substring checks with parsed-netloc checks (#164)
* ci: fix deploy divergence and add rebuild-without-recrawl support Fix 1 (deploy-site.yml): - Add workflow_run trigger so deploy auto-fires after crawl-and-publish completes, eliminating the need for a manual trigger after each weekly run. - Update build job if-condition to allow workflow_run (success) events in addition to manual and human-push triggers. - Add 'Hydrate generated content from publish' step before hugo build. Code/theme/config come from main; all generated content (weekly pages, rollups, raw data) is overlaid from the canonical publish branch. The site can no longer diverge from publish. PR #162 was the manual rescue. Fix 2 (crawl-and-publish.yml): - Add rebuild_week workflow_dispatch input. When set, the workflow skips the crawl steps entirely (Run crawler, Crawl TechCrunch RSS, Commit crawl data) to avoid polluting a prior week's good data. - Add 'Hydrate from publish (rebuild mode)' step in the analyze job that restores raw + all prior analyzed files from publish when rebuild_week is set, giving downstream steps correct historical context for rollups. - Update 'Prepare analysis context' Python block to use rebuild_week as WEEK when provided, falling back to the current isocalendar week. Closes the architectural concerns identified during the W21/W22 debacle. Implements the directive captured in .squad/decisions/inbox/copilot-directive-rebuild-no-recrawl.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: replace URL substring checks with parsed-netloc checks in tests Fixes 2 CodeQL alerts (py/incomplete-url-substring-sanitization) in test_render_press_context.py: - Line ~100: replaced '"techcrunch.com" in result' with a check for the full article URL to avoid the hostname-substring anti-pattern. - Line ~500: replaced '"github.com" in result' with a urlparse-based assertion that extracts all markdown link URLs and validates each netloc equals 'github.com'. Added imports: urllib.parse.urlparse, re. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ci): make rebuild_week guard safe across all trigger types Guard pattern github.event.inputs.rebuild_week == '' breaks on schedule events because inputs doesn't exist. Switch to !inputs.rebuild_week which works across schedule, push, and workflow_dispatch. Also: - Add format validation for rebuild_week input (YYYY-WNN) to prevent pathspec injection - Add data/snapshots/ to deploy-site hydration step for full publish parity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>