Files

140 lines
6.2 KiB
Markdown
Raw Permalink Normal View History

2026-08-24 12:22:24 -06:00
# Future Map Insights Hub Daily Automation Repair
## Task Control
- Date: `2026-08-23`
- Repository: `C:\projects\future-map\future-map-OPEN`
- Branch: `main`
- Status: Complete
- Windows task: `FutureMap-InsightsHub-Daily`
- Calendar alias: `publish future map json posts to git repo`
- Scope: Diagnose the scheduled-task failure, repair invalid public hrecords, harden reasoning-patch ingestion and unattended sync, add regression coverage, and verify the production task
- Publication boundary: No Git commit, push, release, or external publication was performed
## Objective
Determine why the daily Future Map Insights Hub preparation task returned Windows Task Scheduler result code `1`, repair the underlying data without removing valid core-document references, and add guardrails that prevent the same failure from recurring.
## Root Cause
The alias file mapped `publish future map json posts to git repo` to the Windows task `FutureMap-InsightsHub-Daily`. The task correctly launched:
```text
powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\projects\future-map\future-map-OPEN\data\insights-hub\scripts\run_daily.ps1
```
The task itself started and completed deterministic synchronization, but the pipeline intentionally returned exit code `1` after schema validation found 30 invalid records. Each contained the same core-document ID twice:
```json
"corpus_documents_consulted": [
"future-of-apparel",
"future-of-apparel"
]
```
The `future-of-apparel` reference was valid and needed to remain. The defect was the redundant second entry in a set-like array whose schema requires unique items.
The affected record IDs were:
```text
3168, 3681, 3791, 3864, 4047, 4048, 4077, 4090, 4102, 4113,
4166, 4179, 4251, 4317, 4318, 4442, 4631, 4829, 4946, 5019,
5024, 5025, 5026, 5343, 5359, 5556, 5690, 5704, 5707, 5757
```
The records were generated by `codex-gpt5-sol-medium` during August 20–21 and entered Git history in commit `8596c42`. The uniqueness requirement had already existed since August 12, indicating that the bulk enrichment path bypassed or failed to preserve the intended validated `apply-reasoning` boundary.
The August 22 log also reported malformed source JSON for record `7072`, but that source issue had been corrected before the August 23 run and was not part of the persistent 30-record failure.
## Work Completed
### 1. Repaired the 30 hrecords
Removed only the repeated second `future-of-apparel` entry from each affected record. Every record still references the `future-of-apparel` core document once. No analysis, implications, claims, classifications, related-document relationships, timestamps, or source-derived fields were changed.
### 2. Hardened reasoning-patch ingestion
Updated `data/insights-hub/scripts/future_map_pipeline.py` to deduplicate list items while preserving their original order before validating and writing `corpus_documents_consulted` from an `apply-reasoning` patch.
The normalization does not coerce invalid values into strings. Normal schema validation still runs after normalization, so invalid types and other malformed patch content remain blocking errors.
When duplicates are removed, the command emits a visible normalization message with the number of removed entries.
### 3. Added an unattended preflight gate
Updated `data/insights-hub/scripts/run_daily.ps1` so the daily task now runs full pipeline validation before starting deterministic synchronization.
If preflight validation fails:
- Sync does not start.
- Generated indexes and Markdown are not refreshed by the unattended run.
- The failure and exit code are written to the daily log.
- The PowerShell task throws and returns a nonzero result to Windows Task Scheduler.
If preflight validation passes, the normal sync and post-sync validation continue as before.
### 4. Added regression coverage
Updated `data/insights-hub/tests/test_pipeline.py` with a reasoning patch containing duplicate consulted-document IDs. The test confirms that:
- The patch is accepted after deterministic normalization.
- One duplicate is reported as removed.
- The stored public hrecord contains one `critical-states` reference.
- Completed reasoning remains preserved across an unchanged sync.
### 5. Recorded a durable repair receipt
Created the ignored local receipt:
```text
data/insights-hub/runtime/receipts/20260823-070839-deduplicate-consulted-documents.json
```
The receipt records the 30 affected signal IDs, changed workflow files, validation evidence, successful scheduled-task run, and publication boundary.
## Validation Results
Final production validation:
- Validated records: `996`
- Validated signal pages: `996`
- Validated connections: `2,954`
- Validated derivatives: `5`
- Validation errors: `0`
- Review warnings: `1` pre-existing warning unrelated to this repair
- Exact `Future Map` matches: `1,008`
- Quarantined by publication restriction: `12`
- Published public records: `996`
- Reasoning states: `981 complete`, `13 excluded`, `1 pending`, `1 stale`, `0 failed`
- Skipped unreadable records: `0`
Additional checks:
- Duplicate `future-of-apparel` scan: Passed; no duplicate arrays remain.
- Insights Hub unit tests: Passed, `5 of 5`.
- Skill validator: Passed.
- Repository audit using the `documentation-guide` profile: Passed with no findings.
- `git diff --check`: Passed.
- Hardened `run_daily.ps1`: Passed end to end with exit code `0`.
- Receipt JSON parse: Passed.
## Windows Task Scheduler Verification
Ran `FutureMap-InsightsHub-Daily` through Windows Task Scheduler after the repair.
- Last run: `2026-08-23 07:07:54 -06:00`
- Final state: `Ready`
- Last task result: `0`
- Next scheduled run: `2026-08-24 06:00:00 -06:00`
The automation calendar should report success after its next status refresh.
## Preserved Existing Work
Existing generated changes for signal `7072` and its related indexes and Markdown were preserved. They were not reverted, overwritten manually, or represented as part of the 30-record repair.
## Remaining Publication Caveat
Despite its calendar alias, `FutureMap-InsightsHub-Daily` performs deterministic local preparation only. It does not stage, commit, or push Git changes. This matches the contained Insights Hub operating rules, which treat Git publication as a separate authorized action.
No commit or push was performed during this task.