Skip to content

Keep new topics after a topic folder goes missing - #75

Open
Tsyklop wants to merge 2 commits into
mainfrom
bug/keep-unresolved-yaml-content
Open

Tsyklop wants to merge 2 commits into
mainfrom
bug/keep-unresolved-yaml-content

Conversation

@Tsyklop

@Tsyklop Tsyklop commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

A student reported that Hyperskill topics kept disappearing from the course tree after an IDE restart, while their files stayed on disk. Reopening one of these topics from the browser created a second folder, <topic> (1).

Cause

One topic folder listed in Topics/section-info.yaml was gone from disk. In this case it was a stray topic that the student had deleted. From then on, every load marked the Topics section as partially loaded. For a partially loaded container, YamlFormatSynchronizer.saveItem skipped every save of its config for the whole session. This guard was added so that a truncated content: list would not be written back.

The guard also skipped the save that adds a newly opened topic. Each new topic got its folder and configs on disk but never reached content:, so the next load ignored it. The log showed this as a repeated line:

WARN YamlFormatSynchronizer - Skipping save of section `Topics`: its children were not fully resolved during load

Fix

  • Load: a container records each content: entry it could not resolve, together with the resolved entry it followed (ItemContainer.unresolvedContent).
  • Serialization: the course, section and lesson YAML mixins write content: from ItemContainer.contentNames. That is the names of items, with the unresolved entries put back in their original positions.
  • Removed guard: the save guard and StudyItem.isPartiallyLoaded are removed. A partially loaded container is saved like any other: it keeps its unresolved entries and can still gain new children.
  • Re-created children: adding a child with the name of an unresolved entry takes that entry over, so a re-created topic is not listed twice.
  • Logging: the loader logs which child it could not resolve. Before this change, only an editor notification reported it.
  • Cleanup: StudyItemConverter became unused and is removed.

Unsupported tasks in Hyperskill topic lessons are still skipped on purpose and dropped from content: on save, as before.

Already affected projects

This PR stops new topics from being lost. It does not bring back topics that were already lost: their folders are not listed in content:, and nothing scans for them. Students who are already affected still need to fix Topics/section-info.yaml by hand while the IDE is closed. Its content: list should contain exactly the Topics subfolders that have a lesson-info.yaml.

Not fixed here

The stray topic in this report came from HyperskillOpenInIdeRequestHandler.getTopicWithRecommendedSteps. When it cannot find the theory step (Can't get theory step title for <id> step), it names the topic lesson after the problem. That creates a duplicate topic, and the student deleted it.

Build fix taken from #73

main still declares the dead maven.pkg.jetbrains.space repository. Because of it, the CI jobs for 261 and 262 failed to resolve com.jetbrains.intellij.idea:idea before compiling anything. This branch carries a cherry-pick of the same one-line removal from #73 (Remove the dead JetBrains Space Maven repository). Once #73 is merged, it drops out of this PR's diff.

Testing

  • New tests: UnresolvedContentYamlTest checks four cases:
    • a lesson added to a partially loaded section survives a reload;
    • a complete load clears the unresolved entries;
    • a re-created child replaces its entry;
    • unresolved entries keep their position.
  • Local run on 263: coursecreator.yaml.*, learning.yaml.*, learning.format.*, Hyperskill projectOpen.*, HyperskillCourseUpdateTest and HyperskillLoadingTest. 144 tests ran and 143 passed.
  • The one failure: AddNewItemYamlTest > test new task file added. It runs first in the JVM for this subset and fails the same way on the base commit without this change. It passes when its class runs alone.
  • Base of the local run: the tests ran on top of Remove the dead Space repository and add IDE update loop skills #73. The files this PR touches are identical on main.
  • Not run: the full :intellij-plugin:test and verifyPlugin.

A child listed in a container's `content:` that could not be resolved on
load (its directory was deleted, its config was missing or broken) made
the container "partially loaded", and YamlFormatSynchronizer.saveItem then
skipped every save of its config for the rest of the session. Every child
added later never reached `content:` and vanished after the next restart.

For Hyperskill this lost each topic opened after a single topic folder had
gone missing: the folders stayed on disk, but the topics disappeared from
the course, and reopening one from the browser created "<topic> (1)".

Now the container remembers the unresolved entries together with the
resolved entry each one followed (ItemContainer.unresolvedContent), and
the YAML mixins write `content:` from ItemContainer.contentNames, which
puts them back in place. The container is saved as usual, so the on-disk
list keeps the unresolved names and still gains new children. Adding a
child with the same name takes the entry over. The loader now logs which
child it could not resolve.
maven.pkg.jetbrains.space no longer resolves: JetBrains Space package
hosting is shut down. Gradle asks repositories in declaration order, and
this one came before the IntelliJ Platform and Marketplace repositories,
so every artifact that was not cached yet failed on it instead of falling
through to the next repository. The new Rust plugin build for 263
(263.7307.313) broke `:intellij-plugin:hs-Rust:compileKotlin` this way,
and any build against a new IDE version would too.

The only artifact taken from it, kotlin-css-jvm 2026.8.4, is on Maven
Central.

(cherry picked from commit 53c5a41)
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.

1 participant