diff --git a/engine.py b/engine.py index c3ad724..0cb8ddb 100644 --- a/engine.py +++ b/engine.py @@ -49,6 +49,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 @@ -156,7 +159,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 @@ -190,8 +194,8 @@ def compute_version(): # [SEC F END] # [SEC G START] IO helpers -def write_file(p, text, mode="w"): - open(p, mode).write(text) +def write_file(p, text): + open(p, "w").write(text) # SEC G filler 001 # SEC G filler 002 # SEC G filler 003 @@ -226,7 +230,7 @@ def write_file(p, text, mode="w"): # [SEC H START] Main if __name__ == "__main__": - print(greet("MAIN")) + print(greet("world")) # SEC H filler 001 # SEC H filler 002 # SEC H filler 003 diff --git a/handbook.md b/handbook.md index 726910c..cbc5bf8 100644 --- a/handbook.md +++ b/handbook.md @@ -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,10 +146,10 @@ version: 1 # Chapter 5: Release Process -- bump version (semver) -- tag release +- version bump via tool +- tag & sign release - publish artifacts -- smoke test in staging +- canary 10% for 1h @@ -181,6 +183,8 @@ version: 1 # Chapter 6: Incident Response - SEV1 page immediately +- RCA start within 48h +- Postmortem by end of week - Initial RCA within 24h - Full postmortem within 72h @@ -251,7 +255,6 @@ version: 1 # Chapter 8: FAQ - Q: Who owns releases? A: Dev Infra - Q: What’s the SLA? A: 99.9% -- Q: Do we support LTS? A: 12 months diff --git a/pipeline.sql b/pipeline.sql index 6711a85..c034787 100644 --- a/pipeline.sql +++ b/pipeline.sql @@ -2,8 +2,6 @@ -- [STAGE 1 START] prepare users CREATE TEMP TABLE t_users AS --- main adds constraint --- (simulated) ALTER TABLE t_users ADD PRIMARY KEY (id); SELECT id, name, active FROM users WHERE deleted = false; @@ -43,8 +41,8 @@ WHERE deleted = false; CREATE TEMP TABLE t_active AS SELECT id, name FROM t_users -WHERE active = true AND name IS NOT NULL -LIMIT 100; +WHERE active = true AND name <> '' +ORDER BY name; -- S2 filler 001 -- S2 filler 002 -- S2 filler 003 @@ -116,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 * 1.05) AS revenue -- main applies uplift +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 @@ -152,11 +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); --- main keeps dt as DATE partition +-- feature writes to yyyymm column instead of dt -- S5 filler 001 -- S5 filler 002 -- S5 filler 003 @@ -190,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