Skip to content

Hide unavailable low-tier build specs#3118

Merged
TorstenDittmann merged 1 commit into
mainfrom
fix-hide-low-tier-build-specs
Jul 13, 2026
Merged

Hide unavailable low-tier build specs#3118
TorstenDittmann merged 1 commit into
mainfrom
fix-hide-low-tier-build-specs

Conversation

@TorstenDittmann

Copy link
Copy Markdown
Contributor

Summary

  • hide disabled build specifications that precede the first enabled option
  • preserve disabled higher-tier specifications after enabled options
  • apply the behavior consistently to Sites and Functions
  • add unit coverage for mixed, enabled, disabled, and empty lists

Testing

  • bun run format
  • bun run lint (passes with existing warnings)
  • bun run test:unit via bun run tests (239 tests pass)
  • bun run check (blocked by existing @appwrite.io/console SDK type mismatches)
  • bun run tests E2E startup (blocked by the same existing SDK missing exports)
  • bun run build (blocked by the same existing SDK missing exports)

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a trimLeadingDisabledSpecifications helper that strips disabled build-spec entries preceding the first enabled one, then applies it to both the Functions layout loader and the Sites settings page loader.

  • src/lib/helpers/specifications.ts: New pure helper using findIndex + slice; spreads the original object so extra SpecificationList fields are preserved, and updates total to reflect the visible count. Non-mutating by design.
  • src/lib/helpers/specifications.test.ts: Four tests covering mixed, already-enabled-first, all-disabled, and empty inputs, including an explicit immutability assertion.
  • Layout/page loaders: Each loader wraps buildSpecificationsList with the helper before returning it; in the Sites settings file the default-spec assignment logic (lines 63–76) runs against the original unfiltered list first, so enabled-spec detection is unaffected by the trim.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped, purely additive, and well-covered by unit tests.

The helper is a small, pure function with no side effects. The Sites settings loader correctly separates default-spec assignment (uses the full list) from the trimmed return value, so no existing logic is disrupted. All four meaningful input shapes are tested, including the immutability invariant.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/helpers/specifications.ts New pure helper that trims leading disabled specs; correctly uses spread + slice (non-mutating), and handles all edge cases.
src/lib/helpers/specifications.test.ts Four unit tests cover mixed, already-enabled, all-disabled, and empty inputs; also verifies input is not mutated.
src/routes/(console)/project-[region]-[project]/functions/+layout.ts One-line change wrapping buildSpecificationsList with the new helper before returning it as specificationsList.
src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.ts Applies trimLeadingDisabledSpecifications to buildSpecificationsList at return time; default-spec assignment logic at lines 63-76 correctly operates on the pre-trim full list, so enabled specs are unaffected.

Reviews (1): Last reviewed commit: "Hide unavailable low-tier build specs" | Re-trigger Greptile

@TorstenDittmann
TorstenDittmann merged commit a653baa into main Jul 13, 2026
3 of 4 checks passed
@TorstenDittmann
TorstenDittmann deleted the fix-hide-low-tier-build-specs branch July 13, 2026 19:01
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