Compare commits
4
Commits
5fc5ad8656
...
9d82577f48
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d82577f48 | ||
|
|
9aeb67010f | ||
|
|
d6e5609a29 | ||
|
|
9db271b348 |
No files matched your search
@@ -144,16 +144,15 @@ and the live documentation viewer.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Brain Vault
|
## Engineering Knowledge Capture
|
||||||
|
|
||||||
Capture significant:
|
Significant engineering knowledge should be externalized to the project's external knowledge base when such a system is configured:
|
||||||
|
|
||||||
- Architectural decisions
|
- Architectural decisions with lasting trade-offs
|
||||||
- Security/threat-model changes
|
- Threat model or security posture modifications
|
||||||
- Debugging discoveries
|
- Non-obvious root cause discoveries and diagnostic breakthroughs
|
||||||
- Implementation lessons
|
- Transferable implementation lessons
|
||||||
|
|
||||||
in the appropriate `/home/kiskaadee/Brain/homelab/` or
|
Guidelines:
|
||||||
`/home/kiskaadee/Brain/learning/` location.
|
- Do not duplicate repository documentation, runtime configs, or appliance manuals in external records.
|
||||||
|
- Preserve repository-local documentation (e.g., `docs/`, inline comments, commit rationale) as the primary source of truth for runtime behavior.
|
||||||
Do not duplicate entire repository documentation in the Brain Vault.
|
|
||||||
Generated
+7
-7
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1790046670,
|
"lastModified": 1790463110,
|
||||||
"narHash": "sha256-OJe62m8gZx4xEAQnMcqH1u31/uu4Xf0q2ykAEHZfgrg=",
|
"narHash": "sha256-VZHcT2wKLkApBCACQ2SH4P1jVZUbbOA7jWAGi1MIViw=",
|
||||||
"rev": "6774f7bc253789b113a4f39285dc0fa100abeacc",
|
"rev": "e158d9ed9b51c98974c5e66e1ba1c9e0255fecaa",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1077996.6774f7bc2537/nixexprs.tar.zst"
|
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1080189.e158d9ed9b51/nixexprs.tar.zst"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
@@ -26,11 +26,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1789890976,
|
"lastModified": 1790498116,
|
||||||
"narHash": "sha256-GKwH3zpy7tartuJMG0Rv/xUsdetG1QLmTVv8UKgJLmA=",
|
"narHash": "sha256-rs9meAYxW3zzrh43yaW7htrqCD+X9+pupDPHN86fumI=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "7214124c20c1542c90deb54af50e2f53ae02711f",
|
"rev": "5efb5a6f4f5ab192817d28557dd4d650fa14d866",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ class HomepageConfig:
|
|||||||
container: str = ""
|
container: str = ""
|
||||||
weight: int = 50
|
weight: int = 50
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SourceConfig:
|
||||||
|
"""Upstream source provenance descriptor."""
|
||||||
|
type: str = "git" # "git"
|
||||||
|
url: str = "" # e.g., "https://git.roadtotech.me/kiskaadee/bitetrack.git"
|
||||||
|
ref: str = "main" # Branch (e.g. "main"), tag (e.g. "v1.0.0"), or commit SHA
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class App:
|
class App:
|
||||||
name: str # Canonical identified (e.g., "traefik", "jellyfin")
|
name: str # Canonical identified (e.g., "traefik", "jellyfin")
|
||||||
@@ -81,6 +88,7 @@ class CoreService(App):
|
|||||||
@dataclass
|
@dataclass
|
||||||
class SitesApp(App):
|
class SitesApp(App):
|
||||||
dir_name: str = "" # directory name in ~/Sites (e.g., "homelab-vaultwarden")
|
dir_name: str = "" # directory name in ~/Sites (e.g., "homelab-vaultwarden")
|
||||||
|
source: SourceConfig | None = None # Upstream source provenance (optional; None indicates Image-Only workload)
|
||||||
aliases: list[str] = field(default_factory=list) # CLI resolution aliases (e.g., "vw", "vaultwarden")
|
aliases: list[str] = field(default_factory=list) # CLI resolution aliases (e.g., "vw", "vaultwarden")
|
||||||
visible: bool = True # Defines whether the icon is visible in the Homepage Dashboard
|
visible: bool = True # Defines whether the icon is visible in the Homepage Dashboard
|
||||||
auth: bool = True # Authelia protection guard indicator; Defaulting to True is safer
|
auth: bool = True # Authelia protection guard indicator; Defaulting to True is safer
|
||||||
@@ -175,9 +183,27 @@ def sites_app_from_manifest(
|
|||||||
app_vis = _as_bool(manifest.get("visible"), True)
|
app_vis = _as_bool(manifest.get("visible"), True)
|
||||||
app_auth = _as_bool(manifest.get("auth"), True)
|
app_auth = _as_bool(manifest.get("auth"), True)
|
||||||
|
|
||||||
|
# Source provenance normalization
|
||||||
|
source_config: SourceConfig | None = None
|
||||||
|
raw_source = manifest.get("source")
|
||||||
|
if isinstance(raw_source, dict):
|
||||||
|
source_url = str(raw_source.get("url") or "")
|
||||||
|
allowed_schemes = ("https://", "ssh://", "git@")
|
||||||
|
if source_url:
|
||||||
|
if not any(source_url.startswith(s) for s in allowed_schemes):
|
||||||
|
err = f"Invalid source.url scheme: must start with {', '.join(allowed_schemes)}"
|
||||||
|
manifest_error = f"{manifest_error}; {err}" if manifest_error else err
|
||||||
|
else:
|
||||||
|
source_config = SourceConfig(
|
||||||
|
type=str(raw_source.get("type") or "git"),
|
||||||
|
url=source_url,
|
||||||
|
ref=str(raw_source.get("ref") or "main"),
|
||||||
|
)
|
||||||
|
|
||||||
return SitesApp(
|
return SitesApp(
|
||||||
name=canonical_name,
|
name=canonical_name,
|
||||||
dir_name=raw_dir_name,
|
dir_name=raw_dir_name,
|
||||||
|
source=source_config,
|
||||||
description=app_desc,
|
description=app_desc,
|
||||||
domain=app_dom,
|
domain=app_dom,
|
||||||
dir_path=app_dir,
|
dir_path=app_dir,
|
||||||
|
|||||||
@@ -120,6 +120,73 @@ def test_sites_app_normalization(app_factory: AppFactory):
|
|||||||
assert app.homepage.weight == 99
|
assert app.homepage.weight == 99
|
||||||
|
|
||||||
|
|
||||||
|
def test_sites_app_source_provenance_normalization(app_factory: AppFactory):
|
||||||
|
"""Ensure source provenance block is correctly parsed into SourceConfig"""
|
||||||
|
# 1. Source-backed app with explicit ref
|
||||||
|
app_factory.create(
|
||||||
|
dir_name="homelab-bitetrack",
|
||||||
|
manifest_yaml="""
|
||||||
|
name: bitetrack
|
||||||
|
source:
|
||||||
|
type: git
|
||||||
|
url: https://git.roadtotech.me/kiskaadee/bitetrack.git
|
||||||
|
ref: v1.2.0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# 2. Source-backed app with default ref (main)
|
||||||
|
app_factory.create(
|
||||||
|
dir_name="homelab-doc2site",
|
||||||
|
manifest_yaml="""
|
||||||
|
name: doc2site
|
||||||
|
source:
|
||||||
|
url: https://git.roadtotech.me/kiskaadee/doc2site.git
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# 3. Image-only app (no source block)
|
||||||
|
app_factory.create(
|
||||||
|
dir_name="homelab-jellyfin",
|
||||||
|
manifest_yaml="""
|
||||||
|
name: jellyfin
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
apps = engine.get_sites_apps()
|
||||||
|
|
||||||
|
bitetrack = engine.resolve_app("bitetrack", apps)
|
||||||
|
assert bitetrack is not None
|
||||||
|
assert bitetrack.source is not None
|
||||||
|
assert bitetrack.source.type == "git"
|
||||||
|
assert bitetrack.source.url == "https://git.roadtotech.me/kiskaadee/bitetrack.git"
|
||||||
|
assert bitetrack.source.ref == "v1.2.0"
|
||||||
|
assert bitetrack.to_dict()["source"]["ref"] == "v1.2.0"
|
||||||
|
|
||||||
|
doc2site = engine.resolve_app("doc2site", apps)
|
||||||
|
assert doc2site is not None
|
||||||
|
assert doc2site.source is not None
|
||||||
|
assert doc2site.source.ref == "main"
|
||||||
|
|
||||||
|
jellyfin = engine.resolve_app("jellyfin", apps)
|
||||||
|
assert jellyfin is not None
|
||||||
|
assert jellyfin.source is None
|
||||||
|
assert jellyfin.to_dict()["source"] is None
|
||||||
|
|
||||||
|
# 4. App with illegal source transport (e.g. file://)
|
||||||
|
app_factory.create(
|
||||||
|
dir_name="homelab-malformed",
|
||||||
|
manifest_yaml="""
|
||||||
|
name: malformed
|
||||||
|
source:
|
||||||
|
url: file:///etc/passwd
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
apps_updated = engine.get_sites_apps()
|
||||||
|
malformed = engine.resolve_app("malformed", apps_updated)
|
||||||
|
assert malformed is not None
|
||||||
|
assert malformed.source is None
|
||||||
|
assert malformed.manifest_error is not None
|
||||||
|
assert "Invalid source.url scheme" in malformed.manifest_error
|
||||||
|
|
||||||
|
|
||||||
## RED TESTS: TDD Goals for next implementation
|
## RED TESTS: TDD Goals for next implementation
|
||||||
|
|
||||||
@pytest.mark.xfail(reason="TDD in progress: get_docker_status not yet implemented")
|
@pytest.mark.xfail(reason="TDD in progress: get_docker_status not yet implemented")
|
||||||
|
|||||||
Reference in new issue
Block a user