Skip to content

Refuse to delete a teaching file while its principle remains - #20

Merged
tig merged 1 commit into
mainfrom
fix/keep-teaching-file
Oct 14, 2026
Merged

tig merged 1 commit into
mainfrom
fix/keep-teaching-file

Conversation

@tig

@tig tig commented Oct 14, 2026

Copy link
Copy Markdown
Member

kindelwww#296 pins principles at 961aa456. That revision requires a teaching file for every principle. Facet still accepted a save that deleted the file and cleared its catalog entry. The principles pull request then failed with data/teaching/<company>/<slug>.json: missing.

The guard now refuses that delete while the principle is still in the index. The editor no longer offers Delete teaching in that case. The same refusal covers a reading-only file (id, slug, and blog). Reading links on that file can still be added, removed, and reordered. A file whose principle is no longer in the index can still be removed, and that save still has to clear the catalog entry.

kindelwww#296 will repin facet and copy lib/ into api/editor-lib after this is on main.

Tests: node --test on the patch, allowlist, guard, reuse, lists, insert, essay link, and analytics suites (169 pass), plus node scripts/check-essay-links.js and node scripts/check-companies.js.

principles require_teaching_coverage fails a pull request that drops
the teaching file for a principle that is still in the index. Facet
now refuses that delete, including the catalog entry that would go
with it. A reading-only file stays valid, and its reading list can
still change.
@tig

tig commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

@codex review

@tig
tig requested a balanced review from Copilot October 14, 2026 20:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T21:04:19.196747Z 1cb3b2a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The server and editor checks match the retention requirement, with regression coverage for blocked deletions and permitted cleanup.

0 open findings

What changed in this PR

Protects required teaching files in Facet while preserving cleanup of files whose principles are no longer listed.

Changes:

  • Rejects deletion of teaching files for listed principles.
  • Hides the editor’s Delete teaching action for those files.
  • Adds regression coverage and documents the retention rule.
File Description
tests/​lists.test.mjs Covers blocked deletions, orphan cleanup, and reading-only files.
tests/​analytics.test.mjs Checks editor deletion controls and orphan cleanup.
tests/​allow.test.mjs Tests index-based deletion eligibility.
lib/​guard.js Enforces the deletion check during save review.
lib/​allow.js Adds the teaching deletion eligibility helper.
js/​facet.js Prevents deletion of required teaching files in the editor.
AGENTS.md Documents teaching-file retention and reading-list editing.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cb3b2ae5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/guard.js Resolved
@tig
tig marked this pull request as ready for review October 14, 2026 21:02
@tig tig self-assigned this Oct 14, 2026
@tig
tig merged commit beb1081 into main Oct 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants