From 44437fcddc2924bbc903c30e2419d1d1ca35945c Mon Sep 17 00:00:00 2001 From: Tom Dowley Date: Mon, 8 Sep 2025 12:28:07 +0100 Subject: [PATCH] feat: enhance greeting, add new multiply function, update logging format, bump version, refine handbook, and improve SQL queries. Co-authored-by: Genie --- engine.py | 21 ++++++++++++++------- handbook.md | 15 +++++++++------ pipeline.sql | 15 +++++++++------ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/engine.py b/engine.py index e586014..4b7a7d7 100644 --- a/engine.py +++ b/engine.py @@ -39,9 +39,11 @@ # [SEC A END] # [SEC B START] Greetings -GREETING = "Hello v1" +GREETING = "Howdy from FEATURE" +SIGNOFF = "Thanks," def greet(name): - return f"{GREETING}, {name}" + # feature chooses different punctuation & placement + return f"{SIGNOFF} {name}. {GREETING}" # SEC B filler 001 # SEC B filler 002 # SEC B filler 003 @@ -77,6 +79,9 @@ def greet(name): # [SEC C START] Math helpers def add(a, b): return a + b + +def multiply(a, b): + return a * b # SEC C filler 001 # SEC C filler 002 # SEC C filler 003 @@ -110,9 +115,9 @@ def add(a, b): # [SEC C END] # [SEC D START] Logger -LEVEL = "INFO" +LEVEL = "WARN" def get_logger(): - fmt = "[%(levelname)s] %(message)s" + fmt = "[%(levelname)s] %(name)s: %(message)s" # feature adds logger name return (LEVEL, fmt) # SEC D filler 001 # SEC D filler 002 @@ -147,9 +152,10 @@ def get_logger(): # [SEC D END] # [SEC E START] Versioning -VERSION = "1.0.0" +VERSION = "1.5.0" def compute_version(): - return VERSION + # feature appends -feature + return VERSION + "-feature" # SEC E filler 001 # SEC E filler 002 # SEC E filler 003 @@ -183,7 +189,8 @@ def compute_version(): # [SEC E END] # [SEC F START] Flags -FEATURE_X = False +FEATURE_X = True +FEATURE_Y = False # SEC F filler 001 # SEC F filler 002 # SEC F filler 003 diff --git a/handbook.md b/handbook.md index f1c5d3b..ff3cd51 100644 --- a/handbook.md +++ b/handbook.md @@ -39,9 +39,9 @@ version: 1 # Chapter 2: Coding Standards -- Use black/ruff +- Use black/ruff (lenient) - 100-col limit -- Docstrings required +- Docstrings preferred, type hints optional @@ -77,6 +77,8 @@ version: 1 - main is protected - feature branches from main - rebase before merge +- PRs must reference a ticket +- Merge via squash @@ -144,9 +146,10 @@ version: 1 # Chapter 5: Release Process -- bump version -- tag release +- version bump via tool +- tag & sign release - publish artifacts +- canary 10% for 1h @@ -180,8 +183,8 @@ version: 1 # Chapter 6: Incident Response - SEV1 page immediately -- RCA within 72h -- Postmortem doc +- RCA start within 48h +- Postmortem by end of week diff --git a/pipeline.sql b/pipeline.sql index 3de7b3e..a0d3309 100644 --- a/pipeline.sql +++ b/pipeline.sql @@ -41,7 +41,8 @@ WHERE deleted = false; CREATE TEMP TABLE t_active AS SELECT id, name FROM t_users -WHERE active = true; +WHERE active = true AND name <> '' +ORDER BY name; -- S2 filler 001 -- S2 filler 002 -- S2 filler 003 @@ -113,9 +114,10 @@ LEFT JOIN purchases p ON p.user_id = a.id; -- [STAGE 4 START] aggregate revenue CREATE TEMP TABLE t_rev AS -SELECT id, SUM(amount) AS revenue +SELECT id, SUM(amount) AS revenue -- feature keeps raw sum FROM t_join -GROUP BY id; +GROUP BY id +HAVING SUM(amount) > 0; -- feature adds HAVING -- S4 filler 001 -- S4 filler 002 -- S4 filler 003 @@ -149,10 +151,11 @@ GROUP BY id; -- [STAGE 4 END] -- [STAGE 5 START] write outputs -INSERT INTO reporting.users_daily (id, name, revenue, dt) -SELECT j.id, j.name, r.revenue, CURRENT_DATE +INSERT INTO reporting.users_daily (id, name, revenue, yyyymm) +SELECT j.id, j.name, r.revenue, TO_CHAR(CURRENT_DATE, 'YYYYMM') FROM t_join j JOIN t_rev r USING (id); +-- feature writes to yyyymm column instead of dt -- S5 filler 001 -- S5 filler 002 -- S5 filler 003 @@ -186,7 +189,7 @@ JOIN t_rev r USING (id); -- [STAGE 5 END] -- [STAGE 6 START] finalize -VACUUM ANALYZE; +ANALYZE VERBOSE; -- feature alternative finalization -- S6 filler 001 -- S6 filler 002 -- S6 filler 003