Guides

Referential integrity for saved answers

Use this checker on this device to find saved answers, history entries, tags, pins, courses, notes, and deadlines that point at a missing record, clean only the dangling references, and stop a new orphan before a save is accepted.

What counts as an orphan

An orphan is a record that points at a record that is no longer present. The checker below reads the device store only. It creates no workspace record and it changes no college record.

Record, required reference, and cleanup that keeps content
RecordRequired referenceOrphan testCleanup
Saved answerOne collection in the same store, with collection id present in the collections listCollection id is blank or not in the collections listMove the answer to the Unfiled collection. Do not delete the answer
History entryOne saved answer id in the same storeHistory answer id matches no saved answerRemove the history entry only. Keep the saved answer list unchanged
Tag entryOne saved answer id in the same storeTag key matches no saved answerRemove the tag entry only
Pin entryOne saved answer id in the same storePin key matches no saved answerRemove the pin entry only
Course entryOne saved answer id in the same storeCourse key matches no saved answerRemove the course entry only
Study note entryOne saved answer id in the same storeNote key matches no saved answerRemove the study note entry only
Deadline entryOne saved answer id in the same storeDeadline key matches no saved answerRemove the deadline entry only
Sourced answerSource title present means source link present and starting with http or httpsSource title present with a blank or invalid source linkFlag for review. Do not delete the answer and do not invent a link
Workspace question, answer, attachment, user and role records in the signed-in appThis workspace, one assistant, one owner office and approval by a different person where the guides state itA record points at another workspace, a missing assistant, a missing owner office, or an inactive memberReassign or supersede in the signed-in app. This page does not delete a workspace record

Run the check on this device

Nothing entered here is sent to a server. The check reads campus-answers:my-answers:v1 and campus-answers:my-library:v1 on this device only. It runs on load, on a storage change, and once each minute while this page is open. The last checked time is shown after each run.

No check has run on this page yet.

Last checked: not recorded.

    Cleanup removes history, tag, pin, course, note, and deadline entries that point at a missing answer, and moves an answer with a missing collection to Unfiled. It never deletes a saved answer.

    Block a new orphan before save

    The same validation runs before a save in My Answers and on this page. A save that would create an orphan is refused with the field that needs attention, and the entered text stays in the form.

    • Title is present and within the field limit stated on My Answers
    • Collection exists in the store, or the save creates the named collection once before the answer is saved
    • Source link, when present, starts with http or https
    • Workspace and assistant labels are kept as stored, and a blank label is shown as Not recorded instead of a guessed name
    • History, tags, pin, course, notes, and deadlines are written only for an answer id that was saved in the same write
    var result = window.CampusIntegrity.validateBeforeSave(item, store);
    if (result.ok === false) { showErrors(result.errors); keepFormText(); return; }
     saveAnswer(item); writeHistoryAndTags(item.id);

    For workspace records in the signed-in app, the equivalent block is the same rule in server code: every write filters by tenant_id from the session, checks that every referenced id exists in that tenant, and refuses the write with a field error when a reference is missing. No record is written with a dangling reference.

    Checks before you rely on a saved list

    • The integrity check shows zero orphans, or each remaining orphan is listed as flagged for review with no deletion
    • Counts on My Answers match the saved answer count after cleanup, with history, tags, pin, course, notes, and deadlines pointing only at saved answers
    • An answer moved to Unfiled still opens, still shows its sources, and still shows its workspace and assistant labels as stored
    • Import of my-answers.json runs the same check after import and reports orphans before the list is shown

    Keep saved lists free of orphans

    Run the check, clean dangling references, and confirm zero orphans before you export or share a list.