Skip to content

Conversation

@strawmelonjuice
Copy link
Collaborator

@strawmelonjuice strawmelonjuice commented Nov 28, 2025

Issues squashed with this release:

Summary by CodeRabbit

  • New Features

    • Per-page option to hide the metadata block.
    • Automatic migration from legacy config to the new config format and support for the v4 mini config edition.
  • Documentation

    • Example configuration path updated to the new filename in docs and samples.
  • Chores

    • Updated several package versions and dependency entries.
  • Improvements

    • Clearer configuration-loading errors and guidance for unknown/unreadable config formats.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Warning

Rate limit exceeded

@strawmelonjuice has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6a685e8 and 7e82ebe.

📒 Files selected for processing (2)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (11 hunks)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config/v4.gleam (1 hunks)

Walkthrough

Adds a new boolean field hide_meta_block to PageData and threads it through decoding, encoding, view rendering, and templates. Renames example config to cynthia.toml, adds a v4 config parser module, implements legacy migration/detection, and bumps several manifest dependency versions.

Changes

Cohort / File(s) Summary
Docs & manifest
README.md, cynthia_websites_mini_server/manifest.toml
README example path changed to ./cynthia.toml; multiple package versions bumped in server manifest.
Core data type
cynthia_websites_mini_client/src/cynthia_websites_mini_client/contenttypes.gleam
ContentData.PageData extended to PageData(in_menus: List(Int), hide_meta_block: Bool); decoder reads optional "hide_meta" (default False); encoder emits "hide_meta".
Client pattern updates
cynthia_websites_mini_client/src/cynthia_websites_mini_client.gleam, .../view.gleam
Pattern matches and PageData(...) constructor calls updated across client entry and view cases to include the new boolean argument.
Template context plumbing
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery.gleam
PageData match updated to extract the new field and inject hide_metadata_block into template variables.
Mold templates
.../pottery/molds/cindy_dual.gleam, .../cindy_simple.gleam
New hide_metadata_block runtime flag read from variables (default false); derives " hidden" class fragment and conditionally appends it to post_meta container classes; minor formatting tweaks.
Server config & migration
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam
Primary config filename changed to cynthia.toml; added format detection, legacy upgrade path (auto-convert/rename), new error helpers, and adjusted init template/constants; sample PageData uses updated constructor shape.
Config v4 parser
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config/v4.gleam
New module with public parse_mini() to parse v4 mini edition cynthia.toml; extracts global/server/integrations/variables, supports inline/external/file-backed variables, extensive type conversion and error handling with promise orchestration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Files needing extra attention:
    • src/cynthia_websites_mini_server/config/v4.gleam — new, dense parser with nested promises, I/O, and many type conversions/error paths.
    • src/cynthia_websites_mini_server/config.gleam — migration and format-detection flow; verify upgrade/rename behaviour and error messages.
    • src/cynthia_websites_mini_client/contenttypes.gleam and view.gleam — ensure all PageData usages match new signature and that encoder/decoder symmetry is correct.
    • pottery molds — confirm class concatenation and default behaviour for hide_metadata_block.

Possibly related PRs

Suggested labels

needs-testing

Poem

🐰 A tiny flag hops into the view,
Hide-meta whispers, soft and true.
From toml to mold it finds its place,
Gentle silence on the meta space.
A rabbit winks — templates embrace.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'RC 1.3.0' is vague and does not clearly convey the specific changes made in the pull request, which include adding a hide_meta_block feature, updating configuration filenames, and various package version bumps. Provide a more descriptive title that captures the main feature or purpose, such as 'Add hide_meta_block feature and update to v1.3.0-rc2' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@strawmelonjuice strawmelonjuice changed the title feat: Config versions implemented RC 1.3.0 Nov 29, 2025
@strawmelonjuice strawmelonjuice marked this pull request as ready for review November 29, 2025 17:49
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

♻️ Duplicate comments (1)
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_simple.gleam (1)

355-360: Same md:col-span[] class concern as in cindy_dual

The post-meta class string here also contains md:col-span[]. This appears to be the same probable typo mentioned in the dual layout; consider correcting both together to avoid inconsistent or unintended responsive behaviour.

🧹 Nitpick comments (7)
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (1)

544-546: Consider graceful error handling for directory creation.

Using let assert Ok(_) for directory creation will cause a panic if creation fails (e.g., due to permissions issues). Given that other file operations in this function use proper error handling, this should be consistent.

-  let assert Ok(_) =
-    simplifile.create_directory_all(process.cwd() <> "/content")
-  let assert Ok(_) = simplifile.create_directory_all(process.cwd() <> "/assets")
+  case simplifile.create_directory_all(process.cwd() <> "/content") {
+    Ok(_) -> Nil
+    Error(_) -> {
+      console.error("Error: Could not create content directory.")
+      process.exit(1)
+    }
+  }
+  case simplifile.create_directory_all(process.cwd() <> "/assets") {
+    Ok(_) -> Nil
+    Error(_) -> {
+      console.error("Error: Could not create assets directory.")
+      process.exit(1)
+    }
+  }
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config/v4.gleam (1)

30-37: Unreachable code after process.exit(1).

The result.map_error(string.inspect) on line 36 is unreachable because the previous result.map_error block calls process.exit(1) on error. This is dead code that adds confusion.

   use str <- promise.try_await(
     fs.read_file_sync(files.path_normalize(process.cwd() <> "/cynthia.toml"))
     |> result.map_error(fn(e) {
-      premixed.text_error_red("Error: Could not read cynthia.toml: " <> e)
+      console.error(
+        premixed.text_error_red("Error: Could not read cynthia.toml: " <> e),
+      )
       process.exit(1)
+      e
     })
-    |> result.map_error(string.inspect)
     |> promise.resolve(),
   )
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery.gleam (1)

27-27: Propagation of hide_metadata_block into the template context looks correct

The PageData pattern and the additional variables entry are consistent with the new PageData(in_menus, hide_meta_block) shape and give the layouts exactly what they need. The only tiny nit is naming: JSON uses "hide_meta", the type uses hide_meta_block, and the template key is hide_metadata_block, which might be a bit cognitive overhead later; consider aligning names or adding a short doc comment somewhere if this split is intentional.

Also applies to: 42-45

cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_dual.gleam (1)

179-191: Hide-flag decoding and class helper are sound and backwards compatible

Decoding hide_metadata_block with a default of False and converting it into " hidden"/"" is a clean way to toggle the metadata column without breaking existing content. Given the same logic exists in cindy_simple.cindy_common, you might later want a small shared helper to avoid duplication, but it’s not urgent.

cynthia_websites_mini_client/src/cynthia_websites_mini_client/contenttypes.gleam (1)

116-121: PageData schema extension and (de)serialisation look consistent and backwards compatible

Adding hide_meta_block: Bool and wiring it through content_data_decoder with optional_field("hide_meta", False, decode.bool) plus the matching "hide_meta" encoder keeps older content valid while enabling the new flag. The only thing to keep in mind is that we now have three related names ("hide_meta" JSON, hide_meta_block type field, hide_metadata_block template key); if this grows further, a brief comment in the type or a small docs note might help future readers.

Also applies to: 135-142, 161-166

cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_simple.gleam (2)

204-216: Hide-flag handling and application in the simple layout are coherent

Decoding hide_metadata_block with a default of False and appending " hidden"/"" to the post-meta container class matches the dual layout and gives a clear, non-breaking switch to hide the side block for PageData-driven pages. As in cindy_dual, this duplication could be abstracted into a helper later if you find yourself tweaking the behaviour again.

Also applies to: 355-360


219-219: Remove commented-out debug line to keep the template clean

The commented element.text(variables |> string.inspect) looks like leftover debugging; removing it would reduce noise around the layout markup.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a06f08 and f82c2d8.

📒 Files selected for processing (10)
  • README.md (1 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client.gleam (2 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/contenttypes.gleam (3 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery.gleam (2 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_dual.gleam (2 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_simple.gleam (3 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/view.gleam (5 hunks)
  • cynthia_websites_mini_server/manifest.toml (3 hunks)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (11 hunks)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config/v4.gleam (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-10T13:40:49.897Z
Learnt from: strawmelonjuice
Repo: CynthiaWebsiteEngine/Mini PR: 33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.897Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.

Applied to files:

  • README.md
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam
🔇 Additional comments (13)
README.md (1)

76-76: Configuration filename updated consistently with codebase migration.

The example configuration path has been correctly updated to ./cynthia.toml to reflect the new config filename standard across the project.

cynthia_websites_mini_server/manifest.toml (4)

21-21: Verify the gleam_httpc version downgrade.

Line 21 downgrades gleam_httpc from 4.2.1 to 4.1.1. This is unusual and could indicate a compatibility constraint or regression. Please confirm this downgrade was intentional and does not introduce compatibility issues with the HTTP client usage in the codebase.


27-27: Verify gleam_time 1.6.0 compatibility.

Line 27 upgrades gleam_time from 1.3.0 to 1.6.0, a significant version jump. Please ensure the new version is compatible with time-related operations in the config parsing or rendering pipelines, particularly given the new config v4 parser mentioned in the PR summary.


10-10: Client library version bump aligns with feature propagation.

Line 10 updates cynthia_websites_mini_client to 1.2.0-rc2. This patch version aligns with the introduction of the hide_meta_block field in PageData and its propagation through rendering paths as described in the PR summary.


32-32: Coordinated updates to template and parsing dependencies.

Lines 32, 34, and 45 update houdini (1.1.0→1.2.0), jot (5.0.0→5.0.1), and splitter (1.0.0→1.2.0). These appear well-coordinated since jot depends on both houdini and splitter. The new jot 5.0.1 with updated dependencies should support the new config v4 parser introduced in this release.

Also applies to: 34-34, 45-45

cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (3)

1-5: LGTM!

Import addition for the v4 config parser is correctly placed with other server-side imports.


129-166: LGTM!

The error helper functions provide clear, actionable error messages. The parse_config_format function cleanly uses monadic error handling with result.try.


586-644: LGTM!

The PageData instantiations correctly include the new hide_meta_block field with appropriate boolean values for each content type (e.g., True for landing pages and post lists, False for regular pages).

cynthia_websites_mini_server/src/cynthia_websites_mini_server/config/v4.gleam (3)

56-125: LGTM!

The required field parsing follows a consistent pattern with clear error messages indicating which config path is missing.


126-179: LGTM!

Optional field handling is well-implemented with sensible defaults (git integration enabled by default, crawlable context disabled by default).


415-456: LGTM!

The final assembly correctly collates all parsed values into the config object. The let assert on line 433 is safe due to the preceding error filtering logic.

cynthia_websites_mini_client/src/cynthia_websites_mini_client.gleam (1)

571-584: Menu computation correctly ignores the new hide flag

Updating the matches to PageData(soms, _) / PageData(m, _) keeps menu derivation based solely on in_menus while safely discarding the hide flag, so existing menu behaviour is preserved. No issues spotted here.

Also applies to: 587-617

cynthia_websites_mini_client/src/cynthia_websites_mini_client/view.gleam (1)

28-36: PageData flag choices per route look intentional; worth a quick UX sanity check

The new PageData([], Bool) constructions are consistent with the type order and with how you use the flag in the layouts: 404 and tag postlists hide the side metadata block, while category, search, and all-posts lists leave it visible. From a code perspective this is fine; just confirm that this matrix of True/False matches the UX you actually want for each of those special routes.

Also applies to: 54-67, 69-85, 87-103, 105-117

strawmelonjuice and others added 5 commits November 29, 2025 19:05
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (1)

108-119: Avoid silently converting config read failures into an empty string

global_conf_content_sync still uses simplifile.read(global_conf_filepath) |> result.unwrap("") (Lines 108–110). If the read fails, this turns any IO error into an empty string, so parse_config_format then fails with a generic “Cannot properly read config.edition…” message instead of the real “failed to read cynthia.toml: ”. This was flagged previously and remains unresolved.

It would be better to handle the Result explicitly here, log the underlying error, and exit before attempting to parse:

-  let global_conf_content_sync =
-    simplifile.read(global_conf_filepath) |> result.unwrap("")
+  let global_conf_content_sync =
+    case simplifile.read(global_conf_filepath) {
+      Ok(content) -> content
+      Error(e) -> {
+        console.error(
+          "Error: Could not read " <> global_conf_filepath <> ": " <> e,
+        )
+        process.exit(1)
+        panic as "We should not reach here"
+      }
+    }

This keeps the new config‑format detection while surfacing real filesystem issues clearly.

🧹 Nitpick comments (3)
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_dual.gleam (1)

360-361: Conditional hidden class concatenation is correct; consider small readability tweak

Appending " hidden" (with leading space) or "" to the static Tailwind class string is correct and yields valid class names in both cases. If you touch this again, you might consider extracting a helper that builds the full class string from the flag to make the conditional layout logic slightly clearer, but it’s not strictly necessary.

cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (2)

48-105: Legacy config auto‑upgrade flow looks good; minor error‑reporting polish possible

The cynthia‑mini.toml → cynthia.toml upgrade logic and rename flow are sound, and the user‑facing warning text is clear. One small improvement: in the True, Error(_) branch (Lines 93–100), you currently log a very generic message and discard the underlying IO error. Matching Error(e) and including string.inspect(e) in the log would make debugging failed upgrades easier, similar to how other error paths now include details.

This is non‑blocking and can be deferred.


133-169: Minor readability nits in config‑format error helpers

Functionally this section works, but there are a couple of small clarity tweaks you might consider:

  • In promise_error_unknown_config_format (Lines 137–142), the pipeline/concat chain

    "Config version "
    <> version |> int.to_string()

    relies on |> precedence to do the right thing. For readability, you may prefer the more explicit

    "Config version " <> int.to_string(version)

    or "Config version " <> (version |> int.to_string()).

  • For symmetry with promise_error_unknown_config_format, you could give promise_error_cannot_read_config_format an explicit polymorphic return type:

    fn promise_error_cannot_read_config_format() -> Promise(Result(a, String)) {
      promise.resolve(Error(
        "Cannot properly read config.edition and/or config.version, "
        <> "Cynthia doesn't know how to parse this file anymore!",
      ))
    }

    This keeps the helper generic and self‑documenting.

These are style/readability only; behaviour is fine as‑is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f82c2d8 and 6a685e8.

📒 Files selected for processing (3)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_dual.gleam (2 hunks)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_simple.gleam (3 hunks)
  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (11 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_simple.gleam
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-10T13:40:49.897Z
Learnt from: strawmelonjuice
Repo: CynthiaWebsiteEngine/Mini PR: 33
File: cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam:896-899
Timestamp: 2025-07-10T13:40:49.897Z
Learning: In CynthiaWebsiteEngine Mini, the user prefers to avoid requiring external dependencies like Pandoc during initial setup to maintain a smooth out-of-the-box experience, even if it means accepting some compatibility risks with Markdown/Djot parsing differences.

Applied to files:

  • cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam
🔇 Additional comments (3)
cynthia_websites_mini_client/src/cynthia_websites_mini_client/pottery/molds/cindy_dual.gleam (1)

179-191: Boolean decode and fallback for hide_metadata_block look solid

Decoding the flag from variables with a default False, and unwrapping failures to False, is robust and consistent with the rest of this module; this will not break rendering if the key is missing or mis‑typed. The derived hide_metadata_block_classonly keeps the downstream usage simple and readable.

cynthia_websites_mini_server/src/cynthia_websites_mini_server/config.gleam (2)

430-533: New brand_new_config template is coherent and matches the v4 config model

The brand_new_config TOML string looks structurally correct and aligns with the new “universal” cynthia.toml layout:

  • config.edition = "mini" / config.version = 4 are set up front, so parse_config_format can reliably route to the v4 parser.
  • The comments give a clear, guided starting point for users (global/server/integrations/variables/posts).
  • ownit_template is nicely documented and the triple‑quote escaping (\"\"\") appears correct for TOML.

Also, all bundled sample content here is .dj, so initial initcfg runs don’t force users to have Pandoc installed; only folks who add Markdown themselves will hit the Pandoc path later, which matches your earlier preference to keep OOTB setup dependency‑light. Based on learnings, this is a solid direction.


580-652: Sample content and new PageData usages look consistent

The updated example content in initcfg correctly threads the new PageData shape:

  • contenttypes.PageData([2], False) for hangers.dj and [1], False for themes.dj / index.dj make sense as “show meta block, appear in specific menus”.
  • For the synthetic posts listing page, data: contenttypes.PageData(in_menus: [1], hide_meta_block: True) (Line 648) is a good default so the meta block doesn’t show on the special ! permalink listing.

The ext_item for the themes page now targets a .dj source in the Mini‑docs repo, which keeps the default content consistent with the Djot‑first approach and avoids extra Markdown→Djot conversion at init time.

No issues spotted here.

@strawmelonjuice strawmelonjuice merged commit 1c8011a into main Nov 29, 2025
9 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