Skip to content

feat(import-detail): lock regenerate and hand off to the wiki app editor - #19

Merged
Rl0007 merged 13 commits into
bwhtech:mainfrom
vishwajeet-13:feat/publish-locks-regenerate
Oct 5, 2026
Merged

Rl0007 merged 13 commits into
bwhtech:mainfrom
vishwajeet-13:feat/publish-locks-regenerate

Conversation

@vishwajeet-13

Copy link
Copy Markdown
Collaborator

What's done

  • generate_wiki now rejects a regenerate once a Wikify Import has reached Completed — a published wiki's pages should only be edited from the Wiki app's own editor from that point on.
  • WikiPublish shows a "Published" badge instead of the Regenerate button once that happens.
  • SectionTree opens a page's real Wiki app editor (/wiki-app/spaces/:space/page/:doc) in a new tab when you click it post-publish, instead of Wikify's own (now potentially stale) preview, with a banner explaining the handoff.

Depends on #18 (branched from its head) — tab cleanup lands first.

Screenshot

Published state

Demo

page@8e7525da0698a0f2348a18c5a21fc123.webm

vishwajeet-13 and others added 8 commits September 22, 2026 02:33
Splits into two PRs: hiding Explore/generate-only Wiki tabs and folding
publish into a renamed Tree->Wiki tab, then locking Regenerate after
first publish and linking each page to its real editor in the Wiki app
instead of round-tripping edits through Wikify.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Explore and the standalone generate-only Wiki tab are hidden (their
components stay on disk, unreferenced). Tree is renamed to Wiki and
now also carries the publish action, via a new compact WikiPublish
control extracted from the old WikiGenerate.vue.
Remove the docs/superpowers spec + plan markdown files added while
drafting this change - not meant to ship in the PR. Also reformats
the Route FormControl in WikiPublish.vue to satisfy prettier (CI was
failing the Frappe Linter job on line length).
Per review feedback - shrink the multi-line note explaining the
tab list down to a single line.
- Legacy /import/:name/wiki links resolve to the consolidated "tree"
  (Wiki) panel instead of falling back to PDF.
- WikiPublish's Publish/Regenerate button is always subtle, so
  "Approve & Build Graph" stays the toolbar's one solid action.
generate_wiki no longer accepts calls once a Wikify Import has
reached Completed - a fully-published wiki's Wiki Documents should
only be edited from the Wiki app's own editor from that point on,
never silently overwritten by a re-run from Wikify.
- WikiPublish shows a "Published" badge instead of Regenerate once an
  import reaches Completed, matching the API now rejecting that call.
- SectionTree opens a page's real Wiki app editor
  (/wiki-app/spaces/:space/page/:doc) in a new tab on click once
  published, instead of Wikify's own (now potentially stale) preview,
  with a banner explaining the handoff.
@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

The PR is not yet safe to merge because two previously reported workflow and installation defects remain outstanding.

Fix All in Claude CodeFindings

  1. P1 Published lock can be bypassed ▶
  2. P1 Invalid setters skip repair ▶
Fix with agent prompt
### Issue 1
wikify/api/imports.py:119-121
The new lock rejects generation only while the import is currently `Completed`. However, the completed Wiki screen still exposes **Approve & Build Graph**, and `build_graph` unconditionally changes the import back to `Graphed`. The same import can then pass this API's `Graphed` check and be regenerated, defeating the intended one-way handoff. Completed imports also retain active rename, reorder, exclusion, and deletion controls, so their source tree can diverge from the published wiki. The completed-state restriction needs to cover graph building and tree mutations as well as `generate_wiki`.

### Issue 2
wikify/install.py:33-35
If an existing Property Setter still defines `title` as a narrow type such as `Data`, this existence check treats it as valid and skips `make_property_setter`. The Wiki title field therefore remains subject to the old length constraint even though this setup is intended to repair title storage during installation and migration. Check the setter's configured value against `WIDE_TEXT_FIELDTYPES` and replace it when necessary.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR makes wiki publication a one-way handoff to the Wiki app and consolidates publication controls into the section-tree workspace.

  • Rejects wiki regeneration, graph rebuilding, and several tree mutations after an import reaches Completed.
  • Replaces completed-state editing controls with links to the published Wiki pages.
  • Refreshes section data after publication so generated document links become available without a page reload.
  • Attempts to repair Wiki title customization setup during installation.

Reviews (4) · Last reviewed commit: "fix(import-detail): hide tree edit contr..."

Comment thread wikify/api/imports.py Outdated
Comment on lines +119 to +121
if imp.status == "Completed":
frappe.throw(_("This wiki has already been published — edit pages directly in the Wiki app."))
if imp.status not in ("Graphed", "Stopped"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Published lock can be bypassed

The new lock rejects generation only while the import is currently Completed. However, the completed Wiki screen still exposes Approve & Build Graph, and build_graph unconditionally changes the import back to Graphed. The same import can then pass this API's Graphed check and be regenerated, defeating the intended one-way handoff. Completed imports also retain active rename, reorder, exclusion, and deletion controls, so their source tree can diverge from the published wiki. The completed-state restriction needs to cover graph building and tree mutations as well as generate_wiki.

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: wikify/api/imports.py
Line: 119-121

Comment:
**Published lock can be bypassed**

The new lock rejects generation only while the import is currently `Completed`. However, the completed Wiki screen still exposes **Approve & Build Graph**, and `build_graph` unconditionally changes the import back to `Graphed`. The same import can then pass this API's `Graphed` check and be regenerated, defeating the intended one-way handoff. Completed imports also retain active rename, reorder, exclusion, and deletion controls, so their source tree can diverge from the published wiki. The completed-state restriction needs to cover graph building and tree mutations as well as `generate_wiki`.

**Knowledge Base Used:**
- [Wiki review and generation UI](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/wikify/-/docs/wiki-review-and-generation-ui.md)
- [Backend API and realtime services](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/wikify/-/docs/backend-api-and-realtime-services.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment thread frontend/src/pages/ImportDetail.vue Resolved
- build_graph and the tree mutation endpoints (reorder/rename/toggle
  include/delete) now reject once the owning import is Completed, so
  Approve & Build Graph can no longer flip a published import back to
  Graphed and reopen the regenerate path, and the source tree can no
  longer drift from what's already published.
- ImportDetail reloads the section tree (not just the import doc) on
  publish completion, so wiki_document is populated before the tree
  switches into its published, click-to-editor mode.
add_wiki_title_customizations() decided whether to (re)create the
title-widening Property Setter by reading frappe.get_meta(), a
process-level cache that isn't transaction-aware. In CI's full test
run this let an earlier test's rolled-back Property Setter still
read as present via the stale cache, so a later test's call skipped
recreating it - leaving 0 rows where 1 was expected
(test_running_again_keeps_one_property_setter). Check the Property
Setter's own existence in the DB instead, which is what the function
is actually trying to guarantee.
Comment thread wikify/install.py
Comment on lines +33 to +35
has_setter = frappe.db.exists(
"Property Setter", {"doc_type": doctype, "field_name": "title", "property": "fieldtype"}
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Invalid setters skip repair

If an existing Property Setter still defines title as a narrow type such as Data, this existence check treats it as valid and skips make_property_setter. The Wiki title field therefore remains subject to the old length constraint even though this setup is intended to repair title storage during installation and migration. Check the setter's configured value against WIDE_TEXT_FIELDTYPES and replace it when necessary.

Knowledge Base Used: Application services and data model

Prompt To Fix With AI
This is a comment left during a code review.
Path: wikify/install.py
Line: 33-35

Comment:
**Invalid setters skip repair**

If an existing Property Setter still defines `title` as a narrow type such as `Data`, this existence check treats it as valid and skips `make_property_setter`. The Wiki title field therefore remains subject to the old length constraint even though this setup is intended to repair title storage during installation and migration. Check the setter's configured value against `WIDE_TEXT_FIELDTYPES` and replace it when necessary.

**Knowledge Base Used:** [Application services and data model](https://app.greptile.com/bwh-tech/-/custom-context/knowledge-base/bwhtech/wikify/-/docs/application-services-and-data.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

vishwajeet-13 and others added 2 commits September 22, 2026 10:58
Approve & Build Graph, drag-to-reorder, and the per-row rename/
exclude/delete menu were still visibly enabled after publish even
though the API now rejects all of them - clicking any of them just
produced an error toast. Hide them once published, matching the
Publish button's own Published-badge treatment.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 merged commit a4b2f01 into bwhtech:main Oct 5, 2026
3 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