Upgrading from v0.28 to v0.29.0
This page lists every change in v0.29.0 that can affect code or a deploy that worked on v0.28.1. Each entry is one bullet: what changed, the old code, and the new code.
- Loud changes stop the build. The error names the change.
- Loud at run time changes compile, but the program or the CLI stops with an error that names the change.
- Silent changes compile, but the program behaves differently.
The full story of each change is in CHANGELOG.md under v0.29.0.
v0.29.1 and v0.29.2 are patch releases. The sections marked (v0.29.1) list
what v0.29.1 changes for code that worked on v0.29.0, and the sections marked
(v0.29.2) list what v0.29.2 changes for code that worked on v0.29.1. Their
full stories are in CHANGELOG.md under v0.29.1 and v0.29.2.
v0.29.2 is a patch release too. The sections marked (v0.29.2) list what it
changes for code that worked on v0.29.1. Its full story is in CHANGELOG.md
under v0.29.2.
Loud (fails to compile, the error shows the fix)
New stdlib names
- A bare name that two
exposing (..)imports now both export is[E1012]ambiguous, and the error names both modules.Sky.Core.Listgainsmap2,map3andunique.Sky.Core.Maybe,Sky.Core.Result,Sky.Core.Task,Sky.Core.Json.DecodeandStd.Db.Decodealready exportmap2/map3;Std.Db.Schema,Std.Db.StoreandStd.Db.Tableexportunique. A baremap2 f a bunder two suchexposing (..)imports ->Maybe.map2 f a b.Sky.Core.Stringgainsuncons,foldlandfoldr.Sky.Core.ListandSky.Core.Dictalready exportfoldl(Listfoldrtoo). A barefoldl f acc xsunderimport Sky.Core.List exposing (..)andimport Sky.Core.String exposing (..)->List.foldl f acc xs.
Std.CodecgainszeroJson(the JSON of a codec's zero value) andfieldZeros(the zero of each field of a record codec, whichStore.migrateuses for a required JSON or enum column). No other stdlib module exports those names, so they break no existing program.Std.CodecgainsschemaFitErrorandschemaValueError(they compare twojsonSchemaschemas, and check a JSON value against one, forStd.Db.Store). No other stdlib module exports those names.Sky.Core.Arrayis a new module with Elm's names (get,set,push,map,foldl, …). It breaks no existing program; import it qualified:import Sky.Core.Array as Array exposing (Array).Std.Image.Canvasis a new module whose drawing names (rect,ellipse,line,rgba,Fill,resize,measure) are also inStd.Ui,Std.Ui.Canvas,Std.Ui.Chart,Std.Css,Sky.Core.ProcessorStd.Ai.Provider. It breaks no existing program; import it qualified:import Std.Image.Canvas as Canvas exposing (Paint(..)).Std.Db.Storegains query builders named as SQL names them. Eight clash with names other modules export:contains(Sky.Core.String,Sky.Core.Regex),startsWithandendsWith(Sky.Core.String),select(Std.Html,Std.Db.Table),column(Std.Ui,Std.Ui.Keyed),exists(Sky.Core.File),join(Sky.Core.String,Sky.Core.Path) andon(Std.Html.Events). A bareselectunderimport Std.Db.Store exposing (..)andimport Std.Html exposing (..)is[E1012].- Before:
import Std.Db.Store exposing (..)and a bareselect attrs kids. - After:
import Std.Db.Store as Store exposing (Store)andStore.selectfor the query, or narrow one of the two exposing lists. The same fix forStore.join,Store.on,Store.columnandStore.exists.
- Before:
Sky.Core.Httpgainsheader(v0.29.1), a response header lookup that ignores case.Sky.Http.Server,Std.HtmlandStd.Emailalso export aheader. A bareheaderunderimport Sky.Core.Http exposing (..)and one of thoseexposing (..)imports is[E1012]. Fix:Http.header.Std.Db.Store.index(an index over columns) clashes withSky.Core.Json.Decode.indexandStd.Db.Table.indexunder twoexposing (..)imports. Fix:Store.index.- v0.29.2:
Std.Money.sum(it replacessumOf) meetsStd.Decimal.sum, andStd.Codec.valuemeetsSky.Core.Json.Decode.value,Std.Html.Attributes.valueand theJsonDeckernel'svalue, under twoexposing (..)imports. Fix:Money.sum,Codec.value, or narrow one exposing list.[E1012]names the export as "new since Sky v0.28.1" and links this section. - v0.29.2:
Std.Codecgainsdecimal,moneyIn,moneyObject,isoCurrencyandvalue;Std.Db.StoregainsnoCondanddefaultDecimal,indexNamedanduniqueOnNamed;Std.MoneygainsRates,rates,rate,currencyFromCodeandeqCurrency;Std.Image.CanvasgainspasteExact;Std.Db.MigrategainsinspectSchema. Apart fromvalue(above), none of them is exported by another stdlib module. Store.Tablehas two new fields,indexes : List Store.IndexSpecandproblems : List String(the builder problemspushProjectanddumpSchemarefuse).- Before:
{ name = "orders", pk = "id", cols = cols }. - After:
{ name = "orders", pk = "id", cols = cols, indexes = [], problems = [] }. Only a hand-builtTableneeds it;Store.toTableandSchema.toProjectfill it.
- Before:
Regex takes a compiled Regex
Sky.Core.Regex now has a type Regex. Regex.fromString : String -> Result Error Regex is the only way to make one, and every other function takes the
compiled value instead of the pattern String. Before, each call compiled the
pattern again, and an invalid pattern silently matched nothing (False,
Nothing, [], the input unchanged). Now an invalid pattern is an Err with
the RE2 error text, and a literal pattern is checked when the program compiles
([E2014], see docs/errors/E2014-invalid-regex.md).
Old code fails to compile with a type error whose hint names this section:
Regex functions take a compiled Regex since v0.29.0.
Regex.match p s->Regex.contains re s(Regex.matchis still there and is the same function, but it takes aRegextoo).Regex.find p s,findAll,findMatch,findAllMatches,split-> the same name with aRegexfirst.Regex.replace p replacement s,Regex.replaceWith p f s-> the same with aRegexfirst.
Before:
import Sky.Core.Regex as Regex
isCode : String -> Bool
isCode s =
Regex.match "^[A-Z]{3}-\\d{4}$" s
After: compile the pattern once, at the top level, and use the value:
import Sky.Core.Regex as Regex exposing (Regex)
codeRe : Regex
codeRe =
Regex.fromString """^[A-Z]{3}-\d{4}$"""
|> Result.withDefault Regex.never
isCode : String -> Bool
isCode s =
Regex.contains codeRe s
A literal pattern is checked when the program compiles, so
Result.withDefault Regex.never never gives never for it. For a pattern that
comes from outside (a setting, a user's search), handle the Err:
search : String -> List String -> Result Error (List String)
search pattern lines =
Regex.fromString pattern
|> Result.map (\re -> List.filter (Regex.contains re) lines)
Writing patterns: a triple-quoted string keeps a backslash ("""\d+""" is
\d+; a plain string needs "\\d+"). Inside one, \\ is one backslash
("""\\d""" is also \d) and {{ opens an interpolation, so a literal {{
is written \{{. A single { (\d{2,4}) is kept. A Regex cannot be stored
with a Codec or in a session: store the pattern.
import Sky.Core.Regex exposing (..) now also exposes contains and
fromString. Beside Sky.Core.String exposing (..) (contains), or
Sky.Core.Bytes, Sky.Core.Secret, Std.Decimal or Std.Money with
exposing (..) (fromString), a bare use is [E1012]: qualify it
(Regex.contains, String.contains).
Std.Image.Format has two more constructors
Std.Image.FormatgainsGifandWebpLossless. Acaseon aFormatthat lists every constructor and has no_branch no longer covers every case and fails to compile with a missing-pattern error that names them.- Before:
Jpeg _ -> ".jpg",Png -> ".png",Preserve -> "". - After: add
Gif -> ".gif"andWebpLossless -> ".webp", or a_branch.
- Before:
A value defined in terms of itself
- A cycle of values is
[E1018]BAD RECURSION. It used to passsky check, then deadlock on the first read (top level) or failgo build(inside alet), so no working program is affected. The error names the cycle. Seedocs/errors/E1018-value-cycle.md.- Before:
a = b + 1andb = a * 2. - After: give one of them a base value (
b = 2), or a parameter when it really is a loop (next _ = …, called asnext ()).
- Before:
Every type variable in an annotation is rigid (v0.29.2)
- A body that uses an annotation's type variable as a type, or makes two of
its variables one type, is
[E2001]. Before v0.29.2 a variable that appeared only in argument position was flexible, so such a body compiled, andcoerce : a -> bwithcoerce x = xturned aStringinto anIntthat crashed at run time. The error names the type to write.- Before:
init : a -> ( Model, Cmd Msg )withinit req = … Dict.get "cookies" req …. - After:
init : Dict String String -> ( Model, Cmd Msg ), the type the body uses. AStd.Appinittakes()(its argument holds no request): read the request withApp.withRequestinstead. - Before:
viewAddToCart : Model -> a -> Int -> Html MsgwithDb.getField "id" product. - After:
viewAddToCart : Model -> Dict String String -> Int -> Html Msg. - A body that needs a bound (
<,++) asks forcomparable/appendable/numberin place of the variable. A truly polymorphic definition needs no change.
- Before:
- A ROW variable is rigid too:
{ r | name : String }stands for the other fields a caller's record has. Reading a field the annotation does not list, returning a record with only the listed fields where{ r | … }is promised, passing the record to a function that takes a closed record, or making two row variables one is[E2001]. Each compiled before and then failed at run time with aCoerceFailure.- Before:
f : { r | name : String } -> { s | name : String }withf rec = rec. - After:
f : { r | name : String } -> { r | name : String }. - Before:
f : { r | name : String } -> Intwithf rec = rec.age. - After:
f : { r | name : String, age : Int } -> Int.
- Before:
- Arithmetic needs a number:
+,-,*,negateandabson a variable without thenumberbound are[E2001], and an unannotated helper over+refuses aStringargument. Each compiled before and then crashed inrt.AsIntat run time.- Before:
twice : a -> awithtwice x = x + x. - After:
twice : number -> number. - An integer literal now stands for a
numbervariable, sodouble : number -> numberwithdouble x = x * 2checks (it was refused) and gives5.0fordouble 2.5.
- Before:
Codec.ColType has CDecimal and CMoneyIn (v0.29.2)
- A
caseover aStd.Codec.ColTypemisses the two new arms and fails to compile, naming them.- After: add
CDecimal -> …(the decimal column ofCodec.decimal) andCMoneyIn code -> …(the decimal column ofCodec.moneyIn, whose currency is the ISOcode), or a_branch.
- After: add
Money results
v0.29.2 redesigns Std.Money around one rule: every operation that combines
two Money values by arithmetic or by order returns Result Error _, an Err
(kind InvalidInput, naming both currencies) for two different currencies.
Before, Money.add of two currencies returned the left operand and
Money.lt compared the amounts and ignored the currency, in silence. The
compiler names each removed function and its replacement.
| Before | After |
|---|---|
Money.add a b : Money | Money.add a b : Result Error Money |
Money.sub a b : Money | Money.sub a b : Result Error Money |
Money.sumOf c xs : Money | Money.sum c xs : Result Error Money |
Money.compare a b : Int | Money.compare a b : Result Error Int |
Money.lt / lte / gt / gte : Bool | : Result Error Bool |
Money.zeroOf m | Money.zero (Money.currency m) |
Money.setRate USD EUR r then Money.convert EUR m | Money.convert (Money.rates [ ( USD, EUR, r ) ]) EUR m |
Money.getRate from to : Result Error Decimal | Money.rate from to rates : Maybe Decimal |
Money.hasRate / clearRates | Money.rate … /= Nothing / a new Money.rates value |
Money.parseCurrency s : Currency | Money.currencyFromCode s : Maybe Currency |
Money.isKnownCode s / knownCurrency c | Money.currencyFromCode s and a match on CurrencyRaw _ |
Money.eq / neq, fromMinor, formatWithCode, amount, the Money type
and every scaling function (mul, percentOf, allocate, …) are unchanged.
-- Before
total = Money.add price tax
isOver = Money.gt total budget
-- After: handle the Err once, where the values meet
total = Money.add price tax -- Result Error Money
isOver =
total
|> Result.andThen (\t -> Money.gt t budget)
|> Result.withDefault True -- an amount in another currency is over
Money.sum also collides with Std.Decimal.sum: a program that imports both
modules with exposing (..) and uses a bare sum gets [E1012]; qualify it.
In Std.Ai, Provider.cost returns Result Error Money and
Trace.forResponse returns Result Error Trace (a price book whose two rates
are in different currencies has no single cost). Eval.run and
Synthetic.run refuse such a book, or a budget in another currency than its
price book, before the first call (InvalidSetting), and a report whose cost
budget is in another currency than its costs fails Eval.check with that
reason.
Ui.html takes an Html msg (v0.29.11)
Std.Ui.html was typed any -> Element msg, so the compiler checked nothing
inside the escape hatch. A raw node with an argument missing is a function,
not a node: Html.textarea [ Attr.name "lines" ] has no children list, so it
is a List (Html msg) -> Html msg. It passed sky check, built, and the view
panicked when it rendered, with rt.Coerce: expected rt.SkyADT, got func([]rt.SkyADT) rt.SkyADT.
Ui.html is now Html msg -> Element msg. The same code is [E2001] at the
call, and the error names the missing argument.
Before:
Ui.html (Html.textarea [ Attr.name "lines", Attr.rows 3 ])
After:
Ui.html (Html.textarea [ Attr.name "lines", Attr.rows 3 ] [])
Every Ui.html call that already passed a complete Html msg compiles as it
did. A call that passed another value must build an Html msg first, for
example with Html.node tag attrs children. Html.input takes one argument
(List (Attribute msg) -> Html msg), so Ui.html (Html.input [ … ]) is
complete and unchanged.
The message type is checked too. A helper typed with your own Msg that a
view typed Element msg wraps is [E2001] on that view, because the view
promises any message type and the helper fixes one:
-- before: compiled, because Ui.html took `any`
privacy : Element msg
privacy =
Ui.column [] [ Ui.html (privacyBody ()) ]
privacyBody : () -> Html.Html Msg
-- after: a helper that sends no message takes any message type
privacyBody : () -> Html.Html msg
If the helper does send messages, type the view Element Msg instead.
Loud at run time (compiles, then stops with an error)
Std.Db.Store checks names before any statement
Each item below is now Err (InvalidInput …) with a message that names the
bad name. No statement reaches the database.
findByanddeletewith a column that is not in the codec.- Before:
Store.findBy conn users "id = id OR 1" "x"ran and returned a row. - After: use a codec column (the field or its snake name):
Store.findBy conn users "id" "u1".
- Before:
- A table name outside
[A-Za-z_][A-Za-z0-9_]*or longer than 63 bytes, on every verb. Fix: name the table with letters, digits and_. - A
primaryKey,serial,unique,index,uniqueOnoruniqueWherethat names a column the codec does not carry. Before, the builder was ignored. Fix: correct the name. defaultWith,defaultNow,touchOnUpdate, adefault*builder orgeneratedwith a name that is not a column name ("created at").- v0.29.0 also refused these builders on a column name the codec does not
carry, such as
Store.defaultWith "created_at" …on a record with nocreatedAt. That was a regression: in v0.28defaultWithon such a column wrote it on every insert, and it was not "ignored". Every verb on the store failed, so an app that showed theErras an empty list showed an empty page. v0.29.1 accepts it again: see "External columns (v0.29.1)" below.
- v0.29.0 also refused these builders on a column name the codec does not
carry, such as
Store.limit norStore.offset nwithnbelow zero. Before, SQLite read a negative limit as "no limit". Fix: pass zero or more.defaultNowortouchOnUpdateon a column that is not text,uniqueOnon aMaybecolumn,defaultFloatwith NaN or Infinity, anduniqueWherewith a condition it cannot write as constants (a text match, a subquery). Each fails the first verb on the store. Before,defaultNowon anIntcolumn never decoded on SQLite and failedCREATE TABLEon PostgreSQL. Fix: aStringfield for a timestamp, a required field (oruniqueWhere … (Store.notNull "col")) for a unique key.Store.migrateadding a requireduniquecolumn to a table that has rows. Every row would get the same default, so the unique index cannot hold. Fix: add the column as aMaybefield, fill it, then make it required in a later release; or add it to an empty table.Store.pushProjectandStore.dumpSchema(sosky db pushandsky db migrate --gen) with a store whose builder named an unknown column (for exampleStore.uniqueOn [ "emial" ]). Before,sky db pushcreated the table and then failed on the index with a driver error, and--genwrote the index into a migration file. Fix: correct the name.sky db migrateof a--genfile that adds a requireduniquecolumn to a table with 2 or more rows. It failed before too (the unique index cannot hold one default on every row), with the raw database error. Now the error names the table, the column and the fix, and the migration still rolls back. Fix: in the migration file, add a{"kind": "raw", "sql": "UPDATE t SET c = …"}op between theaddColumnand theaddIndexop that gives each row its own value, or make the field aMaybe.- A row error after the first row (
Db.queryand every Store reader). Before, the rows read up to the error came back asOk. A query over a column with malformed JSON, for example, now fails: repair the row.
Std.Db.Store refuses a name it cannot write (v0.29.2)
- The Store writes table and column names unquoted. A name that is an SQL
keyword failed at its first statement with "syntax error at or near …".
A keyword of both engines (
order,select,group,from,useris not one) is now a Store builder problem: every verb on the store returnsErr (InvalidInput …)naming the column, andsky verifyreports it. A keyword of one engine (useron PostgreSQL,indexon SQLite) is refused byStore.migrateandStore.createon that engine.- Before:
{ id : String, order : Int }underCodec.auto. - After:
Codec.object Row |> Codec.field "id" .id Codec.string |> Codec.field "sort_order" .order Codec.int |> Codec.buildObject, and rename the column in a migration.
- Before:
A decimal field on a Codec.auto JSON text column (v0.29.2)
Store.migrateandStore.pushProjectrefuse aCodec.decimalorCodec.moneyInfield on a column aCodec.autoDecimal or Money field made (JSON text,"9.5"or{"amount":…}): on PostgreSQL any column that is notNUMERIC, on SQLite a column with a row that still holds that text. The error namestable.columnand the statement that converts it. A text column orders"10"before"9.5", and new writes (9.5) would mix with the old spelling.- Before: change the field to
Codec.autoWith [ ( "price", Codec.decimal ) ] blank. - After: first a migration with the named statement, then the codec change.
The statement never drops a currency. For
Codec.moneyIn GBPthe refusal gives a check query first (it lists each Money in another currency, which is never relabelled GBP), then the conversion, which fails on such a row. ForCodec.decimal, a column of Money objects gets no conversion, because the currency would be dropped: read it withCodec.moneyInorCodec.moneyObject. The statements are in docs/skydb/overview.md, "Decimal columns".
- Before: change the field to
A stored Money with an empty currency (v0.29.2)
Codec.autoandDb.Decode.moneyread a Money with nocurrency, or"currency": "", asCurrencyRaw "". It is now a decodeErr, so a Store read of such a row fails. Before the upgrade, find the rows (on the JSON text column:WHERE total NOT LIKE '%"currency":"%' OR total LIKE '%"currency":""%') and write their real currency.
Codec.auto refuses a field it cannot read back (v0.29.2)
Store.fromCodecrefuses aCodec.autostore with a builder problem: a field whose custom type has a variant carrying aDecimal,Money,Currency,Json.Valueor a type variable; a field of a stdlib custom type other thanDecimal,MoneyandCurrency; a nested anonymous record holding aDecimalorMoney; two fields that become one key (aBanda_b), in the record or in a record it holds (a nested record, aList,MaybeorDictof records, a variant's payload); aJson.Valueslot whose blank holds no JSON value (items = []for aList Json.Value,Dict.emptyfor aDict String Json.Value,more = Nothingfor aMaybe Json.Value).Codec.problemslists them. Such a field wrote rows that read back as another value or not at all, or made every read of the table fail.- After: give the field its own codec with
Codec.autoWith(aCodec.taggedUnion,Codec.list Codec.value), use a named record alias, rename one of the two fields (or useCodec.autoCamel), or put one JSON value in the blank (items = [ Json.Encode.null ],more = Just Json.Encode.null).
- After: give the field its own codec with
- A custom type whose payloads are plain values (
String,Int,Float,Bool,Char, an enum, a record, another such type, or aMaybe,ListorDictof them) now round-trips exactly.
A Store write refuses a Just written as null (v0.29.2)
Just Nothingof aCodec.maybe (Codec.maybe c)orMaybe (Maybe a)auto field, andJust Json.Encode.nullof aCodec.maybe Codec.valueorMaybe Json.Valueauto field, are refused by aStd.Db.Storewrite, naming the column, wherever theMaybeis (aList, a nested record, aDictvalue, a variant's payload). They were stored as NULL and read back asNothing. A stored NULL still reads asNothing.- After: store
Nothing, or wrap the inner value in a record or a custom type.
- After: store
Decimal and Money to Int out of range (v0.29.2)
Decimal.toInt,Decimal.toMinorandMoney.toMinorpast the 64-bit Int range, andDecimal.toFloatpast the Float range, fail as the classifiedNumericOverflowpanic. They returned a wrapped number (Money.toMinorof 10 ETH was -8446744073709551616). A server answers that request with a 500 and keeps running; a CLI exits 1 with a structured log.- After: keep large amounts as a Decimal (
Codec.moneyIn,Codec.moneyObject), or compare with the bound first.
- After: keep large amounts as a Decimal (
Decimal places and allocation limits (v0.29.2)
- Decimal places and computed exponents must be between -100000 and 100000.
An operation outside this range fails as
NumericOverflow. Previously a large places argument could wrap to an unrelated small value, or allocate an output with billions of digits.- After: check externally supplied places before using them. Keep stored decimal text within the codec reader's existing 1000-character limit.
Money.allocaterequires between 1 and 10000000 parts. Fewer than one fails asDivisionByZero, and more than the limit asNumericOverflow. Previously zero or negative parts returned an empty list and lost the amount.- After: validate the part count before allocation.
sky db status runs the app read-only (v0.29.2)
- Without
db/migrations,sky db statusruns the app'smainwith its databases read-only (SKY_READ_ONLY_DB=status) untilDb.migrateprints the status and exits. A write beforeDb.migrate(a boot log row, aCREATE TABLE IF NOT EXISTS) now fails with "attempt to write a readonly database" (SQLite) or "cannot execute … in a read-only transaction" (PostgreSQL), and the error says what to do.- Move the write after
Db.migrate, or use file migrations (sky db init):sky db statusthen readsdb/migrationsand does not runmain. - An app with no
Db.migrate(it migrates withStore.migrate) has no migration status to report: compare it with the code withsky db check, which runs no app code.
- Move the write after
sky db status reports EDITED (v0.29.2)
sky db statusshowed an applied migration file that was changed afterwards as applied and "up to date.". It now shows it as EDITED and exits 1, assky db checkdoes. Restore the file and put the change in a new migration.
Std.Db.Store checks value kinds before any statement
A value of the wrong kind for its column used to reach the database, which
converted it with no error (SQLite's CAST('abc' AS BIGINT) is 0, a 2.7 in
an integer column truncated on SQLite and rounded on PostgreSQL), or reached
the decoder, which read it as Nothing. Each item below is now an Err that
names the column, the kind and the value. The rule is in
docs/skydb/overview.md ("Value kinds").
- A written value of the wrong kind:
updateFields,setFields,setValue,setWhen,otherwise,const, adefaultWithresult.- Before:
Store.updateFields conn items cond [ ( "qty", SqlString "5" ) ]ran. After:[ ( "qty", SqlInt 5 ) ]. SqlFloatinto anIntcolumn: round or truncate in Sky first (SqlInt (round x)).SqlIntinto aFloatcolumn still works.SqlNullinto a required (non-Maybe) column: pass a value, or make the field aMaybe.- A name that is not one of an enum field's names, or JSON its codec does
not read in a JSON column (a list, record or custom type field): write
the codec's own encoding,
SqlString (Codec.toJson tagsCodec tags). SqlBytes,SqlTime,SqlDecimalandSqlMoney: bind the text the codec stores,SqlString (Decimal.toString d).- NaN or Infinity: check the value first.
- Before:
- A compared value of the wrong kind (
eq,neq,gt,gte,lt,lte,inList, auniqueWherepredicate).- A
SqlStringon anInt,FloatorBoolcolumn is read as the column's kind, as before on both engines, soStore.eq "id" (SqlString idFromUrl)keeps working. Text that is not a value of the kind ("abc"for anIntcolumn) is now anErron SQLite too (it matched no row there and failed on PostgreSQL).findByanddeletefollow the same rule. Fix: check the text first, or match theErr. SqlNull: it never matched a row on either engine. UseStore.isNullorStore.notNull.- Any other kind (
SqlInton a text column,SqlFloaton anIntcolumn): pass the column's kind.
- A
- A declared default that does not fit its column, at the first verb on the
store (
defaultTexton anIntorBoolcolumn, adefaultTextthat is not one of an enum's names or not JSON its codec reads,defaultInton aBoolor text column,defaultFloaton anIntcolumn,defaultBoolon anything but aBoolcolumn).migratewrites the default into the rows that exist, so they read back wrong. ASchema.Tabledefault (Schema.createTable,createSchema,toProject) and anaddColumnop in a migration file follow the same rule. Fix: the default of the column's kind (defaultBool "active" True, notdefaultInt "active" 1). adjuston a nullable or a non-numeric column (NULL plus a delta stayed NULL with the row counted as changed). Fix: a requiredIntorFloatfield.select,selectAs,selectColumn, anAgg(key,minAs,maxAs), acopyIntofromcolumn andsetColwhose field codec would read the source asNothing(aList Intcolumn into aMaybe (List String)field, aStringcolumn into aMaybeenum field). These verbs are new in v0.29.0.- A stored value that does not read as its column's kind (
'abc'in an integer column, text that is not JSON in a JSON column,2in a bool column). Before, the row read that field asNothing(or failed to decode a required field with a less useful message). Now the read is anErrnaming the table, the column and the kind. The shapes earlier versions wrote still read (an integer stored as text,1/0bools, timestamps). Fix: repair the rows. The same holds for a stored value that aMaybefield's codec does not read (JSON of another shape in a custom type column, a projection into a field of another type), at any depth: an element of aList (Maybe Shade)inside a JSON column that is not aShadeused to read asNothing, and is now anErrnaming the table and the column (column "palettes.xs" holds a value its field's codec does not read). A JSONnullelement still reads asNothing.setValueof such JSON is refused before the statement. selectRawwith a query that leaves out a codec column. Before, aMaybefield readNothing. Fix: select it, orNULL AS col.
Codec.maybe reads only null as Nothing
Codec.maybe c decoded any value c could not read as Nothing, so a
mistyped value disappeared with no error: "x" in a Maybe Int field, a name
that is not one of an enum's, an element of a List (Maybe a) of the wrong
shape. Now only JSON null is Nothing. Any other value must decode as the
inner value, and one that does not makes the whole decode an Err that names
where it failed (at .note: expected Int, got String). This holds for
Codec.fromJson, Codec.fromJsonSafe, Codec.fromXml, Std.Db.Store reads,
Sky.Spa wire decoding and every other use of the codec.
- What does not change:
nullisNothing,Just xround-trips, extra keys are ignored, and aCodec.objectfield must be present in the object (it was already required, aMaybefield included).Codec.autoalready readMaybefields this way (and lets aMaybefield be absent). Values a codec wrote itself always read back. - Who sees it: a
Codec.fromJsonof JSON from a third party that puts a value of another type where the codec expects aMaybe(""or"n/a"for a missing number,0for a missing string). Before, that field wasNothing. Now the decode is anErr. - Fix: repair the input, or, where a lenient read is what you want, read
that payload with
Sky.Core.Json.DecodeandDecode.maybe(any failure isNothing, as in Elm). - The
Errorwire codec (Codec.error) is unchanged: itsdetailsare the one deliberately lenientMaybe, so a details variant a later release adds (or a details payload this release cannot read) reads as no details, and anErrorfrom a newer peer keeps its kind and message.
Std.Image refuses images over its decode limits
-
What happens. Every
Std.ImageandStd.Image.Canvasfunction that decodes reads the image header first and refuses, before it decodes anything, an image over 100 megapixels (width x height), a GIF of more than 1,000 frames, or a GIF of more than 250 million pixels over all its frames (width x height x frames). TheTaskfails withInvalidInputin the domain"image", codetoo_many_pixels,too_many_framesortoo_many_frame_pixels, with the attributeslimitandvalue, and the message names the limit. In v0.28 such an image was decoded in full (400 MB and more of memory): a tiny file that claims a huge size could take the server down. -
Who is affected. Apps that process camera images above 100 megapixels (some phones take 108 or 200 megapixel photos), or long animated GIFs.
-
What to do. Check before you process, and tell the user:
Image.dimensions upload |> Task.andThen (\d -> if d.width * d.height > 100000000 then Task.fail (Error.invalidInput "the photo is too large") else Image.resizeToFit (Image.Jpeg 85) 1600 1600 upload )Image.dimensionsandImage.framesread the header only and never refuse.Image.reduceFramesmakes a long GIF fit the frame limits only when its file is already under them; resize a very long animation before upload.
Silent (compiles, behaves differently)
Task-valued root discards execute their effects (unreleased)
A root let _ = pending in … now runs pending once when its static type is
Task, including when that type comes from a signature or local annotation.
Previously, body-only inference could lose that Task classification and emit
a plain value discard, silently skipping the effect. Existing direct Task
calls still run once.
Rebuilding affected code can therefore start an I/O operation or shared-state
update that the old compiler skipped. Review code that depended on the skipped
effect. Keep a Task as a named value and run it explicitly later when delayed
execution is intended. A nested tuple wildcard, as in
let (kept, _) = (value, pending) in kept, continues to discard Task data
without executing it. Ordinary function and unconstrained polymorphic
value discards remain latent.
Money.allocate keeps the part below the minor unit (v0.29.2)
Money.allocateof an amount with digits below the currency's minor unit (1.005USD, fromMoney.mul,percentOforconvert) gave parts that summed to the truncated amount:[0.34, 0.33, 0.33]for 1.005. The digits below the minor unit now go to the first part,[0.345, 0.33, 0.33], so the parts sum exactly to the amount. Every other part is a whole number of minor units, as before.- After: to pay out whole minor units only, round the amount first
(
Money.Money (Decimal.round 2 (Money.amount m)) (Money.currency m)).
- After: to pay out whole minor units only, round the amount first
(
== on Decimal and Json.Value compares the value (v0.29.2)
Decimal "1.10" == Decimal "1.1"isTrue(it compared the stored exponent), and so are two Money values of equal amounts in one currency. TwoJson.Values are equal when they are the same JSON (5and5.0, object keys in any order). A value read back from a codec or a Store is now==to the value written.- To tell
1.10from1.1, compareDecimal.toString.
- To tell
A currency code is read in upper case by Std.Money (v0.29.2)
Money.currencyCode (CurrencyRaw "gbp")is"GBP", and everyStd.Moneyoperation takesCurrencyRaw "gbp"as GBP, as every codec already read it.==still compares how the currency was written; compare Money withMoney.eq.
Sky.Live sessions start fresh
- What happens. A
Dict(and aSet) is now a persistent value,rt.SkyDict[V], with a new stored form. A Sky.Live session kept in a SQLite, PostgreSQL or Redis session store by v0.28 whose model holds aDictcannot be read by v0.29.0 (aSetcould not be stored before v0.29.0, so no stored session holds one). The session is dropped whole: the runtime logs one line per session, for example[sky.live] postgres: failed to decode session <id>: the stored session was written by an older Sky and holds a Dict or a Set, whose stored form changed in v0.29.0; it is dropped and the visitor starts a new session, and the request is served as a new session (init). There is no panic and no half-read model. - Who is affected. Apps with a persistent session store (
[live] store/SKY_LIVE_STORE=sqlite,postgresorredis) whoseModelholds aDict, once, on the first request of each such session after the upgrade. Not affected: the memory store (it does not survive a restart anyway), a model without aDict, andApp.withDurablesnapshots (they are JSON, and v0.29 reads the JSON earlier versions wrote). - What to do. Nothing in code. A visitor with such a session sees a
fresh page once after the deploy (signed-in state that lives only in the
model is lost with it). To avoid surprise, deploy at a quiet time or tell
users. To clear the old rows yourself, delete them from
sky_sessionsbefore the deploy.
Codec.auto writes a Dict Int key as its decimal (v0.29.9)
- What happens.
Codec.autoandCodec.autoCamelwrite aDict Int vkey as its decimal,{"10":"ten"}. Before v0.29.9 they wrote the runtime's internal key,{"\u0001i10":"ten"}, which a Sky decoder read back but any other JSON reader saw as a wrong key. AFloat,CharorBoolkey is written as its plain text too (aCharas its code point). ADict String vis unchanged. The keys are in the same order as before (byte-wise). - Who is affected. Code or tools outside Sky that read this JSON (a
jsonbcolumn a Store writes, anApp.withDurablesnapshot, a saved Sky.Spa model) and expected the old key. - What to do. Nothing in Sky code. Data written by v0.29.8 and earlier still decodes: the decoder reads both forms.
- Decoded values are unchanged. The decoder turns each plain key back
into a key of the Dict's own type, at any depth (in a
List, aMaybe, a tuple, a custom type's payload), on both codec paths. A helper written overDict k vreads anIntkey as anInt, as before.
Std.Image Preserve keeps a GIF a GIF
- What happens.
Image.Preserveused to write a GIF as a PNG of its first frame. It now writes a GIF, and an animated GIF keeps every frame, each frame's delay and disposal and the loop count (comments and other extensions are dropped). A WebP underPreserveis a lossless WebP (WebP input was refused before).toAlphaandwhiteToAlphaof an animated GIF give an animated GIF (one-bit transparency); of any other image, PNG as before.JpegandPngoutputs of a GIF are unchanged: its first frame. - Who is affected. Code that passes
Preserveand then saves or serves the result as.pngorimage/pngwhatever the input was. - What to do. To keep the old output, pass
Image.Pnginstead ofImage.Preserve. Or keepPreserveand take the extension from the input (check the first bytes:GIF8is a GIF).
Std.Db.Store
-
PostgreSQL sorts NULLs like SQLite. An order term on a nullable column renders
NULLS FIRSTfororderAscandNULLS LASTfororderDesc, on both dialects. On PostgreSQL a NULL used to come last ascending and first descending. To keep the old PostgreSQL order, sort on a required column, or write the query withStore.selectRaw. -
Codec.autoCamelstores read correctly on PostgreSQL. A camelCase column used to read as NULL (aMaybefield wasNothing), and the secondStore.migratefailed. Both work now; nothing to change. -
A
defaultTextvalue keeps its meaning. A value with|,%or the texttouch("untouched") is stored as written. Before,"untouched"madeStore.updatewrite the clock into the column,"a|u"made it UNIQUE, and"a|b%c"stored'a'. A table created before v0.29.0 keeps the DDL it was created with: ifStore.create/migratemade a column UNIQUE or gave it a cut default this way, fix it by hand (DROP INDEX/ALTER TABLE … ALTER COLUMN … SET DEFAULT …). -
A nested
Maybescalar column made by v0.28 stays TEXT, and keeps working. v0.28 created the column of aCodec.objectfieldCodec.maybe (Codec.maybe Codec.int)(alsoCodec.float,Codec.bool) as TEXT on both engines and wrote the value as text ('5','7','7.5','true'). v0.29 gives the field the kindMaybe Int(Float,Bool), andmigratenever alters a column. Writes into the TEXT column keep v0.28's text on both engines: PostgreSQL binds a number or a bool into a TEXT parameter as that text, and on SQLite the Store marks each placeholder of a nullableFloatorBoolcolumn and the runtime binds the same text when the column's declared type is TEXT (anIntis stored as its decimal anyway). Reads parse the text, andeq,neqandinListmatch the rows v0.28 wrote and the rows v0.29 writes alike. An ordering condition or sort (gt,lt,orderAsc) on that column compares text ('10' < '9','false' < 'true'), as it did in v0.28. Convert the column (below) to get numeric order. From v0.29.2,sky db checkreports such a column andsky db check --sqlwrites the conversion for you. A hand-written query (Db.query,Store.selectRaw) binds what you pass: compare with the text ('true','7'). To get the column type a fresh table has, convert it once by hand, best with the app stopped. On SQLite a running app sees the new type at its next statement: from v0.29.1 the runtime keys its cache of column types onPRAGMA schema_version, which every schema change raises (in v0.29.0 it read them once per connection pool and table, so a running app kept the old type until it restarted). PostgreSQL:ALTER TABLE t ALTER COLUMN c TYPE BIGINT USING c::bigintfor anInt(DOUBLE PRECISIONwithc::double precisionfor aFloat,BOOLEANwithc::booleanfor aBool). SQLite: create the table again with the columnINTEGER(REALfor aFloat), copy the rows withINSERT INTO new SELECT … FROM old(for aBool, selectCASE c WHEN 'true' THEN 1 WHEN 'false' THEN 0 ELSE c END), drop the old table and rename the new one. After the conversion, ordering is numeric. -
Comparing a v0.28 TEXT Bool or Float column with another column.
Store.eqColand a joinStore.oncompare two columns as they are. On SQLite, against a BOOLEAN or REAL column, numeric text still matches ('7'= 7.0, by column affinity), but'true'never equals 1, so those rows are missing from the result with no error. On PostgreSQL the comparison (text = boolean) is an error. Convert the column first (the bullet above). -
A partial index on a v0.28 TEXT Bool or Float column is refused (v0.29.1). A partial index is DDL with constants, so its condition is not bound like a statement. On SQLite
Store.uniqueWhere [ "id" ] (Store.eq "active" (SqlBool True))would compareactivewith1as text and leave out every'true'row, and a unique index would let duplicates in.Store.migrate,Store.createand a migration file'saddIndexnow refuse a partial index whose condition compares a TEXT column with a number orTRUE/FALSE. The error names the column and points here. Convert the column, then migrate again. A migration file whosewherecompares with the text (active = 'true') is not refused. On PostgreSQL the database refuses the index itself.
Std.Db.Store migrate: one rule for both paths
Store.migrate (and sky db push) and sky db migrate --gen now follow the
user's rule D1: "A Maybe field gives a nullable column, any other field
gives NOT NULL. A declared builder default wins (defaultInt /
defaultText / defaultBool / defaultNow, plus a new defaultFloat),
else the zero value of the type. Existing columns are never altered. No
builder makes a required field's column nullable."
What changes for an existing app on its next migrate:
- Existing columns are not altered. Nothing is dropped, renamed, retyped
or made NOT NULL. A column that an older
Store.migrateadded nullable for a required field stays nullable, and reads decode as before. - A column the app adds from now on is
NOT NULL DEFAULT <d>for a required field (before: nullable, and a declared default was ignored).<d>is the declared default, else the zero value:0,''or false. Each column takes its OWN field's zero (Codec.fieldZeros). For a required JSON (blob) field it is the JSON of that field's zero (its value in the blank record you pass toCodec.auto, or its codec's zero in aCodec.objectcodec), sotags = []in the blank givesDEFAULT '[]', and aCodec.listfield givesDEFAULT '[]'even beside ataggedUnionfield. For a required enum field (aCodec.enumfield, or a nullary custom type underCodec.auto) it is the first name of theCodec.enum, or the witness's constructor name, because''is not one of its names. A plain String field keeps''. AMaybefield stays nullable and now keeps its declared default. - A required JSON field with no zero value (a
taggedUnion,resultorCodec.errorfield of a hand-builtCodec.objectcodec, an object field holding one, aSchema.blobcolumn) is addedNOT NULLwith no default. An empty table takes it. On a table with 1 or more rowsStore.migrateisErrand asky db migratefile fails and rolls back, both with the fix: make the field aMaybe, derive the codec withCodec.auto, or add a data step. Before v0.29.0 such a column was added nullable. - A
defaultNowcolumn added on SQLite holds the time of the ALTER in the rows that exist. New rows take the app clock atinsert/insertMany/upsert(on SQLite only; on PostgreSQL the database stamps them, as before). - Declared indexes are created by
createandmigrate(Store.index/uniqueOn/uniqueWhere, and aSchema.withIndexthroughtoProjectforsky db push).migratenever drops an index. - A new table makes a text primary key NOT NULL (SQLite accepted a NULL key before). A table that exists keeps its DDL.
- Migration files.
--genkeeps a declared default (it wrote the zero before), keeps a default on a nullable column, splits a unique added column intoaddColumn+addIndex, and writesaddIndex/dropIndexfor declared indexes. How the ledger treats files that are already applied is in the next section. - To make an old nullable leftover NOT NULL (PostgreSQL), in a migration:
UPDATE t SET c = 0 WHERE c IS NULL; ALTER TABLE t ALTER COLUMN c SET NOT NULL. On SQLite leave the column as it is: reads decode as before. Std.Db.Schema:defaultNowon atimestamp/bigInt/intcolumn now gives epoch milliseconds in a new table (it failed on PostgreSQL and stored text on SQLite). A table that exists keeps its DDL.
sky db migrate: one rule for every migration file
sky db migrate (and SKY_DB_OP=migrate ./app) renders every migration
file in db/migrations/ with the rule above, old files and new files alike.
There is no op version and no header line. The _sky_migrations ledger now
keeps, for a migration file, a checksum of its ops (the op list in a
canonical form, the same on SQLite and PostgreSQL), not a checksum of the SQL
they render to. It also has a new column, kind: ops for a migration file,
sql for hand-written Db.migrate SQL. Hand-written SQL keeps the checksum
of its text, as before.
What changes for an existing app:
- Applied files are re-stamped once, automatically. On the first
sky db migratewith v0.29, the runtime adds thekindcolumn to_sky_migrationsand gives each applied migration file its ops checksum. It logs one info line per file:db.migrate: migration '<id>' re-stamped from the v0.28 checksum to its ops checksum. Nothing in your schema changes. There is no configuration and no command to run. Before that first migrate,sky db statusshows these files as applied. - A file applied by v0.29 is checked by its ops. A later change to how an op renders to SQL never makes it look edited. An edit to the file itself still fails with "checksum mismatch", as before.
- A pending file written by v0.28 applies with the new rule. A required
field gives a
NOT NULLcolumn with its declared default, else the zero value. A required unique column on a table with 2 or more rows fails, and the migration rolls back with a message that names the table, the column and the fix. - The same file can give a different column in two environments. A
pending v0.28 file that adds a required field gives a nullable column if
v0.28 applies it, and a
NOT NULLcolumn if v0.29 applies it. Existing columns are never altered. If that difference matters to you, apply the pending migrations in every environment before you upgrade. - Downgrade to v0.28 is not supported after a v0.29 migrate. v0.28 reads the new checksums as a mismatch and stops.
Std.Db.Store insertMany and upsert compute defaultWith
insertManyandupsertleft adefaultWithcolumn out of the INSERT, so the row took the column's database default or NULL (andinsertMany's doc asked for the value in the records, which were not written either). Both now compute it for each row, asinsertdoes. Anupsertthat updates an existing row keeps the value the row holds.
External columns (v0.29.1)
An external column is a column the table has and the record codec does not
carry, such as a created_at the record leaves out.
defaultWith,defaultNow,touchOnUpdate,defaultText,defaultInt,defaultBool,defaultFloatandgeneratedaccept one again (v0.29.0 refused them, see above). The name is used as written, with no snake_case mapping. On PostgreSQL write it in lower case.defaultWith: every insert (insert,insertMany,upsert,insertReturning) writes the computed value.defaultNow: an insert stamps it (the app clock on SQLite, the column's database default on PostgreSQL).touchOnUpdatealso bumps it onupdateandupdateWhere. v0.28 treated both builders as no-ops on an external column, so the database default was the only value it got. From v0.29.1 they write the current time as text on SQLite and asnow()on PostgreSQL, so the column must be a text or a timestamp column.Store.migrateandStore.createrefuse any other type (for example anINTEGERcreated_at) on both dialects, with anErrthat names the column, its type and the builder. To keep an epoch integer, fill the column withdefaultWithinstead.- A
default*builder andgenerateddeclare it only. The Store never writes it, so the database default applies.
- The Store never creates, adds or drops an external column. A
Std.Db.Schematable or a migration owns it.Store.migrateandsky db pushcheck that the table has it. A missing table or column is anErrthat names the column and the builder.Store.createof a table that does not exist is anErr.sky db migrate --gennever writes an op for it. The schema dump marks it"external": true, and a new table gets a warning that it lacks the column.
primaryKey,serial,unique,index,uniqueOnanduniqueWherestill take codec columns only. A typo in them stays an error.- A Store builder problem is now loud. It is logged at ERROR level once per
table and problem, shown in the Sky Console, and counted in the metric
sky_store_problems_total{table}.sky verifyhas astoresstep that fails on it when the entry module exposesdb. The step skips with a note only whendbis not aStore.Project. Any other failure of its build fails the step with the build error. - An unknown column in a query condition, an order, a set or a conflict rule
is loud the same way. The
Erris unchanged.
A form POST to a page (v0.29.1)
A form submitted before a Sky.Spa or Sky.Live page is live no longer ends on a 403 JSON page.
- A native form POST to a page URL (not an
App.api "POST /path"route,/_rpcor the Sky.Live event endpoint) now answers303 See Otherto the same URL, and its body is not read. Before, it answered 403 with{"status":"csrf_missing",…}. A test or a proxy rule that expected that 403 sees the 303. - Two kinds of page answer the 303 that are not declared page routes. With
a
Server.staticNotFoundcatch-all (the Sky.Spa split mounts one at/), a native form POST to a path under its prefix that no other route takes for that method answers 303. AServer.postorServer.anyroute on the path keeps its POST: its handler runs, and a failed check is the 403. In a Sky.Live app, a native form POST to any path that is not aLive.apiorApp.apiroute or a runtime endpoint answers 303. A JSON POST, or a POST with theX-Sky-Csrfheader, keeps the 403 on every path. - A Sky.Spa split page is now a CSRF-checked GET. Its first response sets
the CSRF cookie, and its POST forms carry the
__sky_csrffield. - A response that sets the CSRF cookie is sent with
Vary: CookieandCache-Control: private, a page with no form too. An app's ownCache-Controlkeeps its other directives, lesspublicands-maxage. A CDN rule that cached such a response for every visitor no longer does. - A Sky.Spa form the app handles (
Ui.onSubmit) that is submitted while the page hydrates is held, then submitted through the app once the client is live, soupdateruns once.
Telemetry records no raw URL or full client IP (v0.29.1)
Spans, metrics, the access log, panic reports, Middleware.withLogging and
Std.Analytics page views no longer record a request's raw path, its query
string or the full client IP. Outbound Http spans and transport error text
no longer carry the query string or userinfo. See docs/observability.md,
"Request paths, query strings and client addresses".
- A dashboard or alert keyed on a raw
http.targetvalue (/reset/3f9a77c2) now sees the route template (/reset/:token,/blog/{slug}), or the path with data segments redacted (/reset/:redacted).http.targetalso has no query string. Key it onhttp.routeor on the template, or setSKY_TELEMETRY_URL=path(raw path) orfull(raw path and query) for a trusted collector. - The server span name and the
routelabel ofsky_live_requests_total,sky_live_request_secondsandsky_http_response_bytesare the Sky.Live route template where v0.29.0 had the first path segment (/resetbecomes/reset/:token). With no template, a first segment that looks like data is/:redacted(/Abc123Tokenon a 404), where v0.29.0 kept it, and a numeric one is/:redactedwhere it was/:dynamic. http.urlon an outbound span is now the redacted URL. The new attributes areurl.full,server.addressandurl.path.Http.requestnow has a client span too.- Query keys that are safe to keep:
SKY_TELEMETRY_QUERY_KEYS=page,sortorSky.Config.withTelemetryQueryKeys [ "page", "sort" ]. net.peer.ipis anonymised (203.0.113.77becomes203.0.113.0), and the newclient.addresshas the same value.SKY_TELEMETRY_CLIENT_IP=fullrecords the whole address.- The Std.Analytics
page_viewevent records the route template as itspath, and itsreferrerhas no query string, userinfo or fragment. - An
HttpErrormessage from a failed call shows the redacted URL:Get "https://api.example/v1/thing": connection refused, not the key in the query.
Header names in any case (v0.29.1)
HTTP header names are case-insensitive. HTTP/2 sends them in lower case.
- A request's
headersDict holds each name in canonical form (X-Sky-Api-Key,X-Real-Ip), on every path that builds a request. ADict.getwith the canonical name finds the header whatever case the client sent. ADict.getwith another case never matches, andsky checknow warns about a literal one.- Before:
Dict.get "x-sky-api-key" req.headersorDict.get "X-Real-IP" req.headers(alwaysNothing). - After:
Server.header "x-sky-api-key" req, which ignores case, orDict.get "X-Sky-Api-Key" req.headers.
- Before:
- A Sky.Spa client's
resp.headerswas always empty. It now holds the response's headers under canonical names. An app that testedDict.isEmpty resp.headersin the client seesFalse. Http.header name respreads a response header in any case. A helper that triedDict.get nameand thenDict.get (String.toLower name)can use it.- The middlewares (
withCors,withBasicAuth,withRateLimit,withCsrf) read their headers in any case. A hand-built request in a test with"authorization"now passeswithBasicAuth.
File error kinds (v0.29.1)
File.remove, readDir, mkdirAll, readFile, readFileLimit,
readFileBytes, writeFile, writeBytes and append no longer report an os
error as Ffi. A missing path is NotFound, a refused one
PermissionDenied, a path that already exists Conflict, anything else Io,
as File.stat already did.
- Before:
Err (Error.Error Error.Ffi _)forFile.remove "/nonexistent". - After:
Err (Error.Error Error.NotFound _). Acasethat matchedFfito mean "the file is not there" must matchNotFound.
sky test with a DSN in .env (v0.29.1)
sky test never takes a database from the project's .env, and test mode
never loads .env at all. A .env often names a shared or a production
database, and the tests and their seeds wrote to it.
- Before: in v0.29.0, a Postgres project in test mode with a DSN in
.envrefused to run. A project without a.env.testran its tests against the database its.envnamed. - After: both run on the throwaway database, and the run prints one line that
names the ignored DSN. A project whose
.envnames a database runs in test mode even without a.env.test. Any other setting in.envdoes not reach a test-mode run either. - To run the tests against a real database, put
DATABASE_URL(or<PREFIX>_DB_PATH) in.env.test, or set it in the environment. Move any other setting a test needs from.envto.env.test. - A project whose
.envnames a database, and that had no.env.test, now runssky testin test mode. In test mode every outbound HTTP request is mocked: a request with no fixture undertests/mocks/fails closed with anHttperror. A test that called a real API before now sees that error. Add a fixture for the call (seedocs/tooling/testing.md). - The clock and the random seed stay real unless
.env.testsetsSKY_TEST_CLOCK_MSorSKY_TEST_SEED. Ids fromUuidandRandomstay unique across runs. - Test mode turns on when any DSN name in
.env(<PREFIX>_DB_PATHorDATABASE_URL) is not set in the environment. To run without test mode, and so with live HTTP calls, set every DSN name your.envsets in the environment for the run, and keep no.env.test. The runtime then loads.envunder the environment as before. Test mode has no switch that sends a request to the real network. System.loadEnv ()loads nothing in test mode. A test that loaded.envwith it must put those settings in.env.test.
Database time columns read as stable text (v0.29.1)
A PostgreSQL timestamptz, timestamp, date or time column read as
text (Db.query + Db.getField, a Store or Codec String field, with no
::text in the SQL) now reads as PostgreSQL's own text on a UTC server,
whatever the time zone of the app's host. A SQLite DATE, DATETIME or
TIMESTAMP column reads in the same shapes. Before, both were Go's time
text in the host's local zone.
| Column | v0.29.0 (London host) | v0.29.1 |
|---|---|---|
timestamptz | 2026-11-01 02:13:48.987333 +0000 GMT | 2026-11-01 02:13:48.987333+00 |
timestamp | 2026-11-01 02:13:48.5 +0000 UTC | 2026-11-01 02:13:48.5 |
date | 2026-11-01 00:00:00 +0000 UTC | 2026-11-01 |
time | 02:13:48 | 02:13:48 (unchanged) |
- An app that parsed the old text must adapt. A parser that looked for
+0000 GMTor+0000 UTC, or cut the text at the first space, now sees+00right after the clock, or no zone at all.- Before:
String.replace " +0000 UTC" "" text. - After:
String.replace "+00" "" textfor atimestamptz, or nothing for atimestampor adate.
- Before:
- An app on a UTC host sees
+00where it saw+0000 UTC. An app on a host in another zone saw the instant in that zone. It now sees it in UTC. - A
datecolumn reads asYYYY-MM-DDwith no clock. - The new text is a valid parameter: written back to the same column it stores the same value. The old text was refused by PostgreSQL.
SELECT t::textis unchanged where the server'sTimeZoneis UTC. Where it is not,::textgives the server's zone and the plain column gives UTC.
Std.Ui layout fixes (v0.29.10)
An audit of the Std.Ui renderer fixed ten places where the CSS did not do what the attribute says. Nothing stops compiling. A page can look different where it used one of these, so check the places listed:
| Where | Before | Now |
|---|---|---|
centerY / alignTop / alignBottom on a child of an el, a button or a textColumn | moved the child sideways (centerY centred it horizontally) | moves it vertically. Add Ui.centerX where the horizontal centring was wanted |
Ui.width (Ui.px n) in a row, Ui.height (Ui.px n) in a column or el | shrank below n in a crowded row | keeps n. Write Ui.width (Ui.fill |> Ui.maximum n) for a box that may give way |
alignRight / centerX on inFront, above, below and the other nearby elements | did not move the element | move it. An inFront element without height fill is now as tall as its content |
alignment in and on a Ui.grid | used flex axes (vertical for X) | uses grid axes |
a height fill child of a row with centerY, alignTop or alignBottom | content-tall | fills the row |
a labelled single-line Input.* with a layout attribute | could grow tall and stretch its form | one line tall |
Ui.shrink | max-content: text never wrapped | fit-content: text wraps in a narrow space |
Ui.spacing on a Ui.paragraph | no effect | space between lines |
Border.shadow with Border.innerShadow or Border.glow | only the last showed | all show |
docs/skyui/overview.md ("Layout fixes") has the details.
Other silent changes
- Go code must not change a list it is given.
x :: xsis now amortised O(1): a list built by cons shares its memory with every older list it was built on. A Go function reached through FFI that sorts or writes a slice argument in place (sort.Strings(names)) now also changes those older lists. Copy first:sorted := slices.Clone(names); sort.Strings(sorted). The rule is indocs/ffi/boundary-philosophy.md. Sky code cannot observe the sharing: Sky lists stay immutable values. - An old list keeps its block alive. A short list kept for a long time (in
a Sky.Live model, say) that was the tail of a large accumulator keeps the
accumulator's memory alive. If a model holds such a tail, rebuild it
(
List.map identity tail) before you store it. - String kernels keep invalid UTF-8 bytes.
String.slice,left,right,dropLeftanddropRightreturn a substring of the input. An invalid UTF-8 byte inside the result is kept as it was; before, the rune round trip replaced it with U+FFFD. Valid text gives the same bytes as before, and every index still counts code points. Schema.createSchemamakesBIGINTfor a newSchema.intcolumn on PostgreSQL (v0.29.2). It madeINTEGER, whileStore.pushProject (Schema.toProject …)madeBIGINT. A table that exists keeps its type. SQL that adds abigintto aDATEfails (operator does not exist: date + bigint); cast it:DATE '1970-01-01' + day::int.- A decoded
Currencymatches its own arm (v0.29.2).Codec.autoandDb.Decode.moneygave every named currency theUSDtag, so acaseon a decodedGBPtook theUSDbranch. Code that relied on that now takes the right branch.