Store detected vault changes, then index any intents the manifest is missing.
(
&self,
changes: &[VaultFileChange],
)
| 731 | /// Store detected vault changes, then index any intents the manifest |
| 732 | /// is missing. |
| 733 | fn vault_apply_changes( |
| 734 | &self, |
| 735 | changes: &[VaultFileChange], |
| 736 | ) -> Result<Vec<String>, RepositoryError> { |
| 737 | let mut updated_paths = Vec::new(); |
| 738 | |
| 739 | for change in changes { |
| 740 | match change.change_type { |
| 741 | VaultChangeType::New | VaultChangeType::Modified => { |
| 742 | // Infer entry type from path |
| 743 | let entry_type = infer_entry_type(&change.path); |
| 744 | |
| 745 | // T5b record-time grant-lapse (gap #2): a raw on-disk |
| 746 | // substance edit to a `done` Draft intent reaches the vault |
| 747 | // through THIS path (not `vault_intent_update`), so apply the |
| 748 | // same demote-only lapse here. `record_time_lapse_frontmatter` |
| 749 | // is Intent-only, demote-only, and returns the demoted |
| 750 | // frontmatter iff a lapse applied; otherwise the incoming |
| 751 | // frontmatter is stored unchanged. Single store, no recursion. |
| 752 | let lapsed_fm = self.record_time_lapse_frontmatter(change, entry_type); |
| 753 | let frontmatter_json = lapsed_fm |
| 754 | .clone() |
| 755 | .unwrap_or_else(|| change.frontmatter_json.clone()); |
| 756 | |
| 757 | self.vault_store( |
| 758 | &change.path, |
| 759 | entry_type, |
| 760 | change.content.clone(), |
| 761 | frontmatter_json.clone(), |
| 762 | )?; |
| 763 | |
| 764 | // `vault_store` maintains only counts/merkle for Intent |
| 765 | // entries — it does not sync the IntentSummary status/pin, |
| 766 | // and the manifest summary is what `intent list` and triage |
| 767 | // read. |
| 768 | // |
| 769 | // This used to run only when a lapse rewrote the |
| 770 | // frontmatter, so an ordinary edit to an intent's `status:` |
| 771 | // landed in the entry and nowhere else: `intent show` |
| 772 | // reported the new status while `intent list` and every |
| 773 | // gate kept the stale one, forever. Mirror the effective |
| 774 | // frontmatter on every intent store — the lapse case is |
| 775 | // just the variant where `lapsed_fm` replaced it. |
| 776 | if entry_type == VaultEntryType::Intent { |
| 777 | self.sync_intent_summary_from_frontmatter(&change.path, &frontmatter_json)?; |
| 778 | } |
| 779 | |
| 780 | updated_paths.push(change.path.clone()); |
| 781 | } |
| 782 | VaultChangeType::Deleted => { |
| 783 | self.vault_delete(&change.path)?; |
| 784 | updated_paths.push(change.path.clone()); |
| 785 | } |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | // Index any intent entries the manifest is missing — even when no |
| 790 | // file changed. Entries can predate this call (clone bootstrap |
no test coverage detected